- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have the OpenCV O'Reilly manual, and I am testing out the sample code in the section "Display a Picture." The picture I wish to display is a jpeg format stored on the Desktop. Here is a copy of the code:
// Sample Project.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "highgui.h" //GUI header
#include "cv.h" //main OpenCV header
int main(int argc, char** argv)
{
IplImage* img = cvLoadImage("p-pod-jpeg.jpg",1);
cvNamedWindow("Example 1",1);
cvShowImage("Example 1", img);
cvWaitKey(0);
cvReleaseImage(&img);
cvDestroyWindow("Example 1");
}
The code compiled successfully, but when I went into debug mode, the command line terminal pops up with a window that has a gray background. The image does not display. What am I doing wrong?
Thanks!
// Sample Project.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "highgui.h" //GUI header
#include "cv.h" //main OpenCV header
int main(int argc, char** argv)
{
IplImage* img = cvLoadImage("p-pod-jpeg.jpg",1);
cvNamedWindow("Example 1",1);
cvShowImage("Example 1", img);
cvWaitKey(0);
cvReleaseImage(&img);
cvDestroyWindow("Example 1");
}
The code compiled successfully, but when I went into debug mode, the command line terminal pops up with a window that has a gray background. The image does not display. What am I doing wrong?
Thanks!
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please verify if the pointer *img is not null after returning by cvLoadImage(..)
--Gennady
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Gennady Fedorov (Intel)
Please verify if the pointer *img is not null after returning by cvLoadImage(..)
--Gennady
I have it working now! Thanks!
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page