Hi All, I have tried Camera Test function of 2440test.bin and it works properly. But the problem is I don't know how to get RGB value nor YCrCb value of each pixel. Is there anyone can help me? Thanks, Ito
Retrieving RGB value from CAM130
The following 2 sets of formulae are taken from information from Keith
Jack's excellent book "Video Demystified" (ISBN 1-878707-09-4).
RGB to YUV Conversion
Y = (0.257 * R) + (0.504 * G) + (0.098 * B) + 16
Cr = V = (0.439 * R) - (0.368 * G) - (0.071 * B) + 128
Cb = U = -(0.148 * R) - (0.291 * G) + (0.439 * B) + 128
YUV to RGB Conversion
B = 1.164(Y - 16) + 2.018(U - 128)
G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128)
R = 1.164(Y - 16) + 1.596(V - 128)
In both these cases, you have to clamp the output values to keep them in
the [0-255] range
taken from mjpg-streamer source:
z = 0;
while (cinfo.next_scanline < vd->height) {
int x;
unsigned char *ptr = line_buffer;
for (x = 0; x < vd->width; x++) {
int r, g, b;
int y, u, v;
if (!z)
y = yuyv[0] << 8;
else
y = yuyv[2] << 8;
u = yuyv[1] - 128;
v = yuyv[3] - 128;
r = (y + (359 * v)) >> 8;
g = (y - (88 * u) - (183 * v)) >> 8;
b = (y + (454 * u)) >> 8;
*(ptr++) = (r > 255) ? 255 : ((r < 0) ? 0 : r);
*(ptr++) = (g > 255) ? 255 : ((g < 0) ? 0 : g);
*(ptr++) = (b > 255) ? 255 : ((b < 0) ? 0 : b);
if (z++) {
z = 0;
yuyv += 4;
}
}
Hi Kailas, May be there is miscommunication. yeah, I know that formulas, but the problem is I don't know how to get RGB or YCrCb data from camera, or I can say that I don't know which register I have to access to get RGB data. Can you help me ? Regards, Ito
Hi Kailas, do you mean it takes from frame buffer ? That is for linux, but I want to use my mini2440 without OS. Regards Ito
oh yes. I did not notice that you have posted your question under "Non OS" section. I personally prefer busybox linux as it takes very less memory and I get comfort of using ready made utilities and drivers. Hope the attached file will help you to understand LCD I/O. This file is there in the CD/DVD came along with the board. regards, Kailas


