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

Developer

Forums

Forums:

Hello,
How can I Obtain ARGB pixel data from a specified region of *this image and store it in a provided array of integers?

(24 bit bitmaps)

I tried the code below:

getRGB(int32 * rgbData, int32 offset, int16 scanlength, int16 x, int16 y, int16 width, int16 height)
{
IDIB *pIDIB = NULL;

int retVal = IBITMAP_QueryInterface(m_hBitmap, AEECLSID_DIB,(void**)&pIDIB);

for (int i = 0; i< width * height ; i++)
{
rgbData[offset + i] = (int32)pIDIB->pBmp[i]);//

}
IDIB_Release(pIDIB);

}

and it draws me only black (0x00000000)

Please help,
Gal

Hi ,
You have not created the PDIB.
IBitmap * pDeviceBitmap;
IBitmap * pBackUpBitmap;
IDIB * pIDIB;
IDISPLAY_GetDeviceBitmap(pMe->a.m_pIDisplay, &pDeviceBitmap);
IBITMAP_CreateCompatibleBitmap(pDeviceBitmap, &pBackUpBitmap, bi.cx, bi.cy);
IBITMAP_QueryInterface(pBackUpBitmap, AEECLSID_DIB,(void**) &pIDIB);

Hi ,
You have not created the PDIB.
IBitmap * pDeviceBitmap;
IBitmap * pBackUpBitmap;
IDIB * pIDIB;
IDISPLAY_GetDeviceBitmap(pMe->a.m_pIDisplay, &pDeviceBitmap);
IBITMAP_CreateCompatibleBitmap(pDeviceBitmap, &pBackUpBitmap, bi.cx, bi.cy);
IBITMAP_QueryInterface(pBackUpBitmap, AEECLSID_DIB,(void**) &pIDIB);

Hi skumar,
Thanks for your reply, but my problem is not the creation of a device independent IDIB, it is how to manipulate it with my current BITMAP to obtain the data from it...

Hi skumar,
Thanks for your reply, but my problem is not the creation of a device independent IDIB, it is how to manipulate it with my current BITMAP to obtain the data from it...

As you said in previous post you bitmap (IDIB) is of 24 bits. You can memcpy(MEMCPY) raw data of size (width * height * 3) taking pIDIB->pBmp as source.

As you said in previous post you bitmap (IDIB) is of 24 bits. You can memcpy(MEMCPY) raw data of size (width * height * 3) taking pIDIB->pBmp as source.

Thanks but it still doesnt work. I'm missing something here...
Is there a source code that works and I can check if its working for me?

Thanks but it still doesnt work. I'm missing something here...
Is there a source code that works and I can check if its working for me?

