c++ - g++ openCV compile error on line that doesn't exist -
I am trying to compile and run the following program gcc test.cpp -o test
. But I'm getting this error:
in the test.cpp file included: 4: /usr/local/include/opencv/cvaux.hpp:49:10: Error: 'cvaux. The H file & lt; Angled & gt; Did not get involved with; "Quotation" is used instead of #include & lt; Cvaux.h & gt; ^ 1 error occurred.
This line is not in the program though. What can I do to improve this?
Program:
Example of reading and writing example examples #include & lt; Opencv2 / opencv.hpp & gt; #include & lt; Opencv2 / highgui / highgui.hpp & gt; # Include & lt; Opencv / cvaux.hpp & gt; Int main (int argc, char ** argv) {IplImage * pInpImg = 0; // Load an image from the file - change it based on your image name pInpImg = cvLoadImage ("my_image.jpg", CV_LOAD_IMAGE_UNCHANGED); If (! PInpImg) {fprintf (stderr, "input image failed to load \ n"); Return -1; } // Write the image in a file with a different name, // using a different image format - .png instead of .jpg if (! CvSaveImage ("my_image_copy.png", pInpImg)) {fprintf (stderr) , "To write a failed image file \ n"); } // Remember the image collection after using it! CvReleaseImage (& amp; pInpImg); Return 0; }
"What can I do to improve it?"
Use the C + + API instead:
Examples of examples to read and write examples include # include & lt; Opencv2 / opencv.hpp & gt; #include & lt; Opencv2 / highgui / highgui.hpp & gt; Using namespace cv; Load an image from the int main (int argc, char ** argv) {// file - change it to the name of your image mat img = imread ("my_image.jpg", CV_LOAD_IMAGE_UNCHANGED); If (img.empty ()) {fprintf (stderr, "input image failed to load \ n"); Return -1; } // This is just to show that you will not have pre-alloc // result-images with c ++. Mat gray; CvtColor (img, gray, CV_BGR2GRAY); // Write the image in a file with a different name, // Use a different image format - .png instead of .jpg if (! ("Ink" ("my_image_gray.png", gray)) {fprintf (Stderr, "Write failed image file \ n");} There is no need to release anything with C! Return 0;}
Comments
Post a Comment