Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi ,

I am sure some of you must have tried this.

I am using the ICamera interface on Moto V265. In the preview mode I capture the Frames and display them. Now I want to access the pixel data in the Frame. The only way i know to do this is to create a IDIB from the Bitmap.

I am doing this right now in the Camera callback function.

case CAM_STATUS_FRAME:
// [Any] Frame captured by camera.
if(pn->nCmd == CAM_CMD_START && pn->nSubCmd == CAM_MODE_PREVIEW)
{
IBitmap * pFrame;
AEEBitmapInfo bi; //
IDIB *pIDib = NULL;
int nRet;
ICAMERA_GetFrame(pMe->m_pICamera, &pFrame);
if (!pFrame)
{
DBGPRINTF("DID not get FRAME");
break;
}
nRet = IBITMAP_QueryInterface( pFrame,AEECLSID_DIB,(void **)&pIDib);
DBGPRINTF("Return for Query Interface : %d", nRet);

// Get the bitmap info...this can be saved in app global structure.
IBITMAP_GetInfo(pFrame, &bi, sizeof(bi));
// Display the frame at (0, 0) location of the screen
IDISPLAY_BitBlt(pMe->pIDisplay, 2, 2, bi.cx, bi.cy, pFrame, 0, 0, AEE_RO_COPY);
IBITMAP_Release(pFrame);
IDISPLAY_Update(pMe->pIDisplay);
}

I get nRet = 20 (EUNSUPPORTED ). In the documentation of ICAMERA_GetFrame() it mentions that the user can do a QueryInterface on the Bitmap returned if it is supported.

Now as long as I am not calling the QueryInterface function correctly, It is not supported on Moto V265.

Is there any other way I can access the pixel data from the raw frame that is returned ?

Also in the BitMapinfo structure i get nDepth = 0;

Appreciate your suggestions :)

R@i

The current camera frame bitmap implementation does not return a DIB. What you can do is draw the frame to an offscreen IBitmap, and then query that for an IDIB.

The current camera frame bitmap implementation does not return a DIB. What you can do is draw the frame to an offscreen IBitmap, and then query that for an IDIB.

hi Nathan,
I am sorry .. I am just a little new to this. Could you tell what you mean by an offscreen IBitmap. I mean how should I go about creating that.
I tried the COVERTBMP macro too but It didnt create a device dependent Bitmap for me. Maybe I was just not using it correctly.
What method should I use to create a IBitmap.... I
think that I would have call Bltin function of the new offscreen bitmap to copy the pixel values into it from the Camera Frame bitmap.
Am I thinking in the right direction ? :confused:
Thanks again
R@i

hi Nathan,
I am sorry .. I am just a little new to this. Could you tell what you mean by an offscreen IBitmap. I mean how should I go about creating that.
I tried the COVERTBMP macro too but It didnt create a device dependent Bitmap for me. Maybe I was just not using it correctly.
What method should I use to create a IBitmap.... I
think that I would have call Bltin function of the new offscreen bitmap to copy the pixel values into it from the Camera Frame bitmap.
Am I thinking in the right direction ? :confused:
Thanks again
R@i

IDISPLAY_GetDeivceBitmap for device bitmap, for device independent bitmap IDISPLAY_CreateDIBitmap. There are many threads of discussion on this topic, do little search.

IDISPLAY_GetDeivceBitmap for device bitmap, for device independent bitmap IDISPLAY_CreateDIBitmap. There are many threads of discussion on this topic, do little search.

Thanks for your help guys .. got it working ..
using the IDISPLAY_GetDeviceBitMap() function to get a BITMAP and then create a compatible bitmap with the size of the frame and then BLTIN the pixels from the frame into this Frame.
Regards
R@I

Thanks for your help guys .. got it working ..
using the IDISPLAY_GetDeviceBitMap() function to get a BITMAP and then create a compatible bitmap with the size of the frame and then BLTIN the pixels from the frame into this Frame.
Regards
R@I