Great. I didn’t see that, thanks. It looked like a classic dangling pointer problem but I couldn’t figure out how, since it didn’t crash, and just gave the white frames. Now I see why, it’s the way you draw() in OF. I’m only just now really starting to work with your frameworks. I’ll be using them a lot more in the second semester when we start exploring it more officially in my atelier.
As for JNI it’s not all that bad once you’ve banged your head a few times against the wall. Also Stéphane’s a pro so I’m a little spoiled. So far we’ve figured out the JNI transfer back and forth. Processing stores data in a single int, whereas openCV stores them as 3 successive unsigned char, so we have to convert everything (ugh) as well as convert the ints to jints via JNI, etc. It makes me a little concerned for speed. On the question of speed, I was wondering why you had so many pass-by-copies in there. Usually one passes pointers when dealing with video, in order to maintain speed. You can’t do that with Java (obviously) but you should be able to do it in C++. Maybe I’m missing something?
Another question (I’m starting to nag here): have you tried the native OpenCV grabber instead of the Quicktime/VfW ones? I’m thinking of functions like: cvGrabFrame(), cvRetrieveFrame(), etc. which are designed for working with video quickly. It seems to me that passing video from Quicktime to OpenCV might slow things down a bit.
Yet another question: I don’t understand why you do a memcopy on each line of the video frame, as opposed to copying the whole block. I’m thinking explicitly of this line:
for (int i = 0; i < height; i++){
memcpy(pixels + (i * width * 3), cvImage->imageData + (i * cvImage->widthStep), width*3);
}
Again, I’m sure I just haven’t understood something.
Anyway, as for JNI. We’ve figured it all out, and we’re compiling fine using the sourceforge CVS, so it’s now just a question of making the JNI wrappers. OpenFrameworks has been great for that part of the project. Even if we won’t use all the code directly (obviously), it’s definitely a part of the process.
But OpenCV is so huge, it’s hard to know where to start. Contours is a great start, face tracking is probably a good next step, but there’s so much in there. Any suggestions on what you were planning next?