Help

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Help

Sheri-2
Hello
I write a program to load one image bud it is not working can anyone help me whit this Code.
here is the Exact Source:

#include "highgui.h"

int main( int argc, char** argv )
{
        IplImage* img = cvLoadImage( argv[1] );
        cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
        cvShowImage( "Example1", img );
        cvWaitKey(0);
        cvReleaseImage( &img );
        cvDestroyWindow( "Example1" );
}
 Regards

Reply | Threaded
Open this post in threaded view
|

Re: Help

Jean-Pierre Landry
You should check if 'img' is NULL after cvLoadImage...
This might indicate that the supplied filename was not found...
You also don't have any check on the number of parameters supplied to
the program...
Try to include the image file into the same directory as the program...
Remember that you have to supply double backslashes in C string if you
want to specify a full path:

"C:\\myImage.tif"

Good luck!

sheri wrote:

> Hello
> I write a program to load one image bud it is not working can anyone help me whit this Code.
> here is the Exact Source:
>
> #include "highgui.h"
>
> int main( int argc, char** argv )
> {
> IplImage* img = cvLoadImage( argv[1] );
> cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
> cvShowImage( "Example1", img );
> cvWaitKey(0);
> cvReleaseImage( &img );
> cvDestroyWindow( "Example1" );
> }
>  Regards
>
>
>
> ------------------------------------
>
> Change settings: http://www.yahoogroups.com/mygroups, select
>    Get Emails (get all posts)
>    Daily Digest (one summary email per day)
>    Read on the web (read posts on the web only)Or Unsubscribe by mailing [hidden email]