Rainysky will accompany you to port qt+opencv on zedboard (six): Run Opencv on zedboard

As on the PC, create a folder /opt/zedboard/opencv_zed, copy the file in, unzip: create two folders build, install, as shown below

Rainysky will accompany you to port qt+opencv on zedboard (six): Run Opencv on zedboard

Here is not the same as pc, you need to set the build environment, create a new file under opencv-2.4.4, the file name is toolchain.cmake, the content is:
Set(CMAKE_SYSTEM_NAME Linux)
Set(CMAKE_SYSTEM_PROCESSOR arm)
Set(CMAKE_C_COMPILER /root/CodeSourcery/Sourcery_CodeBench_Lite_for_Xilinx_GNU_Linux/bin/arm-xilinx-linux-gnueabi-gcc)
Set(CMAKE_CXX_COMPILER /root/CodeSourcery/Sourcery_CodeBench_Lite_for_Xilinx_GNU_Linux/bin/arm-xilinx-linux-gnueabi-g++)

Enter the build file, enter the command to configure: cmake -D CMAKE_TOOLCHAIN_FILE=toolchain.cmake -D CMAKE_INSTALL_PREFIX=/opt/zedboard/opencv_zed/opencv-2.4.4/install ../

Among them CMAKE_INSTALL_PREFIX, represents the installation path, it is best to create a new folder to save, in addition, the last thing is.. / Be careful not to knock a point, otherwise it will be wrong.

Ccmake ./ Configure, the content of the configuration is all the options starting with WITH are all OFF, (except WITH_V4L is selected as ON) Because these require third-party library support, if you choose these, you need to install third-party libraries.

Press c to configure, press g to generate and save

Rainysky will accompany you to port qt+opencv on zedboard (six): Run Opencv on zedboard

After the configuration is complete, enter make to start compiling. After the compilation is complete, it is make install. After the installation is complete, the runtime is in the install folder.
Create a new folder dedicated to writing programs mkdir /opt/zedboard/opencv_zed/code
Create a new test program inside:
Vim edge_detecTIon.cpp This code is the one in the textbook:
/*code*/
#include "cv.h"
#include "highgui.h"

IplImage* doCanny(
IplImage* in,
Double lowThresh,
Double highThresh,
Double aperture)
{
If (in->nChannels != 1)
return (0); // Canny only handles gray scale images
IplImage* out = cvCreateImage(
cvGetSize( in ),
In->depth, //IPL_DEPTH_8U,
1);
cvCanny( in, out, lowThresh, highThresh, aperture );
Return( out );
};

Int main( int argc, char** argv )
{
If(argc!= 3)printf("arguments error! format origin_image.bmp target_image.bmp");
IplImage* img_rgb = cvLoadImage( argv[1] );
IplImage * img_gry = cvCreateImage (cvSize (img_rgb-> width, img_rgb-> height), img_rgb-> depth, 1);
cvCvtColor(img_rgb, img_gry, CV_BGR2GRAY);
// cvNamedWindow("Example Gray", CV_WINDOW_AUTOSIZE );
// cvNamedWindow("Example Canny", CV_WINDOW_AUTOSIZE );
// cvShowImage("Example Gray", img_gry );
IplImage * img_cny = doCanny (img_gry, 10, 100, 3);
If(cvSaveImage(argv[2],img_cny,0)!=0)
Printf("Save Image Successful");
// cvShowImage("Example Canny", img_cny );
// cvWaitKey(0);
cvReleaseImage( &img_rgb);
cvReleaseImage( &img_gry);
cvReleaseImage( &img_cny);
// cvDestroyWindow("Example Gray");
// cvDestroyWindow("Example Canny");
Return 0;
}
Copy a lena image, preferably a .jpg format and a .bmp format (for comparison), and enter the following command to cross-compile
Arm-xilinx-linux-gnueabi-g++ -I /opt/zedboard/opencv_zed/opencv-2.4.4/install/include -I/opt/zedboard/opencv_zed/opencv-2.4.4/install/include/opencv -L/ opt / zedboard / opencv_zed / opencv-2.4.4 / install / lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann ./edge_detecTIon.cpp -o ./edge_detecTIon.o

Rainysky will accompany you to port qt+opencv on zedboard (six): Run Opencv on zedboard

If you want to run on the zedboard board, you need to copy the opencv cross-compiled library to the board. As with qt, you need to make a mirror. For opencv, you only need to mirror the contents of the lib file. (If you use this image to run, there will be a problem, that is, you can not find the stdc++.so library when running, so you need to copy this library to /opt/zedboard/opencv_zed/opencv-2.4.4/install/ Lib, the source file is in the cross compiler, the total command is:

Cp /root/CodeSourcery/Sourcery_CodeBench_Lite_for_Xilinx_GNU_Linux/arm-xilinx-linux-gnueabi/libc/usr/lib/libstdc++.so* /opt/zedboard/opencv_zed/opencv-2.4.4/install/lib). The /usr/lib folder that is mounted to zedboard can be run under:

Make the mirroring process:

Rainysky will accompany you to port qt+opencv on zedboard (six): Run Opencv on zedboard

At this point, the opencv library has been transplanted, and it only needs to be mounted to the board.

200G QSFP AOC

QSFP cable types,200G QSFP adapter,qsfp electrical interface,qsfp optical cable,QSFP patch cable

Dongguan Aiqun Industrial Co.,Ltd , https://www.gdoikwan.com

This entry was posted in on