private void loadImage( String imagePath ) { BufferedImage in = UtilImageIO.loadImage(imagePath); image = ConvertBufferedImage.convertFrom(in,(GrayF32)null); }
/** * 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); }
@Override protected void configureVideo( int which , SimpleImageSequence sequence ) { sequence.setLoop(true); }
/** * * <p>Saves the BoofCV formatted image. This is identical to the following code:</p> * * <pre> * BufferedImage out = ConvertBufferedImage.convertTo(image,null,true); * saveImage(out,fileName); * </pre> * * @param image Image which is to be saved. * @param fileName Name of the output file. The type is determined by the extension. */ public static void saveImage( ImageBase image , String fileName ) { BufferedImage out = ConvertBufferedImage.convertTo(image,null,true); saveImage(out,fileName); }
@Override public T next() { if( bufferedImage == null ) bufferedImage = webcam.getImage(); ConvertBufferedImage.convertFrom(bufferedImage, output, true); return output; }
public static void main( String args[] ) { BufferedImage input = UtilImageIO.loadImage(fileName); doStuff(GrayF32.class,input); // doStuff(GrayU8.class,input); } }
public void cacheNext() { selected = (selected+1)%queueBoof.length; T sBoof = sequence.next(); BufferedImage sBuff = sequence.getGuiImage(); queueBoof[selected].setTo(sBoof); queueBuff[selected] = ConvertBufferedImage.checkCopy(sBuff,queueBuff[selected]); }
public void run() { ConvertBufferedImage.convertTo(output, renderedImage, true); gui.repaint(); } });
public boolean hasNext() { return sequence.hasNext(); }
public static void bufferedToGray(BufferedImage src, InterleavedU8 dst) { bufferedToGray(src, dst.data, dst.startIndex, dst.stride); }
public void setBufferedImage( BufferedImage buff ) { queueBuff[selected] = ConvertBufferedImage.checkCopy(buff,queueBuff[selected]); }
public static void orderBandsIntoRGB( ImageInterleaved image , BufferedImage input ) { if( image instanceof InterleavedU8 ) { orderBandsIntoRGB((InterleavedU8)image,input); } else if( image instanceof InterleavedF32 ) { orderBandsIntoRGB((InterleavedF32)image,input); } else { throw new IllegalArgumentException("Unsupported interleaved type"); } }
@Override protected void configureVideo(int which, SimpleImageSequence sequence) { sequence.setLoop(true); }
public static void bufferedToGray(BufferedImage src, InterleavedF32 dst) { bufferedToGray(src,dst.data,dst.startIndex,dst.stride); }
@Override protected void configureVideo(int which, SimpleImageSequence sequence) { sequence.setLoop(true); }
/** * <p> * Converts a buffered image into an 8bit intensity image using the * BufferedImage's RGB interface. * </p> * <p> * This is much slower than working * directly with the BufferedImage's internal raster and should be * avoided if possible. * </p> * * @param src Input image. * @param dst Output image. */ public static void bufferedToGray(BufferedImage src, GrayF32 dst) { bufferedToGray(src,dst.data,dst.startIndex,dst.stride); }
@Override protected void configureVideo(int which, SimpleImageSequence sequence) { sequence.setLoop(true); }
/** * <p> * Converts a buffered image into an 8bit intensity image using the * BufferedImage's RGB interface. * </p> * <p> * This is much slower than working * directly with the BufferedImage's internal raster and should be * avoided if possible. * </p> * * @param src Input image. * @param dst Output image. */ public static void bufferedToGray(BufferedImage src, GrayU8 dst) { bufferedToGray(src, dst.data, dst.startIndex, dst.stride); }
@Override protected void process(SimpleImageSequence<I> sequence1, SimpleImageSequence<I> sequence2 ) { // stop the image processing code stopWorker(); sequence1.setLoop(false); sequence2.setLoop(false); this.sequence1 = sequence1; this.sequence2 = sequence2; // start everything up and resume processing doRefreshAll(); }
@Override protected void process(SimpleImageSequence<I> sequence ) { // stop the image processing code stopWorker(); this.sequence = sequence; sequence.setLoop(false); // start everything up and resume processing doRefreshAll(); }