here is the code that i used but i got a 16 bit Bitmap not 24 bit.
IBitmap * pFrame;
IBitmap * pDeviceBitmap;
IBitmap * pBackUpBitmap;
IDIB * pIDIB;
AEEBitmapInfo bi; // // IMPORTANT NOTE: You need to do IBITMAP_Release(pFrame) after you're done with pFrame.
int nErr = ICAMERA_GetFrame(pMe->m_pICamera, &pFrame);
if (!pFrame)
{
DBGPRINTF("DID not get FRAME");
break;

// Get the bitmap info...this can be saved in app global structure.
IBITMAP_GetInfo(pFrame, &bi, sizeof(bi));
IDISPLAY_GetDeviceBitmap(pMe->a.m_pIDisplay, &pDeviceBitmap);
IBITMAP_CreateCompatibleBitmap(pDeviceBitmap, &pBackUpBitmap, bi.cx, bi.cy);
IBITMAP_BltIn(pBackUpBitmap, 0, 0, bi.cx, bi.cy, pFrame, 0, 0, AEE_RO_COPY );
if(IBITMAP_QueryInterface(pBackUpBitmap, AEECLSID_DIB,(void**) &pIDIB)== SUCCESS)
{
MEMCPY(pMe->RawBuffer,pIDIB->pBmp,(bi.cx*bi.cy*2));

else
{
DBGPRINTF("DID not Got DIB INterface");

here is the code that i used but i got a 16 bit Bitmap not 24 bit.
IBitmap * pFrame;
IBitmap * pDeviceBitmap;
IBitmap * pBackUpBitmap;
IDIB * pIDIB;
AEEBitmapInfo bi; // // IMPORTANT NOTE: You need to do IBITMAP_Release(pFrame) after you're done with pFrame.
int nErr = ICAMERA_GetFrame(pMe->m_pICamera, &pFrame);
if (!pFrame)
{
DBGPRINTF("DID not get FRAME");
break;

// Get the bitmap info...this can be saved in app global structure.
IBITMAP_GetInfo(pFrame, &bi, sizeof(bi));
IDISPLAY_GetDeviceBitmap(pMe->a.m_pIDisplay, &pDeviceBitmap);
IBITMAP_CreateCompatibleBitmap(pDeviceBitmap, &pBackUpBitmap, bi.cx, bi.cy);
IBITMAP_BltIn(pBackUpBitmap, 0, 0, bi.cx, bi.cy, pFrame, 0, 0, AEE_RO_COPY );
if(IBITMAP_QueryInterface(pBackUpBitmap, AEECLSID_DIB,(void**) &pIDIB)== SUCCESS)
{
MEMCPY(pMe->RawBuffer,pIDIB->pBmp,(bi.cx*bi.cy*2));

else
{
DBGPRINTF("DID not Got DIB INterface");

thanks alot.
Something is working now. I will work on it.

thanks alot.
Something is working now. I will work on it.

hi,
I'm new to brew.
I'm using UDP Socket.
Is it possible to display the captured frame pframe(using ICAMERA_GetFrame & IBitmap_getinfo) on the pc via socket.
For this to happen is it sufficient to send bi buffer or pframe buffer is required.
Thanks

hi,
I'm new to brew.
I'm using UDP Socket.
Is it possible to display the captured frame pframe(using ICAMERA_GetFrame & IBitmap_getinfo) on the pc via socket.
For this to happen is it sufficient to send bi buffer or pframe buffer is required.
Thanks

Quote:Is it possible to display the captured frame pframe(using ICAMERA_GetFrame & IBitmap_getinfo) on the pc via socket.
Yes it is possiable to capture the raw frame and send to server using Isocket interface but i suggest you capture a JPEG image so that the size of the dat to transfer to the server will be small. also y not you useing the reliable TCP socket.
Quote:For this to happen is it sufficient to send bi buffer or pframe buffer is required.
if you want to send the raw frame to server then you have to get the raw data from the Ibitmap strcture and put the bitmap as header and send total data to server. As Ibitmap is device dependent bitmap it will not be in proper format to be read by any windows application.
Best of luck

Quote:Is it possible to display the captured frame pframe(using ICAMERA_GetFrame & IBitmap_getinfo) on the pc via socket.
Yes it is possiable to capture the raw frame and send to server using Isocket interface but i suggest you capture a JPEG image so that the size of the dat to transfer to the server will be small. also y not you useing the reliable TCP socket.
Quote:For this to happen is it sufficient to send bi buffer or pframe buffer is required.
if you want to send the raw frame to server then you have to get the raw data from the Ibitmap strcture and put the bitmap as header and send total data to server. As Ibitmap is device dependent bitmap it will not be in proper format to be read by any windows application.
Best of luck

Hi Sunil,
Thanks for the reply.
I'm using UDP b'coz it is faster than TCP.
My objective is to capture the camera frame and pass it to the pc in real time.
How to recover the raw data from ibitmap? :confused:
can u pls give the list of events to be followed or the sample code snippet.
Thanks,
Celia

Hi Sunil,
Thanks for the reply.
I'm using UDP b'coz it is faster than TCP.
My objective is to capture the camera frame and pass it to the pc in real time.
How to recover the raw data from ibitmap? :confused:
can u pls give the list of events to be followed or the sample code snippet.
Thanks,
Celia

Quote:I'm using UDP b'coz it is faster than TCP.
Did you comapered the time to transfering "raw data on UDP" and "JPEG on TCP".
I bet on TCP with compressed image.
Search this forum in another post i replyed to the same question.

Quote:I'm using UDP b'coz it is faster than TCP.
Did you comapered the time to transfering "raw data on UDP" and "JPEG on TCP".
I bet on TCP with compressed image.
Search this forum in another post i replyed to the same question.

Did you comapered the time to transfering "raw data on UDP" and "JPEG on TCP".
Can u pls tell me the frame obtained due to icamera_getframe will be in the jpeg format?
or u mean to say that the frame should be compressed to jpeg format and then transfer it to pc.
Thanks

Did you comapered the time to transfering "raw data on UDP" and "JPEG on TCP".
Can u pls tell me the frame obtained due to icamera_getframe will be in the jpeg format?
or u mean to say that the frame should be compressed to jpeg format and then transfer it to pc.
Thanks

Quote:Can u pls tell me the frame obtained due to icamera_getframe will be in the jpeg format?
It will be raw data.
Quote:or u mean to say that the frame should be compressed to jpeg format and then transfer it to pc.
Yes

Quote:Can u pls tell me the frame obtained due to icamera_getframe will be in the jpeg format?
It will be raw data.
Quote:or u mean to say that the frame should be compressed to jpeg format and then transfer it to pc.
Yes

Hi,

if(IBITMAP_QueryInterface(pBackUpBitmap, AEECLSID_DIB,(void**) &pIDIB)== SUCCESS){    MEMCPY(pMe->RawBuffer,pIDIB->pBmp,(bi.cx*bi.cy*2));}

1. With the above code, i'm getting application error when downloaded into the phone. I've declared RawBuffer as
byte* RawBuffer;
how to rectify this?
2.[HTML] IBITMAP_GetInfo(pFrame, &bi, sizeof(bi))[/HTML]
I'm getting bi.nDepth=0
How to get the bi.nDepth value?
Thanks,
Celia
Celia

Hi,

if(IBITMAP_QueryInterface(pBackUpBitmap, AEECLSID_DIB,(void**) &pIDIB)== SUCCESS){    MEMCPY(pMe->RawBuffer,pIDIB->pBmp,(bi.cx*bi.cy*2));}

1. With the above code, i'm getting application error when downloaded into the phone. I've declared RawBuffer as
byte* RawBuffer;
how to rectify this?
2.[HTML] IBITMAP_GetInfo(pFrame, &bi, sizeof(bi))[/HTML]
I'm getting bi.nDepth=0
How to get the bi.nDepth value?
Thanks,
Celia
Celia

i think device is not able to capture the image. May i know which device you are using.
Solution may be that put some delay before ICAMERA_GetFrame()

i think device is not able to capture the image. May i know which device you are using.
Solution may be that put some delay before ICAMERA_GetFrame()

 May i know which device you are using.
Solution may be that put some delay before ICAMERA_GetFrame()

The device is kx5.

i think device is not able to capture the image.

I'm able to see the frames on the display.
I'm sending the snippt

 May i know which device you are using.
Solution may be that put some delay before ICAMERA_GetFrame()

The device is kx5.

i think device is not able to capture the image.

I'm able to see the frames on the display.
I'm sending the snippt

Error is here
pme->RawBuffer=NULL;
You have not allocated the raw Buffer, how come it will copy to that location?? :confused:

Error is here
pme->RawBuffer=NULL;
You have not allocated the raw Buffer, how come it will copy to that location?? :confused:

hi
please help it is urgent to me.
i want to know how to convert rawbuffer to ibitmap.
i have converted ibitmap to raw data while sending from ISOCKET_write.
now i need to reconstruct raw data to ibitmap in ISOCKET_READ, and displat it.

hi
please help it is urgent to me.
i want to know how to convert rawbuffer to ibitmap.
i have converted ibitmap to raw data while sending from ISOCKET_write.
now i need to reconstruct raw data to ibitmap in ISOCKET_READ, and displat it.

just fill the IDBI->pBMp pointer with you raw data.

just fill the IDBI->pBMp pointer with you raw data.

hi,
thanks for your replay.
how to get IDBI->pBMp pointer with out pFrame.

hi,
thanks for your replay.
how to get IDBI->pBMp pointer with out pFrame.

This is how i get IDBI pointer with out pFrame.
IDISPLAY_CreateDIBitmap(pApp->a.m_pIDisplay, &pApp->pDib, 16, pApp->Width, pApp->Height);
IDISPLAY_GetDeviceBitmap(pApp->a.m_pIDisplay, &pApp->pbmDev);
IBITMAP_CreateCompatibleBitmap(pApp->pbmDev, &pApp->pbmDst,pApp->Width, pApp->Height);
IBITMAP_QueryInterface(pApp->pbmDst, AEECLSID_DIB, (void * *) &pApp->pDib);
Hope this code will help.

This is how i get IDBI pointer with out pFrame.
IDISPLAY_CreateDIBitmap(pApp->a.m_pIDisplay, &pApp->pDib, 16, pApp->Width, pApp->Height);
IDISPLAY_GetDeviceBitmap(pApp->a.m_pIDisplay, &pApp->pbmDev);
IBITMAP_CreateCompatibleBitmap(pApp->pbmDev, &pApp->pbmDst,pApp->Width, pApp->Height);
IBITMAP_QueryInterface(pApp->pbmDst, AEECLSID_DIB, (void * *) &pApp->pDib);
Hope this code will help.

Hi,
Can i get the code snippet for the usage of IMEDIAUTIL_EncodeJPEG
api for encoding the camera frames.
Thanks,
Celia

Hi,
Can i get the code snippet for the usage of IMEDIAUTIL_EncodeJPEG
api for encoding the camera frames.
Thanks,
Celia

hi Celia,
IMEDIAUTIL_EncodeJPEG may not be the best API to encode the image capture from camera.
I suggest you look in to ICAMERA_EncodeSnapshot().

hi Celia,
IMEDIAUTIL_EncodeJPEG may not be the best API to encode the image capture from camera.
I suggest you look in to ICAMERA_EncodeSnapshot().

hi,
my preview mode is working
but when i am using
IBITMAP_GetInfo(pFrame, &bi, sizeof(bi))
bi.cx and bi.cy are correct value
but bi.nDepth=0.
why is this please tell me.
:confused:

hi,
my preview mode is working
but when i am using
IBITMAP_GetInfo(pFrame, &bi, sizeof(bi))
bi.cx and bi.cy are correct value
but bi.nDepth=0.
why is this please tell me.
:confused:

Hello,
I can send raw data to SOCKET UDP but I can't receive anything.
ISOCKET_RecvFrom() returns -2.
How can I solve this problem?
Can You help me , please.
Thanks.
Bye.

Hello,
I can send raw data to SOCKET UDP but I can't receive anything.
ISOCKET_RecvFrom() returns -2.
How can I solve this problem?
Can You help me , please.
Thanks.
Bye.