Missing Content "Cross Compiling Opencv2.2 for I.MX53 QSB"

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Missing Content "Cross Compiling Opencv2.2 for I.MX53 QSB"

3,591 Views
YiayitKarabulut
Contributor I

Dear All,

       I am searching "Cross Compiling Opencv2.2 for I.MXQSB2.2" content but i cant find it. It was written by eric gregori and was mentioned in FTF11_CON_F0321.pdf . Is there anyway how i can find it? 

Many Thanks in advance,

Yigit Karabulut

0 Kudos
Reply
9 Replies

2,160 Views
FranciscoCarril
Contributor V

Follow the Guide posted by Curtis and the patches as well, then it will probably fail close at 58% due to some code error:

Building CXX object modules/ml/CMakeFiles/opencv_ml.dir/src/gbt.o

/home/windows/Downloads/OpenCV-2.2.0/modules/ml/src/gbt.cpp: In member function 'virtual void CvGBTrees::find_gradient(int)':

/home/windows/Downloads/OpenCV-2.2.0/modules/ml/src/gbt.cpp:474: error: 'expl' was not declared in this scope

make[2]: *** [modules/ml/CMakeFiles/opencv_ml.dir/src/gbt.o] Error 1

make[1]: *** [modules/ml/CMakeFiles/opencv_ml.dir/all] Error 2

make: *** [all] Error 2

windows@ubuntu:~/Downloads/OpenCV-2.2.0$


This can be fixed with the following modification:


> Change line 14 ofOpenCV-2.2.0/modules/ml/src/gbt.cppfrom "Android" to "1"

- before -

#if Android
#define expl(x) exp(x)
#endif

- after -

#if 1
#define expl(x) exp(x)
#endif

With this Change it should work for 100%

Good luck!!

Francisco

0 Kudos
Reply

2,160 Views
hoanganhngo
Contributor III

Hi Francisco,can you attach patch 1. I found a file name's "opencv-2.2-arm-imx53-sift-issue.patch" in 314-opencv_22_ltib.zip about.Is this patch1??, which is use to build a version of highgui without window support.:D.

0 Kudos
Reply

2,160 Views
FranciscoCarril
Contributor V

Yes, inside the zip file you have patch #1   the other patch is the one i sent you in the other post.

0 Kudos
Reply

2,160 Views
GopiNagaBharath
Contributor IV

Hi Francisco,

I am also trying to build the OpenCV2.2 for i.MX53 QSB Platform.

I was able to successfully build till 75%, then i am getting the errors as mentioned below.

I have followed the instructions provided by as mentioned in the above post.

Any idea what I might be missing here??

------------------------------------------------------------------------------------------------------------

[ 75%] Built target opencv_haartraining_engine

Linking CXX executable ../../bin/opencv_createsamples

/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.4.4/../../../../arm-fsl-linux-gnueabi/bin/ld: warning: libjpeg.so.62, needed by ../../lib/libopencv_highgui.so.2.2.0, not found (try using -rpath or -rpath-link)

/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.4.4/../../../../arm-fsl-linux-gnueabi/bin/ld: warning: libpng.so.3, needed by ../../lib/libopencv_highgui.so.2.2.0, not found (try using -rpath or -rpath-link)

/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.4.4/../../../../arm-fsl-linux-gnueabi/bin/ld: warning: libz.so.1, needed by ../../lib/libopencv_highgui.so.2.2.0, not found (try using -rpath or -rpath-link)

