public static BufferedImage loadImage(String directory , String fileName) { return loadImage(new File(directory,fileName).getPath()); }
public static <T extends ImageGray> T loadImage(String directory , String fileName, Class<T> imageType ) { return loadImage(new File(directory,fileName).getPath(),imageType); }
public static void main( String args[] ) { BufferedImage input = UtilImageIO.loadImage(fileName); doStuff(GrayF32.class,input); // doStuff(GrayU8.class,input); } }
@Override public BufferedImage openImage(String fileName) { BufferedImage b = cachedImage.get(fileName); if( b == null ) { b = UtilImageIO.loadImage(fileName); if( b == null ) throw new RuntimeException("Image cannot be found! "+fileName); cachedImage.put(fileName,b); } // return a copy of the image so that if it is modified strangeness won't happen BufferedImage c = new BufferedImage(b.getWidth(),b.getHeight(),b.getType()); Graphics2D g2 = c.createGraphics(); g2.drawImage(b,0,0,null); return c; }
private void loadImage( String imagePath ) { BufferedImage in = UtilImageIO.loadImage(imagePath); image = ConvertBufferedImage.convertFrom(in,(GrayF32)null); }
/** * Loads all the image in the specified directory which match the provided regex * @param directory File directory * @param regex Regex used to match file names * @return List of found images. */ public static List<BufferedImage> loadImages( String directory , final String regex ) { File[] files = new File(directory).listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.matches(regex); } }); List<BufferedImage> ret = new ArrayList<>(); for( File f : files ) { BufferedImage img = loadImage(f.getAbsolutePath()); if( img != null ) ret.add( img ); } return ret; }
@Override public BufferedImage openImage(String fileName) { BufferedImage b = cachedImage.get(fileName); if( b == null ) { b = UtilImageIO.loadImage(fileName); if( b == null ) return null; cachedImage.put(fileName,b); } // return a copy of the image so that if it is modified strangeness won't happen BufferedImage c = new BufferedImage(b.getWidth(),b.getHeight(),b.getType()); Graphics2D g2 = c.createGraphics(); g2.drawImage(b,0,0,null); return c; }
public static void main(String[] args) { BufferedImage image = UtilImageIO.loadImage("ValidationBoof/data/track_rect/TLD/01_david/00050.jpg"); new VisualizeTldDetectionApp(image,GrayU8.class); // String fileName = "/home/pja/Downloads/multi_face_turning/motinas_multi_face_turning.avi"; // SimpleImageSequence<GrayU8> sequence = // new XugglerSimplified<>(fileName, ImageDataType.single(GrayU8.class)); // // sequence.hasNext(); // sequence.next(); // sequence.hasNext(); // sequence.next(); // // new VisualizeTldDetectionApp((BufferedImage)sequence.getGuiImage(),GrayU8.class); } }
@Override public BufferedImage openImage(String fileName) { BufferedImage b = cachedImage.get(fileName); if( b == null ) { b = UtilImageIO.loadImage(fileName); if( b == null ) throw new RuntimeException("Image cannot be found! "+fileName); cachedImage.put(fileName,b); } // return a copy of the image so that if it is modified strangeness won't happen BufferedImage c = new BufferedImage(b.getWidth(),b.getHeight(),b.getType()); Graphics2D g2 = c.createGraphics(); g2.drawImage(b,0,0,null); return c; }
/** * Loads the image and converts into the specified image type. * * @param fileName Path to image file. * @param imageType Type of image that should be returned. * @return The image or null if the image could not be loaded. */ public static <T extends ImageGray> T loadImage(String fileName, Class<T> imageType ) { BufferedImage img = loadImage(fileName); if( img == null ) return null; return ConvertBufferedImage.convertFromSingle(img, (T) null, imageType); }
protected void setSelected( int selected ) { selectedImage = selected; BufferedImage imageLeft = UtilImageIO.loadImage(listLeft.get(selected).getPath()); BufferedImage imageRight = UtilImageIO.loadImage(listRight.get(selected).getPath()); leftView.setBufferedImage(imageLeft); rightView.setBufferedImage(imageRight); if( leftObservations == null ) return; leftView.setResults(leftObservations.get(selected),leftResults.get(selected),leftObservations); rightView.setResults(rightObservations.get(selected),rightResults.get(selected),rightObservations); updateResultsGUI(); }
public static <T extends ImageBase> T loadImage( File image, boolean orderRgb, ImageType<T> imageType ) { BufferedImage img = loadImage(image.getAbsolutePath()); if( img == null ) return null; T output = imageType.createImage(img.getWidth(),img.getHeight()); ConvertBufferedImage.convertFrom(img, orderRgb, output); return output; }
public static void main( String args[] ) { BufferedImage input = UtilImageIO.loadImage("../ImageProcessing/data/key_left00000.ppm"); ColorImageLabelApp app = new ColorImageLabelApp(input); ShowImages.showWindow(app,"Train HSV Classifier"); } }
public static void main( String args[] ) { // BufferedImage input = ConfigurationLoader.loadImage("media/drcsim_2_6/left000001.png"); // BufferedImage input = ConfigurationLoader.loadImage("media/drcsim_2_6/left04.png"); BufferedImage input = UtilImageIO.loadImage("../ImageProcessing/data/key_left00000.ppm"); Gaussian3D_F64 model = UtilIO.loadXML("gaussian_hood.xml"); // Gaussian3D_F64 model = ConfigurationLoader.loadXML("models/drcsim_2_6/gaussian_car_color.xml"); if( model == null ) throw new RuntimeException("Couldn't load the line"); DisplayClassificationsApp app = new DisplayClassificationsApp(); app.process(input,model); } }
public static void main( String args[] ) { VisualizeLineRansac<GrayF32,GrayF32> app = new VisualizeLineRansac<>(GrayF32.class, GrayF32.class); // app.process(UtilImageIO.loadImage(UtilIO.pathExample("simple_objects.jpg")); // app.process(UtilImageIO.loadImage(UtilIO.pathExample("shapes/shapes01.png")); app.process(UtilImageIO.loadImage(UtilIO.pathExample("lines_indoors.jpg"))); // app.process(UtilImageIO.loadImage(UtilIO.pathExample("outdoors01.jpg")); } }
public static void main( String args[] ) { VisualizeHoughPolar<GrayF32,GrayF32> app = new VisualizeHoughPolar<>(GrayF32.class, GrayF32.class); app.process(UtilImageIO.loadImage(UtilIO.pathExample("simple_objects.jpg"))); // app.process(UtilImageIO.loadImage(UtilIO.pathExample("lines_indoors.jpg")); // app.process(UtilImageIO.loadImage(UtilIO.pathExample("outdoors01.jpg")); } }
public static void main( String args[] ) { VisualizeHoughFoot<GrayF32,GrayF32> app = new VisualizeHoughFoot<>(GrayF32.class, GrayF32.class); // app.process(UtilImageIO.loadImage(UtilIO.pathExample("simple_objects.jpg"))); app.process(UtilImageIO.loadImage(UtilIO.pathExample("lines_indoors.jpg"))); } }
public static void main(String[] args) { BufferedImage original = UtilImageIO.loadImage(UtilIO.pathExample("simple_objects.jpg")); Planar<GrayF32> input = new Planar<>(GrayF32.class, original.getWidth(),original.getHeight(),3); ConvertBufferedImage.convertFromPlanar(original,input,true,GrayF32.class); Planar<GrayF32> output = new Planar<>(GrayF32.class, original.getWidth()/3,original.getHeight()/3,3); Planar<GrayF32> output2 = new Planar<>(GrayF32.class, original.getWidth()/3,original.getHeight()/3,3); AverageDownSampleOps.down(input, output); new FDistort(input,output2).scaleExt().apply(); BufferedImage outputFull = ConvertBufferedImage.convertTo_F32(output, null, true); BufferedImage outputFull2 = ConvertBufferedImage.convertTo_F32(output2, null, true); ShowImages.showWindow(original,"Original"); ShowImages.showWindow(outputFull,"3x small average"); ShowImages.showWindow(outputFull2,"3x small bilinear"); } }
public static void main(String[] args) { BufferedImage image = UtilImageIO.loadImage(UtilIO.pathExample("segment/berkeley_horses.jpg")); GrayU8 gray = new GrayU8(image.getWidth(),image.getHeight()); ConvertBufferedImage.convertFrom(image, gray); WatershedVincentSoille1991 alg = FactorySegmentationAlg.watershed(ConnectRule.FOUR); alg.process(gray); GrayS32 pixelToRegion = alg.getOutput(); VisualizeRegions.watersheds(pixelToRegion,image,0); alg.removeWatersheds(); int numRegions = alg.getTotalRegions(); BufferedImage outRegions = VisualizeRegions.regions(pixelToRegion,numRegions,null); ShowImages.showWindow(image, "Watershed"); ShowImages.showWindow(outRegions, "Regions"); } }
public static void main(String[] args) { BufferedImage input = UtilImageIO.loadImage(UtilIO.pathExample("sunflowers.jpg")); GrayU8 gray = ConvertBufferedImage.convertFrom(input,(GrayU8)null); GrayU8 flipH = gray.clone(); GrayU8 flipV = gray.clone(); GrayU8 rotateCW = new GrayU8(gray.height,gray.width); GrayU8 rotateCCW = new GrayU8(gray.height,gray.width); ImageMiscOps.flipHorizontal(flipH); ImageMiscOps.flipVertical(flipV); ImageMiscOps.rotateCW(gray, rotateCW); ImageMiscOps.rotateCCW(gray, rotateCCW); ShowImages.showWindow(gray,"Input"); ShowImages.showWindow(flipH,"Flip Horizontal"); ShowImages.showWindow(flipV,"Flip Vertical"); ShowImages.showWindow(rotateCW,"Rotate CW"); ShowImages.showWindow(rotateCCW,"Rotate CCW"); } }