Rainysky with you on the zedboard port qt+opencv (five): install opencv on the PC

Finally, QT is installed and transplanted. I am looking forward to the problem with you. The next step is to install opencv. This is a bit more complicated.
The first step is definitely to download the opencv source package, downloaded from the official website of opencv, rainysky download is the latest version 2.4.4. The downloaded address is the same as the time of qt. Convenient management, create a new folder /opt/zedboard/opencv_pc (because you need to install one on each PC and zed, so create a different folder)

Rainysky with you on the zedboard port qt+opencv (five): install opencv on the PC

Then configure some things as follows

The tragedy is wrong, showing that cmake is not installed. Use the command apt-get install cmake. In fact, you need to install another software apt-get install cmake-curses-gui. After installing these two softwares, you can execute cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..

CMAKE_INSTALL_PREFIX=/usr/local is the installation path. The opencv on the PC is generally installed in the /usr/local path. This is successfully executed. Use ccmke./ to see what is installed, change it here. One thing, change OFF after WITH_V4L to ON (press the enter key to change, because you will need to use the camera function later), press c key to configure after changing, then press g key to generate and exit configuration, compile with make Opencv, after the compilation, make install can be installed, the installation location has also been mentioned before.

After installing opencv, the first thing I want to think about is to run a program and try it. Conveniently organized, the opencv code on the PC is placed under /opt/zedboard/opencv_pc/code, which requires a folder to be created. Go to the file cd /opt/zedboard/opencv_pc/code/ Create a new test program with qt, where the program created by rainysky is named lena, built an empty application, and add three programs, (Note: This program It was taken from a blog inside the openhw forum)

Rainysky with you on the zedboard port qt+opencv (five): install opencv on the PC

The code in example.h is:
#ifndef EXAMPLE_H

#define EXAMPLE_H
#include
#include
#include "cv.h"
#include "highgui.h"
Class OpenCV_Example : public QMainWindow
{
Q_OBJECT
Public:
OpenCV_Example();
QPushButton *b1;
IplImage *img;
Public slots:
Void slot_imgshow();
};
#endif //EXAMPLE_H

The code in example.cpp is:
#include "example.h"
OpenCV_Example::OpenCV_Example()
{
setGeometry(100,100,100,100);
B1 = new QPushButton("Show Image",this);
Connect(b1,SIGNAL(clicked()), this, SLOT(slot_imgshow()));
}
Void OpenCV_Example::slot_imgshow()
{
//QMessageBox::informaTIon(this,"TItle","Hello this is popup");
Img = cvLoadImage("/opt/zedboard/opencv_pc/code/lena/lena/lena.jpg",1);//Image to open
//create a new window
cvNamedWindow("Window", 1);
//display the image in the window
cvShowImage("Window", img);
//wait for key to close the window
cvWaitKey(0);
cvDestroyWindow( "Window" ); //destroy the window
}

The code in main.cpp is:
//Write in main:
#include
#include "example.h"
Int main(int argc, char *argv[])
{
QApplicaTIon a(argc, argv);
OpenCV_Example w;
W.show();
Return a.exec();
}

In the code you can see that the image we want to display is lena.jpg, which is included in the opencv source code.

Rainysky with you on the zedboard port qt+opencv (five): install opencv on the PC

Running this program in qt appears, the error of the crash:

Rainysky with you on the zedboard port qt+opencv (five): install opencv on the PC

Follow the prompts to install GTK: apt-get install libgtk2.0-dev, after the installation is complete, re-open the software, run the program, you can see the beautiful lens image

Rainysky with you on the zedboard port qt+opencv (five): install opencv on the PC

Electric Bell

DIN Electric Bell

The electric bell is suitable for audible signaling for intermittent use only in domestic and commercial installations.We are manufacturer of Low Voltage Electrical in China, if you want to buy Electric Bell,Patent Intermittent Electric Bell, please contact us.

Korlen electrical appliances also produces other low voltage electric appliances, for example, overload protector which can do over-current & short circuit protection. The overload protector is popular at customers.

Low Voltage Electrical,Electric Bell,Patent Intermittent Electric Bell

Wenzhou Korlen Electric Appliances Co., Ltd. , https://www.zjmotorstarter.com