Ask Your Question
0

Image is not display using VS 2010 with OpenCV

asked 2014-08-01 11:47:27 -0600

updated 2014-08-02 15:46:39 -0600

FLY gravatar image

Below is my program

#include<opencv\cv.h>
#include<opencv\highgui.h>
using namespace cv;
int main()
{
    IplImage* img = cvLoadImage("C:\\Users\\garry\\Admin\\Desktop\\ab.jpg");
    cvNamedWindow("a",CV_WINDOW_AUTOSIZE);
    cvShowImage("a",img);
    cvWaitKey(0);
    cvReleaseImage(&img);
    cvDestroyWindow("a");
    return 0;

}![image description](/upfiles/1406911543327659.png)

edit retag flag offensive close merge delete

Comments

You seem to have a link error when linking with opencv_calib3d library. You can try removing that library from your linker inputs and try again since you don't need it for your program. However I can't tell why that file is corrupt and you may have to reinstall opencv to make sure that you can link with that library as you may need it in the future.

slarti gravatar imageslarti ( 2014-08-02 00:18:04 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-08-02 15:52:46 -0600

FLY gravatar image

I hope you don't mind that I change your question title and edit the question too , because it was looking weird . Now lets move to the answer :

First : You VS2010 contain the linking error you can configure it or can check it out from here as it guide you on each and every step.

Second : Your unfortunately using C interface in your program , try to use c++ interface like instead of using

IplImage* img = cvLoadImage("C:\\Users\\garry\\Admin\\Desktop\\ab.jpg");

Use Mat img = imread("C:\Users\garry\Admin\Desktop\ab.jpg") and same for other like imshow ("a" , img); instead of cvShowImage("a",img);

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-08-01 11:47:27 -0600

Seen: 195 times

Last updated: Aug 02 '14