/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.4.4/../../../../arm-fsl-linux-gnueabi/bin/ld: warning: libtiff.so.3, needed by ../../lib/libopencv_highgui.so.2.2.0, not found (try using -rpath or -rpath-link)

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_create_read_struct'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_set_compression_mem_level'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `jpeg_write_scanlines'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `jpeg_stdio_src'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_set_write_fn'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_init_io'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `jpeg_CreateDecompress'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `jpeg_destroy_decompress'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `jpeg_finish_decompress'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_read_update_info'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `jpeg_set_defaults'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `jpeg_set_quality'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_set_read_fn'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_create_info_struct'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `jpeg_read_header'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `TIFFClose'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_set_filter'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `jpeg_start_compress'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `jpeg_alloc_huff_table'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `TIFFSetErrorHandler'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `TIFFReadRGBAStrip'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_set_strip_16'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_error'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_set_strip_alpha'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `jpeg_start_decompress'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_write_image'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `TIFFGetField'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `jpeg_destroy_compress'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_set_compression_level'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `jpeg_resync_to_restart'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `TIFFOpen'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_read_end'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_set_expand_gray_1_2_4_to_8'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `TIFFIsTiled'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `TIFFReadEncodedTile'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_read_image'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_write_info'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_create_write_struct'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_set_gray_to_rgb'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `jpeg_CreateCompress'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_set_IHDR'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_set_palette_to_rgb'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `jpeg_stdio_dest'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_write_end'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_read_info'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_set_bgr'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `TIFFRGBAImageOK'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_set_rgb_to_gray'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `jpeg_std_error'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `TIFFSetWarningHandler'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_destroy_read_struct'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `jpeg_finish_compress'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_get_IHDR'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `TIFFReadEncodedStrip'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `jpeg_read_scanlines'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `TIFFReadRGBATile'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_set_compression_strategy'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_destroy_write_struct'

