1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
void convertToArray(void) {
SelectObject(hdcMem, curFrame);
for (int x = 0; x < 640; x+=traq) {
for (int y = 0; y < 480; y+=traq) {
cur[x][y] = GetPixel(hdcMem,x,y);
}
}
int temp = cur[10][10].r;
SelectObject(hdcMem, lasFrame);
for (int x = 0; x < 640; x+=traq) {
for (int y = 0; y < 480; y+=traq) {
las[x][y] = GetPixel(hdcMem,x,y);
}
}
SelectObject(hdcMem, bakFrame);
for (int x = traq; x < 640; x+=traq) {
for (int y = traq; y < 480; y+=traq) {
DWORD Color;
DWORD curColor = cur[x][y];
DWORD lasColor = las[x][y];
int temp1 = curColor;
int val1 = (GetRValue(curColor)+GetGValue(curColor)+GetBValue(curColor))/3;
int val2 = (GetRValue(lasColor)+GetGValue(lasColor)+GetBValue(lasColor))/3;
if (val1 > val2-20 & val1 < val2+20) {
Color = RGB(0,255,0);
} else {
Color = RGB(255,0,0);
}
SetPixel(hdcMem,x,y,Color);
}
}
}
|