cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
704 Views
Registered: ‎03-16-2013

problem about opencv used petalinux 2017.4

hi:

  my test bord is zcu102,i want to read a image ,then use opencv lib to process and show it with dp port , i use the function imshow in opencv lib to show the result of the image ,when i run the code on the board, 

Gtk-WARNING **: cannot open display:

 

my rootfs config in petalinux2017.4 is :

file-system-package--->

       misc--->

         packagegroup-petalinux-opecv-->

             [*]packagegroup-petalinux-opecv

             [*]packagegroup-petalinux-opecv-dev

             [] packagegroup-petalinux-opecv-dbg

         packagegroup-petalinux-qt-->

             [*]packagegroup-petalinux-qt

             [] packagegroup-petalinux-qt-dev

             [] packagegroup-petalinux-qt-dbg

         packagegroup-petalinux-x11-->

             [*]packagegroup-petalinux-x11

             [] packagegroup-petalinux-x11-dev

             [] packagegroup-petalinux-x11-dbg

my code is :

#include <iostream>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

using namespace std;
using namespace cv;

Mat rotate(Mat src, double angle)
{
Mat dst;
Point2f pt(src.cols/2., src.rows/2.);
Mat r = getRotationMatrix2D(pt, angle, 1.0);
warpAffine(src, dst, r, Size(src.cols, src.rows));
return dst;
}

int main(int argc, char *argv[])
{
cout << "Hello, Rotate Image!\n";
Mat src=imread("sample.jpg");
if(!src.data)
{
printf("No data!--Exiting the program \n");
return -1;
}

Mat dst;
dst = rotate(src, 10);

imshow("src", src);
imshow("dst", dst);
waitKey(0);

return 0;
}

 

 

0 Kudos
1 Reply
Highlighted
Visitor
Visitor
373 Views
Registered: ‎04-24-2019

Hi 

Did you find a way to solve this problem?

0 Kudos