C++ program using OpenCV has error "Identifier CV_WINDOW_AUTOSIZE, CV_WINDOW_FREERATIO not defined"

Asked 2 years ago, Updated 2 years ago, 96 views

I would like to run the following sample program using OpenCV 4.0.0 and VisualStudio c++, line 33

 CV_WINDOW_AUTOSIZE | CV_WINDOW_FREERATIO

in the respective parts of
The identifier "CV_WINDOW_AUTOSIZE" "CV_WINDOW_FREERATIO" is not defined.

appears with an error.I tried typing cv_ and looked for something similar in the predictive transformation. Do I need to do something else to use the cv::namedWindow user interface?
Can't I use this version?Also, please let me know if there is a code with the same meaning.

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

# if defined_DEBUG
# define CV_EXT "d.lib"
# else
# define CV_EXT ".lib"
#endif

# pragma comment (lib, "opencv_core2413" CV_EXT)
# pragma comment (lib, "opencv_imgproc2413" CV_EXT)
# pragma comment (lib, "opencv_highgui2413" CV_EXT)

int main()
{
cv::Mat srcImg=cv::imread("lenna.jpg");
if(srcImg.empty())
return1;

cv::namedWindow("image", CV_WINDOW_AUTOSIZE | CV_WINDOW_FREERATIO);
cv::imshow("image", srcImg);
cv::waitKey();

return 0;
} 

c++ opencv

2022-09-30 16:15

1 Answers

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.