Image Processing

azzido
I want to develop an application that use image processing like Fingerprint
Recognition, Eye Detection/Recognition. I'm looking for a library to
process an image. I find OpenCV by Intel but I don't know how to port on my
mini2440 (ARM+linux).

Does anybody know a library for processing image on ARM + (linux/wince) ?

Vladimir Fonov
You can compile OpenCV for friendly arm if you configure OpenCV like this:

./confugure --host=arm-linux --disable-shared  # I disable shared libraries
to simplify deployment of binaries
make # builds everuthing

then you can run binaries on the friendly arm, but you have to make sure
that they don't require GUI to run.

For example I modified to facedetect.cpp to write the output to disk,
instead of displaying it in the window:

compiling:

arm-linux-g++ -O2 -I ../../include/opencv  facedetect_noui.cpp
-L../../src/.libs/ -lcv -lhighgui -lcxcore -lml -lcvaux -lrt -lpthread -ldl
-lz -lpng12 -ljpeg   -o facedetect

Running of FriendlyARM:

[root@FriendlyARM c]# ./facedetect lena.jpg --out=test.png
detection time = 39033.4 ms
Saving output to test.png


P.S. Here is another example:
http://www.computer-vision-software.com/blog/2009/03/arm-wrestling-with-...

Ito
Hello Vladimir,

Did you use OpenCV for Linux in your project ? If you don't mind, can you
explain step-by-step about that project?

Thank you,

Ito

Vladimir Fonov
Hello,

yes, I am running Linux on FriendlyARM and Linux (Ubuntu 9.10) on my
building host. I downloaded version 2.0 from
http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.0/ ,
unpacked it and configured it with the above settings.

Vladimir Fonov
Attachment: facedetect_noui.cpp (7.49 KB)
Hello,

just thought that you can try with this source code, to build OpenCV and
compile the sample see above.

Ito
Hello,

Thanks Vladimir, I will try it.

Sincerely

Ito

Ito
Hello Vladimir,

I have followed your instruction, and I got this error message :


ito@ito-desktop:~/Downloads$ arm-linux-g++ -o2 -I facedetect_noui.cpp
-L/home/igi/OpenCV-2.0.0/src/.libs -lcv -lhighgui -lcxcore -lml -lcvaux
-lrt -lpthread -ldl -lz -lpng12 -ljpeg -o facedetect
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/usr/lib/crt1.o:
In function `_start':
init.c:(.text+0x30): undefined reference to `main'
collect2: ld returned 1 exit status


What does it mean ?

Thank you,
Sincerely


Ito

Ito
Oh,

I'm sorry, my bad, I forgotto "include" the .h file.....
Now i have built it successfully

Thank's alot for you

Bravo Vladimir.....^^

Sincerely,


Ito

Gary N.G
Hello,

To Vladimir and Ito, I have followed your tutorial carefully and I can
build facedetect. But when i run it in my Qtopia friendlyARM, error was
occured.

