Name loadImage()
Examples loadImage

size( 200, 200 );

OpenCV opencv = new OpenCV( this );
opencv.loadImage( "niolon.jpg", width, height );   // fit OpenCV image to the PApplet size

image( opencv.image(), 0, 0 );                     // display OpenCV buffer
image( loadImage("niolon.jpg"), 0, 0);             // show image source

Description Load an image from the specified file.

Currently the following file formats are supported:

  • Windows bitmaps - BMP, DIB
  • JPEG files - JPEG, JPG, JPE
  • Portable Network Graphics - PNG
  • Portable image format - PBM, PGM, PPM
  • Sun rasters - SR, RAS
  • TIFF files - TIFF, TIF

note : this method automatically updates previous memory allocation

Currently there is an impressive OpenCV-caused memory leak on Macintosh computers when recalling this method successively. To fix this bug, load the image file from Processing and pass the pixels over using copy().
Syntax loadImage(file);
loadImage(file, width, height);
file String : String : the name of file to be loaded
width int : the destination image (buffer) width size
height int : the destination image (buffer) height size
Return None
Usage Application