Hi Everybody,
First of all, thanks for sharing your code! I try to make CLeye working with Of and it’s a really good base to get in it.
I’ve got a first question, the ofxCLeye an the example given in the thread are working good for me only for 320X240 resolution in mono, otherwise it give me a memory bad access, it’s ok for mono but I can’t figure out why it doesn’t work with 640X480 resolution.
I go a little further deep in the code and remark that the memory allocation and memory copy does not have the same size than in the videograbber class from OF wich use a size of width*height*3 instead of width*height in ofxCLeye, is there an obvious reason that I missed on this point ? By changing this in ofxCLeye code, I’m able to work on 640X480 resolution.
Second point, Color management will be great, maybe using OpenCV could be a option ?
I found this on this point :
Note that to convert an ofxCvColorImage to IPLImage we use setFromPixels, to convert an IPLImage to grayscale or color we use cvCvtColor, and to convert the type of the image from IPL_DEPTH_8U to IPL_DEPTH_32F and vice-versa we use cvConvertScale. To convert from IPLImage to ofxCvColorImage the image must be in the IPL_DEPTH_8U format with 3 channels, and just use “=”.
Some OpenCv functions require that the image to be in 32 bit float format. For further information read the OpenCV reference. There is no need to include additional files, OpenFrameworks already includes the OpenCV headers.
here:
OpenCV and OpenFrameworks integration
In this case the problem is to convert the IPLImage in 3 channel in order to convert it to an OF compatible format.
Does it make sense ?
===========================
Edit:
I miss something obvious, I was a bit disappointed by the loop inside the CLeye project given in this thread…
So let make think clear, the format in MONO_RAW or MONO_PROCESSED seems to be 3-byte RGB in one channel,the loop inside testApp::updateClEye(int id) confusing me, because it make an implicit conversion of 3-byte RGB in one channel to 3-byte RGB in three channel for OF ?
This code seems to work correctly:
void testApp::updateClEye(int id){
clEye[id]->grabFrame();
if (clEye[id]->isFrameNew()){
int totalPixels = camWidth*camHeight;
unsigned char * pixels = clEye[id]->getPixels();
for (int i = 0; i < totalPixels; i++){
videoInverted[i] = 255 - pixels[i];
}
videoTexture[id]->loadData(videoInverted, camWidth,camHeight, GL_RGB);
}
}
for COLOR_RAW or COLOR_PROCESSED the format seems to 3-byte RGB but in four channel
It is correct ?