How to use CMOS camera using Qt?

Marc Goldmann
Hi,

I just bought a mini 2440 board with the CMOS camera (CAM130).
I am not <yet> very experienced in this area...

My question: how to display camera pictures in a Qt application/window? 
Is there any example code?
The board comes with preinstalled Qt demo applications, but I can't find
the sources. Are they really close source - why?
Is there anybody reading this board who is authorized to publish these
sources?

Thanks for your help!
/Marc

Vladimir Fonov
Hello,


the CMOS camera interface is very simple. You just have to open /dev/camera
and read buffer of the size 655360 bytes ( 640x512x2); each time you read
from the device camera will capture a new frame. Information is stored in
RGB565 format. So every pixel correspond to two bytes, there are 5 bits for
red channel, 6 bits for green and 5 bits for blue. 

There is a sample in
http://www.friendlyarm.net/dl.php?file=linux-examples.tgz but without QT

Kardic
Hello Vladimir,

I think that is for CMUCam camera like OV7620, but how to access USB Camera
like Webcam ?

Thanks,

Kardic

Vladimir Fonov
Hello,

if your camera is supported (i.e there is linux driver for it), then you
can use standard video4linux approach, here is an example:
http://v4l2spec.bytesex.org/v4l2spec/capture.c again, without QT. 


There are some QT programs which are doing V4L capture, for example this
one: http://kapture.berlios.de/ , maybe it would be possible to compile it
for mini2440

themadmax
Use emdebian : it's lite debian system and work very well
last step are list there :
http://code.google.com/p/mini2440/wiki/Emdebian
For information uboot it's not nececerly, I can do it with vivi.

Edwar
hello Mr. Vladimir.
i have test the camera cam130 by use hyperterminal. i just type camtest and
it works. can i capture the image by using console in hyperterminal?

thanks alot

TungPham
Just use Qimage to load data from webcam
modify main function in camtest.cpp like this.
try {
  //TFrameBuffer FrameBuffer;
  TVideo Video("/dev/camera",640,480,16);
QImage q1 ;
        for (;;) {
          Video.FetchPicture();
    //FrameBuffer.DrawRect(Video);
 q1 = QImage(Video.Addr,Video.Width,Video.Height,QImage::Format_RGB16);
        //do what ever you want here
                }
        } catch (TError bitand e) {
    e.Output();
    return 1;
        }

............

very simple :)