ERROR : Could not load classifier cascade
Usage : facedetect [--cascade="<cascade-path>"]
[--nested-cascade[="nested-cascade-path"]]
[--scale[=<image scale>
[filename|camera_index]


What's wrong ?

Gary

Vladimir Fonov
Hello Gary,


he program searches for the training information , by default it is in
../../data/haarcascades/haarcascade_frontalface_alt.xml 
and
../../data/haarcascades/haarcascade_eye_tree_eyeglasses.xml 
relative to the directory where facedetect.cpp sample is.
I am exporting my whole OpenCV directory to mini2440 through NFS, so all
the files are found automatically.
On the other hand, if you are copying facedetect binary to mini2440 alone,
you will also have to copy above files. And specify them using command
line.

I.E. ./facedetect --cascade=haarcascade_frontalface_alt.xml
--nested-cascade=haarcascade_eye_tree_eyeglasses.xml  etc.
if you have copied them to the same directory as your facedetect binary.

Gary N.G
Hello Vladimir,

Thank you for your guidance, It works properly.

Gary

victorlog
Somebody help me please. 
I found error.
what's error?
Thank you

root@ultimate-laptop:~/Downloads/OpenCV-2.0.0/samples/c# arm-linux-g++ -o2
-I coding.cpp -L//root/Downloads/OpenCV-2.0.0/src/.libs -lcv -lcxcore
-lhighgui
/home/ultimate/Downloads/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/
armv4t/usr/lib/crt1.o:
In function `_start':
init.c:(.text+0x30): undefined reference to `main'
collect2: ld returned 1 exit status


and this my code.....


#include "cv.h"

#include "cxcore.h"

#include "highgui.h"

#include "stdio.h"



#define CamID 0

#define NameOri "Original Image"

#define NamePro "Process Image"



int main( int argc, char **argv )

{

  int i,j;

  int height,width,step,channel,depth;

  int stepr, channelr;

  uchar *data,*datar;

  i=j=0;



  CvCapture *CapImg = NULL;

  CapImg = cvCreateCameraCapture( CamID );



  if( CapImg == NULL )

  {

    puts("unable to load the frame");

    exit(0);

  }

  cvNamedWindow( NameOri );

  cvNamedWindow( NamePro );



  IplImage *ProOriImg = NULL;

  IplImage *ProNewImg = NULL;



  do

  {

    if( ProNewImg != NULL )

    {

      cvReleaseImage( &ProNewImg );

      ProNewImg = NULL;

    }

    ProOriImg = cvQueryFrame( CapImg );

    ProNewImg = cvCreateImage( cvSize( ProOriImg->width,ProOriImg->height
),ProOriImg->depth,ProOriImg->nChannels );

    cvSetZero( ProNewImg );



    height = ProOriImg->height;

    width = ProOriImg->width;

    step = ProOriImg->widthStep;

    channel = ProOriImg->nChannels;

    data = (uchar *)ProOriImg->imageData;



    stepr = ProNewImg->widthStep;

    channelr = ProNewImg->nChannels;

    datar = (uchar *)ProNewImg->imageData;





    for( i = 0; i < height; i++ )

    {

      for( j = 0; j < width; j++)

      {

        if(((data[i*step+j*channel+2]) > (30+data[i*step+j*channel]))

        && ((data[i*step+j*channel+2]) > (30+data[i*step+j*channel+1])))

        {

          datar[i*stepr+j*channelr+2] = 255;

        }

        else datar[i*stepr+j*channelr+2] = 0;

      }

    }



    cvShowImage( NameOri,ProOriImg );

    //cvShowImage( NamePro,ProNewImg );



  }while( cvWaitKey(1) == -1 );

  if( ProNewImg != NULL )

  {

    cvReleaseImage( &ProNewImg );

    ProNewImg = NULL;

  }



  cvDestroyWindow( NameOri );

  cvDestroyWindow( NamePro );

  cvReleaseCapture( &CapImg );

  return 0;

}

Vladimir Fonov
Hello,

it looks like you an extra -I parameter, ie replace
arm-linux-g++ -o2
-I coding.cpp -L//root/Downloads/OpenCV-2.0.0/src/.libs -lcv -lcxcore
-lhighgui

with
arm-linux-g++ -o2
 coding.cpp -L//root/Downloads/OpenCV-2.0.0/src/.libs -lcv -lcxcore
-lhighgui


On the second thought , It looks like this form doesn't like grater and
smaller signs in the body of the message, in my original text  I meant that
you have to specify location of OpenCV headers after -I

azzido
Hi again.

I tried to get a frame from cmos camera using cvCreateCameraCapture(0).
This method always return NULL that means no camera found. My CMOS camera
works great. Can somebody help me ?

Thanks
   azzido

azzido
I can't solve the problem.

I tried to get a frame via V4l

ioctl(videofd, VIDIOC_QUERYCAP, &cap)

and the camera can't be open.
Why can't get a frame using cvCreateCameraCapture ?

How can I get a frame from CMOS Camera ?

Many thanks.

Vladimir Fonov
Hello,

in short, standard driver for CAM130 (CMOS camera) is not V4L compliant.
For longer explanation see
http://www.friendlyarm.net/forum/topic/505?lang=en

Morten Kahr
Hi Vladimir !

I've ot a couple of questions. Sorry if they are to basic but I am
relatively new to Embeded Linux.

My goal is to run OpenCV on TI's OMAP3530 and I have a Gumstix and a
OMAP35evm board at hand.

I am trying to do this.
Using Ubuntu 9.04
Using CodeSourcerys toolchain
Exported :
export
CC=/home/mkn/workspace/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi
-gcc

export
CXX=/home/mkn/workspace/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueab
i-g++

1. Downloaded and extracted OpenCV-2.0.0 to
/home/mkn/workspace/OpenCV-2.0.0
2. Cross compiled OpenCV with ./confugure --host=arm-linux --disable-shared
3. make
4. Succes

Copied the /samples/c/edge.c and stripped it for GUI (see attached file)

Compiled it with:
arm-none-linux-gnueabi-gcc -o2 -I/home/mkn/OpenCV-2.0.0/include/opencv
edge.c -L/home/mkn/OpenCV-2.0.0/src/.libs -lcv -lhighgui -lcxcore -lml
-lcvaux -lrt -lpthread -ldl -lz -lpng12 -ljpeg -o edge

And now I am getting into trouble (due to my lack of knowledge). So these
are my questions.

A. When cross compiling OpenCV where is the binaries located (libs). Not
using any prefix argument.
As far as I can see in the configure script it is located in /usr/lib. Are
the x86 binaries overwritten now ?

B. I would like to be able to develop and test apps on my host and
afterwards cross compile and copy to my targets NFS.
Where should I put the binaries on the target ?

C. So what would be the correct command line for compiling for ARM with
directives to the .h files and cross compiled libs 

There might be other questions but understanding of the above might get me
a bit further.

Your comments and help is highly appreciated.
Thanks in advance.

Morten
2. Cross compiled

Morten Kahr
#include "cv.h"
#include "highgui.h"

int edge_thresh = 128;

IplImage *image = 0, *cedge = 0, *gray = 0, *edge = 0;

int main( int argc, char** argv )
{
    char* filename = argc == 2 ? argv[1] : (char*)"left04.jpg";

    if( (image = cvLoadImage( filename, 1)) == 0 )
        return -1;

    // Create the output image
    cedge = cvCreateImage(cvSize(image->width,image->height), IPL_DEPTH_8U,
3);

    // Convert to grayscale
    gray = cvCreateImage(cvSize(image->width,image->height), IPL_DEPTH_8U,
1);
    edge = cvCreateImage(cvSize(image->width,image->height), IPL_DEPTH_8U,
1);
    cvCvtColor(image, gray, CV_BGR2GRAY);

    cvReleaseImage(&image);
    cvReleaseImage(&gray);
    cvReleaseImage(&edge);

    return 0;
}

Vladimir Fonov
A. if you just configure OpenCV and then run make to build it , the
binaries are not installed anywhere (i.e they stay withing the build tree).
If you want to install, run "make install" and everything will be installed
in /usr/local by default. You can change this location during configuration
time with --prefix=..... parameter for ./configure or during installation
by specifying installation directory : make install DESTDIR=.....

B. I suggest that you setup the separate directories for compiling OpenCV
for your pc and another one for your board, i.e create
/home/mkn/workspace/pc and unpack and configure OpenCV there , and
also create /home/mkn/workspace/gumstix and unpack and cofigure OpenCV
there one more time. Then, for your program you can setup make file that
will use one directory with all the parameters to build code for PC and
another one for your board, i.e create /home/mkn/workspace/app and inside
create a Makefile with something like this:

HOSTCC=gcc
HOSTCXX=g++
BOARDCC=/home/mkn/workspace/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gn
ueabi-gcc
BOARDCXX=/home/mkn/workspace/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-g
nueabi-g++

HOSTFLAGS=-o2 -I/home/mkn/workspace/pc/OpenCV-2.0.0/include/opencv
-L/home/mkn/workspace/pc/OpenCV-2.0.0/src/.libs -lcv -lhighgui -lcxcore
-lml -lcvaux -lrt -lpthread -ldl -lz -lpng12 -ljpeg

BOARDFLAGS=-o2 -I/home/mkn/workspace/gumstix/OpenCV-2.0.0/include/opencv
 -L/home/mkn/workspace/pc/OpenCV-2.0.0/src/.libs -lcv -lhighgui -lcxcore
-lml -lcvaux -lrt -lpthread -ldl -lz -lpng12 -ljpeg


host: app.cpp
  $(HOSTCC) $(HOSTFLAGS) app.cpp -o host_app

gumstix: app.cpp
  $(BOARDCC) $(BOARDFLAGS) app.cpp -o gumstix_app


default: host gumstix


Then, to build your app for the host computer you will have to type make
host
and for your board: make gumstix 
Of course, it is just a quick&dirty example.
Next, to run the code on your board you can either copy it over using
ftp/ssh/sd card/ and run it there. Alternatively, you can export directory
with your files using NFS and mount it from the board and run binary
without copying. For example, when I do this kind of things I put all my
binaries to /opt/FriendlyARM , I export it using NFS:
/etc/exports contains:

/opt
10.0.2.5(rw,sync,no_subtree_check,all_squash,anonuid=1000,anongid=1000)

where 10.0.2.5 - IP address of the FriendlyARM board, and on the board I
mount it using following line in fstab:

10.0.2.1:/opt/FriendlyARM /mnt  nfs  noauto,nolock,wsize=512,rsize=512  0 0

then I can mount it manuall by typing mount /mnt in the console, and
execute binary files from /opt/FriendlyARM without copying them.

C. This seem to be correct example, doesn't it work for you?

Irinel
Hi Vladimir Fonov !

I cannot locate the V4L2 library (libv4l2) on my mini2440 (kernel version
2.6.29). I have a USB camera with Vimicro chip and it is recognized by
kernel. Also, I develop an application that get a capture from camera (640
x 480) using V4L2 and it works great. But when I tried to get a frame from
camera using OpenCV it fails.

  CvCapture *CapImg = NULL;

  CapImg = cvCreateCameraCapture( 0 );

CamImg is allways null. I think the reason is OpenCV can't locate V4L2
library. I'm alo looking for using CvCaptureCAM_V4L(index) because it's
written in V4L2.

Many thanks Vladimir Fonov

Vladimir Fonov
Hello Irinel,

"I cannot locate the V4L2 library (libv4l2) on my mini2440"

basic V4L is not a library, it is interface to the kernel, using standard
libc functions (open,close,read,ioctl,mmap) all you need is kernel headers
to describe constants and structures during compilation time. 

"But when I tried to get a frame from camera using OpenCV it fails." maybe
OpenCV doesn't support your type of camera? 
Frankly I am not using OpenCV myself so, I have very limited knowledge
about it. I suggest inserting some printf's with diagnostic messages into
src/highgui/cvcap_libv4l.cpp (that's where OpenCV's V4L functions are
located) or compiling OpenCV and your application with debugging support,
and using gdb+gdbserver to setup a couple breakpoints in cvcap_libv4l.cpp
and check what is going on.

Mousa
Hi to all
is here anyone to say me:can i run opencv under ce6.0?
thanks a lot

San
hello,

I am building a project on FriendlyArm in which i will be caputuring live
images and processing it onboard, is this possible on FriendlyArm as i
haven't tried it yet. 

If yes, pls help me out on this.

The project is Traffic Monitoring using Image Processing.

Regards

Tan
Hi all

I exactly did the steps as Vladimir has mentioned, but while running make,
the following error is coming.


/usr/bin/ld: /root/Downloads/OpenCV-2.0.0/src/.libs/libcxcore.a(sgetrf.o):
Relocations in generic ELF (EM: 40)
/root/Downloads/OpenCV-2.0.0/src/.libs/libcxcore.a: could not read symbols:
File in wrong format
collect2: ld returned 1 exit status
make[2]: *** [opencv-haartraining] Error 1
make[2]: Leaving directory `/root/Downloads/OpenCV-2.0.0/apps'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/Downloads/OpenCV-2.0.0'
make: *** [all] Error 2

Any help will be appreciated.

Thanks

Tan
here's the full compilation log--> http://pastebin.com/UL4QRPA9

Tan
Hi

I successfully cross-compiled opencv and got 4 directories generated:
include
bin
share
lib

As i am running qtopia 2.2 rootfs on my board, i copied contents of
the above 4 directories to those in the board fs (for eg. bin to /bin
of board) Is this ok? will it work this way or do I need to make the
rootfs again? Also how to test whether the opencv is working or not?

PS. I'm actually a newbie :) Thanks for your help.

Tan

Mosaic
I used the following link and installed OpenCV. 

http://www.linuxconfig.org/introduction-to-computer-vision-with-opencv-o...

g++ and gcc commands are readily compiling but not arm-linux-gcc. I
searched and found it is because of no link in the libraries.
I want to use arm-linux-gcc not arm-linux-g++.
Can someone please tell me a set of commands I need to execute to link the
libraries.

Astha Aggarwal
Hi,

I successfully cross compiled the OpenCV2.1.0 and got 4 directories :
include
bin
share
lib

I disabled the Python support and FFMPEG.
-- General configuration for opencv 2.1.0
=====================================
-- 
--     Built as dynamic libs?:    ON
--     Compiler:                  
--     C++ flags (Release):         -Wall -pthread -ffunction-sections  -O3
-DNDEBUG  -fomit-frame-pointer -DNDEBUG 
--     C++ flags (Debug):           -Wall -pthread -ffunction-sections  -g 
-O0 -DDEBUG -D_DEBUG 
--     Linker flags (Release):     
--     Linker flags (Debug):       
-- 
--   GUI: 
--     GTK+ 2.x:                  1
--     GThread:                   1
-- 
--   Image I/O: 
--     JPEG:                      build
--     PNG:                       build
--     TIFF:                      build
--     JPEG 2000:                 build
-- 
--   Video I/O: 
--     DC1394 1.x:                0
--     DC1394 2.x:                0
--     FFMPEG:                    0
--       codec:                   
--       format:                  
--       util:                    
--       swscale:                 
--       gentoo-style:            
--     GStreamer:                 0
--     UniCap:                    FALSE
--     PvAPI:                     
--     V4L/V4L2:                  /
--     Xine:                      FALSE
-- 
--   Interfaces: 
--     Old Python:                0
--     Python:                    OFF
--     Python interpreter:        /usr/bin/python2.6
--     Python numpy:              
--     Use IPP:                   NO
--     Use TBB:                   NO
--     Build Documentation        0
-- 
--     Install path:              /tmp/openCV
-- 
--     cvconfig.h is in:         
/home/astha/Desktop/OpenCV-2.1.0_arm/release
-- -----------------------------------------------------------------
-- 
-- Configuring done


Then i transfer cross compiled lib/ onto my board and run the sample
program. There I tried to get a frame from Microsoft and then T-Link
cameras using cvCreateCameraCapture(0).This method always return NULL that
means no camera found. Both the cameras are working fine. Can somebody help
me ? Its look like v4l is missing. But how to get that? and i didnt disable
the V4L at the time of cross compilation. Please help...

Astha Aggarwal
Hi,

I am able to cross compiled the OpenCV2.1.0 successfully and now its
working fine with microsoft camera but its not working with T-link webcam
and its giving error : "HIGHGUI ERROR: V4L2: Pixel format of incoming image
is unsupported by OpenCV
Unable to stop the stream.: Bad file descriptor "

What can be reason and how to fix it?

amir
hi Vladimir!
First of all thank u!
when I try to configure:
./configure --host=arm-linux --disable-shared 
bash: ./configure: No such file or directory
would you tell me whats wrong!
my pc os is ubuntu 10.10 and opencv 2.2 is now installed on ubuntu!
on my pc every thing is fine and i can run samples.
thanks again!

mgdaubo
Many thanks Vladimir, your shared are great.

I use OpenCV-2.0.0 as Vladimir share link, cross-compile = arm-linux-4.3.2.
; Ubuntu 10.10
I create 2 directory: </home/mgdaubo/micro2440/PC> for host PC, and
</home/mgdaubo/micro2440/targetboard> for my micro2440 board. copy
OpenCV-2.0.0 source directory to both PC and targetboard directory.

#########Then I compile opencv like this:
*** for host PC:
follow:
http://www.linuxconfig.org/introduction-to-computer-vision-with-opencv-o...

*** for target board:
export PATH=/home/mgdaubo/Compiler/arm-linux-4.3.2/bin   #my path to
compiler
cd /home/mgdaubo/micro2440/targetboard/OpenCV-2.0.0
./configure --host=arm-linux --disable-shared --with-gtk=no
--prefix=/home/mgdaubo/micro2440/targetboard
make install

There is no error. So, in targetboard directory, 4 new directorys appeared:
bin, include, lib, share. And the source code directory "OpenCV-2.0.0" i
have copied before.

######## Now compile application
*** Makefile is very similar to Vladimir's:
HOSTCC=gcc
HOSTCXX=g++
BOARDCC=/home/mgdaubo/Compiler/arm-linux-4.3.2/bin/arm-linux-gcc
BOARDCXX=/home/mgdaubo/Compiler/arm-linux-4.3.2/bin/arm-linux-g++

HOSTFLAGS=-o2 -I/home/mgdaubo/micro2440/PC/include/opencv
-L/home/mgdaubo/micro2440/OpenCV/PC/lib -lcv -lhighgui -lcxcore -lml
-lcvaux -lrt -lpthread -ldl -lz -lpng12 -ljpeg

BOARDFLAGS=-o2 -I/home/mgdaubo/micro2440/targetboard/include/opencv
-L/home/mgdaubo/micro2440/targetboard/lib -lcv -lhighgui -lcxcore -lml
-lcvaux -lrt -lpthread -ldl

host: app.cpp
  $(HOSTCC) $(HOSTFLAGS) app.cpp -o host_app

tget: app.cpp
  $(BOARDCC) $(BOARDFLAGS) app.cpp -o tget_app


default: host tget


*** app.cpp is very simple:
#include "highgui.h"

int main( int argc, char** argv ) {
    IplImage* img = cvLoadImage( argv[1]);

    cvSaveImage( argv[2] , img);
    cvReleaseImage( &img );
return 0;
}

######## the result:
host_app can be compiled and work well in host PC.
But "make tget" give error:
   /tmp/cc1pd1lB.o: In function `main':
   app.cpp:(.text+0x28): undefined reference to `cvLoadImage'
   app.cpp:(.text+0x50): undefined reference to `cvSaveImage'
   app.cpp:(.text+0x5c): undefined reference to `cvReleaseImage'
   collect2: ld returned 1 exit status
   make: *** [tget] Error 1

It's seem that the linker cannot find the "include" directory. I can't
understand.
I try to do something:
  - export
PKG_CONFIG_PATH=/home/mgdaubo/micro2440/targetboard/lib/pkgconfig
  - specify -I to source directory:
-I/home/mgdaubo/micro2440/targetboard/OpenCV-2.0.0/include/opencv
  - specify -L to source directory:
-L/home/mgdaubo/micro2440/targetboard/OpenCV-2.0.0/src/.libs

Still get same error.
Any idea, please help me out :((

mgdaubo
Hi,

I searched and take look at many site on internet, but still get that
error.

However, use the pre-compiled OpenCV files on this site, I can compile my
app and run properly :D
http://wiki.openarmlab.org/index.php?title=Opencv_on_mini2440

Leandro
Hello,
Does anybody know how to cross compile the OpenCV with ffmpeg?

I'm trying:

./configure --host=arm-linux CPPFLAGS=-I/usr/arm/local/include/
LDFLAGS=-L/usr/arm/local/lib --without-python --with-ffmpeg
--without-quicktime CXXFLAGS=-D__STDC_CONSTANT_MACROS  

But, at the end:

Video I/O ---------------------
    Use QuickTime / Mac OS X: no
    Use xine:                 no
    Use gstreamer:            no
    Use ffmpeg:               no       <----------- I'm getting no here
    Use dc1394 & raw1394:     no
    Use dc1394_v2 & raw1394:  no
    Use v4l:                  yes
    Use v4l2:                 yes
    Use unicap:               no

Maksim
Hi,guys.I've configured(./confugure --host=arm-linux --disable-shared)
OpenCV  for mini 2440  and it past make well,but while compilation I cannot
get rid from error :

/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm
-none-linux-gnueabi/bin/ld:
cannot find -lml
collect2: ld returned 1 exit status

I compile as follow:

arm-linux-gcc `pkg-config --cflags opencv` -c video_server_arm.c -o
video_server_arm.o
 arm-linux-gcc video_server_arm.o -o video_server_arm `pkg-config --libs
opencv` -I /usr/include/opencv -lpthread


 /usr/include/opencv---here cv.h and highgui.h reside

egm
hi
I could compile my opencv program on my host successfully and I could make
a binary file on my host (Ubuntu 9.10).
now I want to port it on my board. I copied opencv directories and my
binary files to root via usb diss(UDisk) but it doesn't work.
where should I copy my /bin /lib /include /share folders in root ?
in /opt ? where ?
thank you

egm
no body can help ? :(

davef
Well . . . first did you cross-compile opencv rather than compile it?

"port it on my board", sounds like you haven't cross-compiled it.  Or, do
you mean place it on my board?

On the host you have checked that you actually have generated ARM binaries
for armv4t? <readelf -A <filename>

The files in bin normally just get placed in /bin on the target.  Likewise,
files in lib go in /lib on the target.

For a the few sources that I have cross-compiled you ignore include and
share files. 

Also, you need to be more explicit about "but it doesn't work".  Include
your error messages

egm
thank you for replying ...

you are right. I should say I cross compile it and I want to place it on my
board.
I copied 4 folders to root and when I run the program this error appears :
/lib/libcv.so.4 : file too short 
what does it mean ?

I just followed :
http://wiki.openarmlab.org/index.php?title=Opencv_on_mini2440
http://apollo.upc.es/humanoide/trac/wiki/OpenCv

Would you explain more ?
"On the host you have checked that you actually have generated ARM binaries
for armv4t? <readelf -A <filename>"

egm
Ah...
I should say I have no ld.co.conf file in /etc and I copied my /bin
directory to /bin on ARM and also /lib on /lib and ...

egm
HELP please ... !!

egm
finally I could solve it !
I made soft links again : ln -sb 
And now I can run my binary file , but now I get this error : 
VIDIOC_Streamon : no space left on device.

What should I do ? how I can reduce my process volume ?
 :(

egm
Error "No space left" indicates problem with USB bandwidth? 
How can I solve it?
I have two USB camera 640x480 connected to board via hub.

whitebank
Hi there. Please help me with cross-compiling OpenCV for mini2440.
I did the steps as Vladimir said but it has some errors after "make"
command. Somebody knows this problem please help me, thanksss.

$ tar -jxvf OpenCV-2.0.0.tar.bz2
$ cd OpenCV-2.0.0
$ make

----------------error of "make" command---------------
/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm
-none-linux-gnueabi/bin/ld:
cannot find -lgtk-x11-2.0
collect2: ld returned 1 exit status
make[2]: *** [opencv-haartraining] Error 1
make[2]: Leaving directory `/usr/local/OpenCV2440/OpenCV-2.0.0/apps'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/OpenCV2440/OpenCV-2.0.0'
make: *** [all] Error 2

whitebank
oh, sorry. My cross-compile is:

$ tar -jxvf OpenCV-2.0.0.tar.bz2
$ cd OpenCV-2.0.0
$ ./configure --host=arm-linux --disable-shared
$ make

Fred
Hi,

Does one of you have a feedback ont the possibility to to live cam blob
tracking sing 2440 and openCV at30 fps mini  for 240*240 video size ?

Thanks

Fred

Maksim
Hi,Guys!

While "make" I get some error

/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm
-none-linux-gnueabi/bin/ld:
cannot find -lgtk-x11-2.0

May be the problem in my toolchain?

Maksim
Pleas,suggest any reference to handle the problem!

ddzado
Same Problem... and I thought I had the right ARM compiled version of GTK


/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm

-none-linux-gnueabi/bin/ld:
cannot find -lgtk-x11-2.0

help if you can!

Tarin
Same error here. Using Ubuntu 10.04, ARM-Linux GCC 4.3.2 and OpenCV 2.0.0

Did anybody find the solution?

punith
one possible solution to remove the "cannot find -lgtk-x11-2.0" error is,
check whether you installed the gtk libs on the pc or not.

you can check this one in ubuntu from system package manager.

if they are not installed you can install them manually from this package
manager itself..

i hope this will solve your problem..

punith
Hi all,
i got a problem

i am able to run opencv in mini2440
but the problem is not all the functions like cvWaitKey(),
cvCaptureFromCAM() etc.

what could be the reason ...??

i am using the following specifications ...

on host machine <<<< ------
ubuntu 10.04
opencv2.1.0
cmake 2.8.0
gcc 4.4.3

on target machine <<<< -----
mini2440
vivi bootloader 
kernel 2.6.32
qutopia 2.2.0
uvc compatible webcam

i also checked with microsoft webcam too ... but no use.

did any one have the solution/suggestion ...??

prad
Hi,
 i need to convert jpeg image to bmp image using Linux commands on ARM..
but i should not convert it on the host.. Input should is given to ARM and
conversion to be seen on screen..
Please guide me..

ocren
hi, everyone !!!
I have developing a project for robot trackline, use Micro2440 kit. I was
tried to cross compiler Opencv 2.0 for arm, follow intrustion, but not
sucessed. It take to me many time to cross compiler. I was tired.. Anyone
for me the idea.. or the sloved, or can shared the library OpenCV 2.0 has
cross compiler for Micro2440 ... Thanks you, so much.
PS: My english is so bad. Thus, Please everyone inogre, thanks, so much.

ocren
hi, I have got the source code OpenCV 2.0 has cross compiler there. It is
actived good in Micro2440.
Link here : http://wiki.embeddednirvana.org/Opencv_on_mini2440
Thanks you everyone.

khur
i have been trying to compile my simple hello world program, with opencv
header on it, but the more i tried, it got the following error. always like
those error displayed.

//-------------------------------------------------------------------
edubuntu@edubuntu-Satellite:~$ arm-linux-gcc -I/usr/include/opencv
-L/usr/local/lib -lml -lcvaux -lhighgui -lcv -lcxcore test.c
In file included from /usr/include/opencv/cxcore.h:70,
                 from /usr/include/opencv/cv.h:58,
                 from test.c:1:
/usr/include/opencv/cxtypes.h:155: warning: redefinition of `ushort'
/usr/local/arm/3.3.2/include/sys/types.h:152: warning: `ushort' previously
declared here
/usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld:
skipping incompatible /usr/local/lib/libml.so when searching for -lml
/usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld:
cannot find -lml
collect2: ld returned 1 exit status
edubuntu@edubuntu-Satellite:~$
//----------------------------------------------------------------------

i have also check this:
edubuntu@edubuntu-Satellite:~$ pkg-config --cflags opencv
-I/usr/local/include/opencv

and this:
edubuntu@edubuntu-Satellite:~$ pkg-config --libs opencv
-L/usr/local/lib -lcxcore -lcv -lhighgui -lcvaux -lml

and this:
edubuntu@edubuntu-Satellite:~$ arm-linux-gcc -v
Reading specs from /usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/specs
Configured with: ../gcc-3.3.2/configure --target=arm-linux
--with-cpu=strongarm1100 --prefix=/usr/local/arm/3.3.2 i686-pc-linux-gnu
--with-headers=/work/kernel.h3900/include --enable-threads=pthreads
--enable-shared --enable-static --enable-languages=c,c++
Thread model: posix
gcc version 3.3.2

what am i missing ?
what should i do now?...please help me out....

davef
I'd look into:

/usr/include/opencv/cxtypes.h and
/usr/local/arm/3.3.2/include/sys/types.h

and see if ushort is defined in them both. 

Just a guess!

You sure that is 3.3.2 and not 4.3.2?

khur
hi devef, thanks for your reply,

the warning is not the main problem i think.but the error said that they
can not find my opencv library.....so the warning is ok....but how could i
solve this error....so the arm-linux can find the opencv library.
i ve downgraded my gcc version from the latest into 3.3.2 version according
to some forum advice.but nothing change...i still unable to compile my
program...

anyone has idea to solve that...?

running on ubuntu 10.10, with the latest update
intel dual core 2.2 GHz

huunhan
hi all,

I got a problem when cross-compile follow Vladimir Fonov tutorial. 
This error:

kakaka@kakaka-M52L-S3:~/Desktop/nhanVD$ arm-linux-gnueabi-g++-4.4 -o2 -I
/home/kakaka/Desktop/nhanVD/OpenCV-2.0.0/include/opencv facedetect_noui.cpp
-L /home/kakaka/Desktop/nhanVD/OpenCV-2.0.0/src/.libs -lcv -lhighgui
-lcxcore -lml -lcvaux -lrt -lpthread -ldl -lz -lpng12 -ljpeg -o facedetect

/usr/lib/gcc/arm-linux-gnueabi/4.4.5/../../../../arm-linux-gnueabi/bin/ld:
cannot find -lz
/usr/lib/gcc/arm-linux-gnueabi/4.4.5/../../../../arm-linux-gnueabi/bin/ld:
cannot find -lpng12
/usr/lib/gcc/arm-linux-gnueabi/4.4.5/../../../../arm-linux-gnueabi/bin/ld:
cannot find -ljpeg
collect2: ld returned 1 exit status

Vladimir Fonov or someone tell me why I got this problem. 

Thank you !

punith
Hi huunhan,

i think the reason behind your errors is,
your cross compiler is not linking with dynamic libs.

This linking depends not only on the cross compiler but also on the host
machine behavior.

so once cross check whether these jpeg, png libs are installed in your host
machine or not.

If you are using ubuntu as your host machine, you can check this one in the
system package manager.

By the by, which tool you are using for the cross-compilation...??

arokia
hai frends,plse help me am very new to this mini2440 .am using linux in
mini2440 kit and am using ubuntu in host development pc.

Nw my target is to compile hello world program in host development pc and
to transfer the binary output in mini2440 kit.

and am able to compile the code in host pc but i dnt knw how to transfer
binary file and to see the results in mini2440

anothr question when i compile the program in development pc in linux
ubuntu."a.out" file is generating.wthr  is it binaryfile.

In mini 2440 which flavour of linux were using ?


pls pls pls help me

Selman
Hello,

Well i know this place may not be the best place to this question but i
think that many of you know how to compile and output requred dll files.
Therefore i decided to ask my question in here. &#304; do not know linux
and i have a wave cellphone using bada. &#304; need binaries of opencv
compatible with arm processor. As bada is based on linux i believe that
linx version can be helpfull for me. Although i tried many times i got many
exhaustive errors. So i was tired. 

&#304; am using windows 7 and i have bada sdk. Could u please send me
opencv 2.2 or 2.3 binary files to my mail aselmanb@yahoo.com . Me and my
friends need it but we could not resolve problems. &#304;f one can help me
i will be appreciate.

Thanks to everyone.

sherazam
Hi, 

I came across a nice image processing control. I am sure it will enhance
your knowledge about image processing and manipulation. 
Aspose.Imaging for .NET is an <a
href="http://www.aspose.com/categories/.net-components/aspose.imaging-for-.net...
processing & manipulation component</strong></a>  that allows developers to
create, edit, draw or convert images in their .NET  application. It allows
developers to convert image files to PSD, BMP, JPEG, PNG,  TIFF and GIF
formats. Moreover a set of pens, brushes and fonts can be used to  draw
images or add new elements & text to existing images. Aspose.Imaging  for
.NET works well with both web & windows applications. Moreover, it adds 
the support for Silverlight platform.


Many Thanks

lgm42
Hello, and thank you for these informations.
I got a build error when i execute the command arm-linux-g++ :

Command :
doctorwho@ubuntu:/opt/mini2440/OpenCV-2.0.0/samples/c$ arm-linux-g++ -O2 -I
../../output/include/opencv facedetect_noui.cpp -L../../output/lib/ -lcv
-lhighgui -lcxcore -lml -lcvaux -lrt -lpthread -ldl -lz -lpng12 -ljpeg -o
facedetect

Answer :
../../output/lib//libhighgui.a(lib_highgui_la-loadsave.o): In function
`cv::imdecode_(cv::Mat const&, int, int, cv::Mat*)’:
loadsave.cpp:(.text+0xcd8): warning: the use of `tmpnam’ is dangerous,
better use `mkstemp’
../../output/lib//libcv.a(lib_cv_la-cvcascadedetect.o): In function
`_ZN2cv17CascadeClassifier16detectMultiScaleERKNS_3MatERSt6vectorINS_5Rect_IiEES
aIS6_EEdiiNS_5Size_IiEE.omp_fn.0&#8242;:
cvcascadedetect.cpp:(.text+0x4f98): undefined reference to
`GOMP_loop_dynamic_start’
….
….
Have you an idea ?
Thank you

vivek
hai i am vivek i have successfuly installed opencv 2.3 on my ubuntu 11.10
now when i try to cross compile a simple program to run an mini2440 i get
thes error


arm-linux-gcc -I/home/vivek/opencv_for_mini2440/project_files main.c -L
/usr/lib -lopencv_core -o main

error: opencv/cv.h: No such file or directory


Can anyone please help me.

anaysonawane
Hi thanx for sharing such a great tutorial.I cross compiled opencv 2.1.0
successfully.Now I wants to cross compile cvBlob library,I followe the same
procedure as opencv cross compilation but I am getting some error.Could you
  please help me solve this.Thanks in advance....!!!

pavanbobba
Hi....
 I already build kernel on mini2440.now i want to interface USB cam and
want to see captured image on mini2440 screen.Please tell me different ways
to achieve this.
    Anyone please help me.....

ksundeep
Hi Pavan,

May i know ur exact idea of implementation, to only capture the image over
USB Cam u can find Qtopia app already there...if you want to to any image
processing then has to do lot of work...is it for project or any hobby
purpose based on it can suggest u