[英]visual studio recognizes opencv functions but not COLOR_BGR2GRAY enum
我正在C ++中學習opencv,但Visual Studio(2017年社區)無法識別枚舉COLOR_BGR2GRAY,但它可以識別opencv的其他功能。
這是源代碼:
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <Windows.h>
using namespace cv;
using namespace std;
void drawSquares(Mat image);
int main(int argc, char** argv)
{
if (argc != 2)
{
cout << " Usage: display_image ImageToLoadAndDisplay" << endl;
return -1;
}
Mat image;
image = imread(argv[1], IMREAD_COLOR); // Read the file
if (!image.data) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl;
return -1;
}
namedWindow("Display window", WINDOW_AUTOSIZE); // Create a window for display.
imshow("Display window", image); // Show our image inside it.
waitKey(0); // Wait for a keystroke in the window
return 0;
}
void drawSquares(Mat image)
{
Mat image_gray;
cvCvtColor(&image, &image_gray, COLOR_BGR2GRAY); //***it doest recognize this enum in this line***
}
知道為什么它不能識別功能但不能識別COLOR_BGR2GRAY枚舉嗎?
嘗試將COLOR_BGR2GRAY
更改為cv::COLOR_BGR2GRAY
並檢查是否cv::COLOR_BGR2GRAY
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.