I am trying to detect edges on a sample input image with open cv C++ implementation, my environment is Visual C++ with Visual Studio. I installed the library from the Nuget package manager. I added the header #include <opencv2/opencv.hpp> to the top of my source file and no error have been generated. Then I tried to use the code below to detect the edges on the image.
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include <opencv2/opencv.hpp>
//entry point of the program
int main() {
printf("%s\n", "This command line program is for performing a variety of image processing functions on a sample image");
//to change the input image, change it from the resources folder in visual studio
//define the path to the image
char name[13] = "original.jpg";
//check if the image file exists
FILE* file = fopen(name,"r");
if (file == NULL) {
printf("%s", "Image file not found");
//exit the script
return 987;
}
//if the script passes this point then the image file has been located
//define the pointers for the input and output cv arrays
cv::Mat image ;
cv::Mat edges;
image = cv::imread(name, cv::IMREAD_GRAYSCALE);
//call the function to detect the edges
cv::Canny(image, edges, 200, 200);
//display the image with edges in a named window
cv::namedWindow("Edges", cv::WINDOW_AUTOSIZE);
cv::imshow("image", edges);
return 0;
}
But Visual Studio is throwing an error that cv::Octree::Node::children’ is uninitialized. Always initialize a member variable (type.6). CImages C:\Users\HP\source\repos\CImages\packages\OpenCV.2.4.11\build\native\include\opencv2\contrib\contrib.hpp, how can I resolve this error and get the compiler to compile my program successfully?