OpenCV and Processing 6

To perform the same image loading task in OpenCV, we use the imread() function in the Imgcodecs module. The function was in the Highgui module before. The image loaded in the Mat data structure is in BGR format. We shall use the split and merge commands to align the proper channels. Finally, we use a byte array to transfer the pixels information to the pixels[] array of a PImage object.
Continue reading

OpenCV and Processing 5

Now we proceed to first core part of the tutorials, representation of image in Processing and OpenCV. In Processing, the class is PImage. Digital video, Movie and live webcam feed, Capture are also PImage. When we import the external image file from the data folder through loadImage(), the format will usually be RGB. The internal representation is, however, ARGB.
 
Continue reading

OpenCV and Processing 3

This example will demonstrate the use of CvType, Size and Scalar.

CvType defines all the matrix types in OpenCV. It describes the number of channels, and depth information for each element (pixel) in the matrix. This example will use CV_8UC1 – 8 bits unsigned char, 1 channel. To communicate with Processing, we usually take CV_8UC4 for ARGB as the RGB format in PImage also uses 4 bytes for storage.
 
Continue reading

OpenCV 3.0.0 rc1 Java build

I built the OpenCV 3.0.0 rc1 64-bit Java bindings and packaged into one single file. You can use it for the Processing examples. Copy them to the code folder of the sketch for simple testings.

opencv_java300_rc1 (64-bit)

It includes the following files,

  • opencv-300.jar
  • libopencv_java300.dylib (patched with the @loader_path)
  • libopencv_java300.so (built in Ubuntu 64 bit)
  • opencv_java300.dll (default one from the pre-built binary)

OpenCV and Processing 1

This is the beginning of a series of posts related to using OpenCV and Processing in the Linux environment. I built the OpenCV 3.0.0 rc1 in Ubuntu. By putting the 2 files, libopencv_java300.so and opencv-300.jar in the code folder of a sketch, I can use the alpha version 3.0a7 of Processing and the official Java binding of OpenCV together to prepare for the examples of a newly proposed book in image processing and computer vision. I do not use the OpenCV for Processing library by Greg Borenstein, in order to reveal the underlying working mechanism of OpenCV for learning purpose.
 
Continue reading