../../lib/libopencv_highgui.so.2.2.0: undefined reference to `png_set_swap'

collect2: ld returned 1 exit status

make[2]: *** [bin/opencv_createsamples] Error 1

make[1]: *** [modules/haartraining/CMakeFiles/opencv_createsamples.dir/all] Error 2

make: *** [all] Error 2

------------------------------------------------

Regards,

Gopi

0 Kudos
Reply

2,160 Views
hoanganhngo
Contributor III

This is step by step what i've done:

$ cd ~

$ mkdir OpenCV22_CrossBuild

$ cd OpenCV22_CrossBuild

$ wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.2/OpenCV-2.2.0.tar.bz2

$ tar -xjf ./OpenCV-2.2.0.tar.bz2

$ cd ./OpenCV-2.2.0/

copy opencv-2.2-arm-imx53-sift-issue.patch from zip file to /home/lucid/314-opencv22_ltib

$ patch -p1<opencv-2.2-arm-imx53-sift-issue.patch (this patch is from zip file above).

$ patch -p2< gbt.patch

  copy imx53.cmake from zip file to /home/lucid/OpenCV22_CrossBuild/OpenCV-2.2.0

$ mkdir release
$ cd release
$ pwd

$ export PATH=/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin:$PATH
$ sudo apt-get install cmake

cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/home/lucid/ltib/rootfs/usr/ -DCMAKE_TOOLCHAIN_FILE:PATH=${PWD}/../imx53.cmake -DCMAKE_FIND_ROOT_PATH=/home/lucid/ltib/rootfs/ -DWITH_FFMPEG=OFF -DWITH_GSTREAMER=OFF -DWITH_PYTHON=OFF -DWITH_GTK=OFF -DBUILD_EXAMPLES=ON ..

$ make

........

and it stop at 57% because of this error:

home/lucid/OpenCV22_CrossBuild/OpenCV-2.2.0/modules/highgui/src/cap_dc1394_v2.cpp:49:27: error: dc1394/dc1394.h: No such file or directory

/home/lucid/OpenCV22_CrossBuild/OpenCV-2.2.0/modules/highgui/src/cap_dc1394_v2.cpp:53: error: 'dc1394error_t' does not name a type.

Can you tell me what is the mistake in these step. I try to solve this for a month but I have no result.:((.


0 Kudos
Reply

2,160 Views
CurtisWald
NXP Employee
NXP Employee

Hi,

I have not tried going through the build steps, sorry about the missing patches. I found a zip file which I have attached that has more information and some patches. Hopefully this will fill in the missing holes as I have no other areas to search. Good luck.

0 Kudos
Reply

2,160 Views
hoanganhngo
Contributor III

Can you describe how to use these file,please.I have been follow this but it doesn't work.Thank you so much.:D.

0 Kudos
Reply

2,160 Views
YiayitKarabulut
Contributor I

thanks for help, i notice that patch files are missing :( . where can i possibly find them?

0 Kudos
Reply

2,160 Views
CurtisWald
NXP Employee
NXP Employee

I found this which maybe of help. I do not have the VMware image, but the steps are there for building Opencv2.2.

1) Unzip i.MX53QSB VMWare image into directory
------------------------------------------------
folder: vm_Ubuntu
user: lucid
passwords: lucid
L2.6.35_11.01.00_ER_source.tar.gz

2) Open a terminal window

3) Build LTIB for i.MX53 QSB
------------------------------
$ cd /home/lucid/ltib
$ ./ltib -c

Selection (imx5x)
board (mx53_loco)

4) Get OpenCV 2.2
-----------------
$ cd ~
$ mkdir OpenCV22_CrossBuild
$ cd OpenCV22_CrossBuild
$ wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.2/OpenCV-2.2.0.tar.bz2
$ tar -xjf ./OpenCV-2.2.0.tar.bz2
$ cd ./OpenCV-2.2.0/

5) Apply patches
-----------------
$ wget http://imxcommunity.org/group/computervisionusingtheimx/forum/attachment/download?id=4103961%3AUploa...
$ wget http://imxcommunity.org/group/computervisionusingtheimx/forum/attachment/download?id=4103961%3AUploa...
$ wget FileNotFound**LlzQ2YNNNtsb5tdZq/emgOPenCV22gbtFix.patch
$ patch -p1 < opencv2.2armxmsiftissue.patch
$ patch -p0 < emgOPenCV22gbtFix.patch

6) Build OpenCV
----------------
$ mkdir release
$ cd release
$ pwd
/home/lucid/OpenCV22_CrossBuild/OpenCV-2.2.0/release

$ export PATH=/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin:$PATH
$ sudo apt-get install cmake
$ cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/home/lucid/ltib/rootfs/usr/ -DCMAKE_TOOLCHAIN_FILE:PATH=${PWD}/../imx53.cmake -DCMAKE_FIND_ROOT_PATH=/home/lucid/ltib/rootfs/ -DWITH_FFMPEG=OFF -DWITH_GSTREAMER=OFF -DWITH_PYTHON=OFF -DWITH_GTK=OFF -DBUILD_EXAMPLES=ON ..
$ make
$ sudo make install

The above cmake parameters will build a version of
highgui without window support. To see your video
you will need a fb interface. This was done to avoid
the overhead of having GTK and X11 on the system.

7) Build applications
-----------------------
$ cd ~/ltib/rpm/BUILD
GET LABS

$ cd /home/lucid/ltib
$ ./ltib -m shell
LTIB> cd /home/lucid/ltib/rpm/BUILD/Labs


8) Setting up NFS on the i.MX53QSB
------------------------------------
Requires a serial port @ 115200,8,n,1

Open hyperterminal

setenv serverip 192.168.1.23
setenv bootfile uImage
setenv nfsroot 192.168.1.23:/home/lucid/ltib/rootfs
setenv bootargs_base 'setenv bootargs console=ttymxc0,115200'
setenv bootargs_nfs 'setenv bootargs ${bootargs} root=/dev/nfs ip=dhcp nfsroot=${nfsroot},v3,tcp video=mxcdi1fb:BGR24,XGA di1_primary tve '
setenv bootcmd_net 'run bootargs_base bootargs_nfs;bootm'
setenv bootcmd 'dhcp; run bootcmd_net'
saveenv


I also edited /etc/exports
To configure nfs server, add lines to /etc/exports like this (below example exports /home and everything under it.
/home *(rw,no_root_squash)
Then restart the nfs server:
sudo /etc/init.d/nfs-kernel-server restart

class
1) ltib -c
2) flash bootloader to SD
3) configure uboot for NFS
4) build and run labs


echo -n 0 > /sys/class/graphics/fb0/blank

Makefile
-----------
OPENCV_LIB = /home/lucid/ltib/rootfs/usr/lib

OPENCV_INC = /home/lucid/ltib/rootfs/usr/include

include ../flags.make

include ../link.make

PROJECT = Lab1

all:

gcc $(CXX_DEFINES) $(CXX_FLAGS) -o emg_imx_OpenCV_fb.o -c ../emg_imx_OpenCV_fb.c

g++ $(CXX_DEFINES) $(CXX_FLAGS) -o $(PROJECT).o -c $(PROJECT).cpp

g++ $(CXX_FLAGS) $(PROJECT).o emg_imx_OpenCV_fb.o -o $(PROJECT) $(LINK_FLAGS)

cp Lab1 ../../../../rootfs/Lab1

flags.make
------------
CXX_FLAGS = -Wall -pthread -ffunction-sections -O3 -DNDEBUG -fomit-frame-pointer -O3 -ffast-math -DNDEBUG -I/. -I$(OPENCV_INC)/ -I$(OPENCV_INC)/opencv/ -I$(OPENCV_INC)/opencv2/core/ -I$(OPENCV_INC)/flann/ -I$(OPENCV_INC)/imgproc/ -I$(OPENCV_INC)/video/ -I$(OPENCV_INC)/highgui/ -I$(OPENCV_INC)/ml/ -I$(OPENCV_INC)/calib3d/ -I$(OPENCV_INC)/features2d/ -I$(OPENCV_INC)/objdetect/ -I$(OPENCV_INC)/legacy/ -I$(OPENCV_INC)/contrib/

CXX_DEFINES = -DHAVE_CONFIG_H


link.make
----------


LINK_FLAGS = -Wall -pthread -ffunction-sections -O3 -DNDEBUG -fomit-frame-pointer -O3 -ffast-math -DNDEBUG -rdynamic -ldl -lm -lpthread -lrt $(OPENCV_LIB)/libopencv_core.so.2.2.0 $(OPENCV_LIB)/libopencv_flann.so.2.2.0 $(OPENCV_LIB)/libopencv_imgproc.so.2.2.0 $(OPENCV_LIB)/libopencv_highgui.so.2.2.0 $(OPENCV_LIB)/libopencv_ml.so.2.2.0 $(OPENCV_LIB)/libopencv_video.so.2.2.0 $(OPENCV_LIB)/libopencv_objdetect.so.2.2.0 $(OPENCV_LIB)/libopencv_features2d.so.2.2.0 $(OPENCV_LIB)/libopencv_calib3d.so.2.2.0 $(OPENCV_LIB)/libopencv_legacy.so.2.2.0 $(OPENCV_LIB)/libopencv_contrib.so.2.2.0 $(OPENCV_LIB)/libopencv_ml.so.2.2.0 $(OPENCV_LIB)/libopencv_video.so.2.2.0 $(OPENCV_LIB)/libopencv_objdetect.so.2.2.0 $(OPENCV_LIB)/libopencv_features2d.so.2.2.0 $(OPENCV_LIB)/libopencv_flann.so.2.2.0 $(OPENCV_LIB)/libopencv_calib3d.so.2.2.0 $(OPENCV_LIB)/libopencv_highgui.so.2.2.0 $(OPENCV_LIB)/libopencv_imgproc.so.2.2.0 $(OPENCV_LIB)/libopencv_core.so.2.2.0 -ldl -lm -lpthread -lrt -Wl,-rpath,$(OPENCV_LIB)

0 Kudos
Reply