mini2440 + USB Webcam + OpenCV

Vladimir Malyk
Buildrooted rootfs with OpenCV 2.1 and libv4l.

/sys/dev/char/81:0 appears when plug in webcam

then:

mknod /dev/video0 c 81 0
chmod 666 /dev/video0

I've got a Qt example for webcam->QImage. Works fine in ubuntu 10.10

But error for mini2440:

#./QtOpenCV -qws
mmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
Unable to stop the stream.: Bad file descriptor

munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument

libv4l1: error allocating v4l1 buffer: Cannot allocate memory
HIGHGUI ERROR: V4L: Mapping Memmory from video source error: Invalid
argument
HIGHGUI ERROR: V4L: Initial Capture Error: Unable to load initial memory
buffers.
./QtOpenCV: ../../webcam/QtOpenCV/main.cpp: 15: int main(int, char**):
Assertion `image' failed.
Aborted

In main.cpp:
14: CvCapture * camera = cvCreateCameraCapture(-1);
15: assert(camera);

ps. Buildroot from git://git.buildroot.net/buildroot
opencv.mk made myself with OPENCV_CONF_OPT = -DCMAKE_BUILD_TYPE=RELEASE
-DBUILD_NEW_PYTHON_SUPPORT=OFF -DWITH_3RDPARTY=OFF  -DWITH_FFMPEG=OFF
-DWITH_JPEG=ON -DWITH_PNG=ON -DWITH_TIFF=OFF -DWITH_JPEG_2000=OFF
-DWITH_JASPER=OFF -DWITH_HIGHGUI=ON -DWITH_GTK=OFF -DWITH_QT=ON
-DWITH_V4L=ON -DWITH_GPU=OFF -DBUILD_SHARED_LIBS=ON
-CMAKE_SYSTEM_NAME=Linux

Vladimir Malyk
https://code.ros.org/trac/opencv/ticket/141

In line 782 in cvcap_libv4l.cpp there is a mmap that causes a "invalid
argument" error on my machine (gentoo linux x86). Changing this mmap to
"v4l2_mmap" fixed that problem.

looks like this bug is in my buildrooted 
http://garr.dl.sourceforge.net/project/opencvlibrary/opencv-unix/2.1/Ope...

should use OpenCV-2.1.0.tar.bz2 instead

Vladimir Malyk
OpenCV-2.2.0.tar.bz2 , fixed

blue_is_atm
Hello , Vladimir Malyk ,I'm doing the same job right now , but i'm a newbie
in this field ,do u have any toutials in porting opencv to mini2440?
Thanks in advance.

Vladimir Malyk
> do u have any toutials in porting opencv to mini2440?

i'm going mad of this

OpenCV from trunc:

# ./QtOpenCV -qws
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
libv4l2: error allocating conversion buffer
mmap: Cannot allocate memory
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
Unable to stop the stream.: Bad file descriptor
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
libv4l1: error allocating v4l1 buffer: Cannot allocate memory
HIGHGUI ERROR: V4L: Mapping Memmory from video source error: Invalid
argument
HIGHGUI ERROR: V4L: Initial Capture Error: Unable to load initial memory
buffers.
./QtOpenCV: ../../webcam/QtOpenCV/main.cpp: 15: int main(int, char**):
Assertion `image' failed.
Aborted

Vladimir Malyk
SOLVED!

thx http://pramodpoudel.blogspot.com/2010_06_01_archive.html

need mem=128M for bootargs in uboot like:

setenv bootcmd mmcinit \; ext2load mmc 0:2 0x31000000 uImage_T35_positron
\; bootm

setenv bootargs console=ttySAC0,115200 root=/dev/nfs
nfsroot=192.168.0.12:/home/malyk/Workspace/RZB-small/nfs/fs rw
ip=192.168.0.252 mini2440=2tb rootwait init=/linuxrc mem=128M

saveenv

Avinash
Download new kernel from friendlyarm site - with date 2011 it has built in
support for usb webcams. Theres a fa app for wecam too with new qtopia
4.6.3

Tarin
Hey Avinash,

I couldn't see any kernel on the FriendlyARM downloads site with date 2011.
I will be really grateful if you provide its link. 
Thanks.

huunhan
hi Vladimir Malyk,

I followed this topic to configure OpenCV for arm but I can not finish it.
http://www.friendlyarm.net/forum/topic/306

Could you make a tutorial to do this? When configuring it, I see its
checking result for lz, jpeg, png are NO. 

What's wrong with that errors?

plz, help me

vivek
hai when i try to run the opencv file on mini244o i get this error
#armtest
i get 
#armtest:error while loading shared libraries:libcv.so.4:cannot open shared
object file:No such file or directory.
can anyone help.

Julian Goldsmith
vivek, try running ldconfig.  That message means that the dynamic linker
can't find the OpenCV library, possibly because it isn't in its cache. 
Also check to see that the OpenCV library is in your LD_LIBRARY_PATH.

vivek
@ Julian, thanks for ur reply,
now i have added the path then iget this error like
libcvso.4file too short

Sampa
Hi guys.
I'd like to ask just one question. Why to spend precious time and
processing resources by acquiring image from an USB webcam if the board
provides a 20 pin CMOS image sensor interface? CSI takes just 2 to 4% of
the processing time.