The following java opencv code:
IplImage image = cvCreateImage(cvSize(100, 100), IPL_DEPTH_8U, 3);
cvSaveImage("d:/tmp/test.png", image);
Creates the following image:
This seems like uncleared buffer or some pointer mis-logic. Should I clear the image after calling cvCreateImage first? How to clear the buffer?
Examining the C code, I see no code to clear the allocated array. It just contains random data.
The java call to set all pixels to single value is:
cvSet(image, CV_RGB(0, 0, 0));
I think it should be mentioned in the docs, that it is the responsibility of the caller to clear the data. We java guys are used to that constructors clear buffers, even though we understand that it might be unnecessary work sometimes.