C++、OpenCV3を使ってCannyエッジ検出をしようとしています。
Cannyのところでエラーが出てしまい、わかりません。
ご教授いただけると幸いです。
よろしくお願いいたします。
//////ソースコード///////
#include <iostream>
#include <stdio.h>
#include <cv.h>
#include <highgui.h>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main() {
Mat input_img = imread("/home/LisaXXXX/デスクトップ/test5/0.jpg"); Mat gray_img; Mat bin_img; Mat edges; cvtColor(input_img, gray_img, CV_BGR2GRAY); threshold(gray_img, bin_img, 127, 255, THRESH_BINARY|THRESH_OTSU); imshow("gray", gray_img); imshow("binary", bin_img); waitKey(0); edges = Canny(gray_img,100,200); imshow("Canny", edges); waitKey(0); return 0;
}
//////////////////////
/////エラーコード///////
make all
Building file: ../src/test.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/local/include/opencv2 -I/usr/local/include/opencv -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/test.d" -MT"src/test.d" -o "src/test.o" "../src/test.cpp"
../src/test.cpp: In function ‘int main()’:
../src/test.cpp:84:32: error: invalid initialization of reference of type ‘cv::OutputArray {aka const cv::_OutputArray&}’ from expression of type ‘int’
edges = Canny(gray_img,100,200);
^
In file included from /usr/local/include/opencv2/opencv.hpp:47:0,
from ../src/test.cpp:15:
/usr/local/include/opencv2/imgproc.hpp:1479:19: note: in passing argument 2 of ‘void cv::Canny(cv::InputArray, cv::OutputArray, double, double, int, bool)’
CV_EXPORTS_W void Canny( InputArray image, OutputArray edges,
^
src/subdir.mk:18: ターゲット 'src/test.o' のレシピで失敗しました
make: *** [src/test.o] エラー 1
/////////////////////
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/06/05 14:12