ofxCvGrayscaleImage setFromPixels problem!

Hello,

I use a function to get the frame grabbed from the camera that gives me:


mtCompletionCode Camera_ImagesGet ( mtHandle handle,
unsigned char * p_LeftImageBuffer,
unsigned char * p_RightImageBuffer
)

Obtain a copy of the images of the most recent frame.

The 8-bit (1 byte/pixel) images obtained in the most recent frame grab. The number of columns and rows in the buffer can be obtained by calling Camera_ResolutionGet().

Parameters:
handle The handle of the object.
p_LeftImageBuffer Pointer to the output buffer, pre-allocated by the client, to contain the left image
p_RightImageBuffer Pointer to the output buffer, pre-allocated by the client, to contain the right image

Im using setFromPixels with a pointer to the data…but…

sometimes is worse than that…

thnx
Tasos

To add something!!!

I can do the same thing with just openCV code and it works.
What is the difference?

frame_size = cvSize( width, height );
frame = cvCreateImage( frame_size, IPL_DEPTH_8U,1);
waste_frame = cvCreateImage( frame_size, IPL_DEPTH_8U,1);

frame_data = (unsigned char*) cvPtr1D( frame,0);
waste_data = (unsigned char*) cvPtr1D( waste_frame,0);

MTC( Camera_ImagesGet(CurrCamera, frame_data, waste_data) );

cvShowImage( “mainWin”, frame );

and in OF:

frame_size = cvSize( 1024, 768 );
frame = cvCreateImage( frame_size, IPL_DEPTH_8U,1);
waste_frame = cvCreateImage( frame_size, IPL_DEPTH_8U,1);

frame_data = (unsigned char*)cvPtr1D( frame,0);
waste_data = (unsigned char*)cvPtr1D( waste_frame,0);


MTC( Camera_ImagesGet(CurrCamera, frame_data, waste_data) );
micronImg.setFromPixels( frame_data , 1024, 768);

Maybe it will help!

Tasos