|
-
May 11th, 2006, 06:53 AM
#1
Webcam Image Manipulation
Greetings.
I have modified the code from the Simultaneous Previewing & Video Capture using DirectShow written by Sivasagar K.R in www.codeguru.com (see below). When I run it, it uses the *ptr pointer to render the pixels on screen, but I want to analyse the pixels for each frame, rendering the analysed pixels.
In essence, I want to save the pixels (as I do in the array CurImaArr) and then do some analysis on them, maybe change some values, and then render them. Any ideas on how to do so?
Your help would be very much appreciated.
bool CVMR_Capture::Convert24Image(BYTE *p32Img, BYTE *p24Img,DWORD dwSize32)
{
if(p32Img != NULL && p24Img != NULL && dwSize32>0)
{
DWORD dwSize24;
dwSize24=(dwSize32 * 3)/4;
BYTE *pTemp,*ptr;
//pTemp=p32Img + sizeof(BITMAPINFOHEADER); ;
pTemp=p32Img;
ptr=p24Img + dwSize24-1 ;
int ival = 0;
int count = 0;
int witth = 1;
int hite = 0;
int hites = 120;
int greens = 0;
for (DWORD index = 0; index < dwSize32/4 ; index++)
{
unsigned char r = *(pTemp++);
unsigned char g = *(pTemp++);
unsigned char b = *(pTemp++);
(pTemp++);//skip alpha
if ((witth <= 320) && (hite < 240))
{
CurImaArr [witth-1][hite] = g;
}
else
{
return false;
}
if (g > 150)
{
greens++;
}
*(ptr--)= 0; //blue
*(ptr--)= CurImaArr [witth-1][hite]; //g; //green
*(ptr--)= 0; //yellow
witth++;
if (witth >= 320)
{
witth = 1;
hite++;
}
}
}
else
{
return false;
}
return true;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|