1

I am trying to make this code to work:

package main

import (
    "gocv.io/x/gocv"
)

func main() {
    webcam, _ := gocv.VideoCaptureDevice(0)
    window := gocv.NewWindow("Hello")
    img := gocv.NewMat()

    for {
        webcam.Read(&img)
        window.IMShow(img)
        window.WaitKey(1)
    }
}

it is from https://gocv.io/writing-code/hello-video/. I have installed opencv on my Ubuntu 18 computer. When I run the code, I get:

# pkg-config --cflags  -- opencv4
Package opencv4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv4.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv4' found
pkg-config: exit status 1

The file opencv4.pc dosn't generate during the installation of opencv. When I create sym-link for opencv4.pc from opencv.pc, I get the error:

# gocv.io/x/gocv
features2d.cpp: In function ‘cv::Ptr<cv::FastFeatureDetector>* FastFeatureDetector_CreateWithParams(int, bool, int)’:
features2d.cpp:219:146: error: ‘DetectorType’ in ‘class cv::FastFeatureDetector’ does not name a type
     return new cv::Ptr<cv::FastFeatureDetector>(cv::FastFeatureDetector::create(threshold,nonmaxSuppression,static_cast<cv::FastFeatureDetector::DetectorType>(type)));
                                                                                                                                                  ^~~~~~~~~~~~
features2d.cpp: In function ‘void DrawKeyPoints(Mat, KeyPoints, Mat, Scalar, int)’:
features2d.cpp:429:93: error: no matching function for call to ‘cv::DrawMatchesFlags::DrawMatchesFlags(int&)’
         cv::drawKeypoints(*src, keypts, *dst, color, static_cast<cv::DrawMatchesFlags>(flags));
                                                                                             ^
In file included from /usr/local/include/opencv2/calib3d.hpp:48:0,
                 from /usr/local/include/opencv2/opencv.hpp:56,
                 from features2d.h:5,
                 from features2d.cpp:1:
/usr/local/include/opencv2/features2d.hpp:1178:19: note: candidate: constexpr cv::DrawMatchesFlags::DrawMatchesFlags()
 struct CV_EXPORTS DrawMatchesFlags
                   ^~~~~~~~~~~~~~~~
/usr/local/include/opencv2/features2d.hpp:1178:19: note:   candidate expects 0 arguments, 1 provided
/usr/local/include/opencv2/features2d.hpp:1178:19: note: candidate: constexpr cv::DrawMatchesFlags::DrawMatchesFlags(const cv::DrawMatchesFlags&)
/usr/local/include/opencv2/features2d.hpp:1178:19: note:   no known conversion for argument 1 from ‘int’ to ‘const cv::DrawMatchesFlags&’
/usr/local/include/opencv2/features2d.hpp:1178:19: note: candidate: constexpr cv::DrawMatchesFlags::DrawMatchesFlags(cv::DrawMatchesFlags&&)
/usr/local/include/opencv2/features2d.hpp:1178:19: note:   no known conversion for argument 1 from ‘int’ to ‘cv::DrawMatchesFlags&&’

Help? How can I make this work...

TomE8
  • 111

0 Answers0