我尝试在图片中应用自适应阈值,但我不断收到此错误消息:
threshold.cpp:在成员函数'cv :: Mat filter :: threshold(cv :: Mat&,int&)'中: threshold.cpp:20:25:error:变量或字段'AdaptiveThreshold'声明为void void AdaptiveThreshold(img,image_final,255,ADAPTIVE_THRESH_GAUSSIAN_C,CV_THRESH_B
#include <iostream>
#include <string>
#include <math.h>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <fstream>
#include "filter.h"
#include <typeinfo>
using namespace std;
using namespace cv;
typedef unsigned char uchar;
cv::Mat filter::threshold(cv::Mat& in_image, int& threshold){
cv::Mat img;
cv::Mat image_final;
in_image.convertTo(img, CV_8UC1);
void AdaptiveThreshold(img,image_final,255,ADAPTIVE_THRESH_GAUSSIAN_C,CV_THRESH_BINARY,13,0);
return image_final;
}
答案 0 :(得分:2)
删除&#39; void&#39;因为它是对函数的调用而不是定义/声明。
答案 1 :(得分:0)
除了删除“ void”之外,还将AdaptiveThreshold更改为“ adaptiveThreshold”。因此程序中的相应命令如下所示。
adaptiveThreshold(img,image_final,255,ADAPTIVE_THRESH_GAUSSIAN_C,THRESH_BINARY,13,0);