Ask Your Question
0

namedWindow does not show window

asked 2015-01-30 11:14:03 -0600

Kinimod gravatar image

updated 2015-01-30 12:47:13 -0600

Hello,

I'm using VC12 and Win8.1. I think that I configured my project fine, because it compiles.

I use this sample code http://docs.opencv.org/doc/tutorials/...

So I run the application without debugging about VC12. The Message " Usage: display_image ImageToLoadAndDisplay" is displayed and the console application waits for key stroke. But no new window will be displayed.

Same issue by executing the program about command prompt.

I tried also the execution by using admin rights, but it does not display any new window.

Any hints for fixing this issue?

edit retag flag offensive close merge delete

Comments

display_image lena.png

(it wants an image as a cmdline argument)

((you can probably even drag & drop an image onto your exe))

(((also, no worries, if you got here, you've done everything right so far..)))

berak gravatar imageberak ( 2015-01-30 11:30:04 -0600 )edit

yes, I know... so the sample works here on my machine and finds the referenced image, because it does not return -1 and waits for a key stroke, but the image window is not displayed.

Kinimod gravatar imageKinimod ( 2015-01-30 12:40:28 -0600 )edit
1

wait, back to start. look at line 12. as long as you see that message, you did not supply correct cmdline args

berak gravatar imageberak ( 2015-01-30 12:50:01 -0600 )edit
1

Oh... sorry, you're right... So I hard coded the reference and removes the argument condition

//if (argc != 2)
//{
//  cout << " Usage: display_image ImageToLoadAndDisplay" << endl;
//  return -1;
//}

So I have figure out now what's going wrong by executing the exe with command prompt. Thank you. Now it works fine.

Kinimod gravatar imageKinimod ( 2015-01-30 13:33:19 -0600 )edit
1

btw, look at the properties sheet, debugging settings. you can set startup path and cmdline args there

(you'll encounter that problem quite often..)

berak gravatar imageberak ( 2015-01-30 13:36:24 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-01-30 12:24:22 -0600

Doombot gravatar image

@berak's comment is right. I would add that for me, it was easier to place an image in a specific path on my computer, then hardcode the path like this:

Mat image;

string path = "C:/myfirstimage.jpg";

image = imread( path );

From there, I was able to elaborate (like, scanning through a folder and display all images, one at a time, etc.).

As I said, I was not that familiar with VS command line at the time so this was easier for me, but others might realy prefer the command line...

edit flag offensive delete link more

Comments

Thanks, but my issue is that the image window is not displayed. So it finds referenced image, but the image window is not displayed.

Kinimod gravatar imageKinimod ( 2015-01-30 12:43:32 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-01-30 11:14:03 -0600

Seen: 1,818 times

Last updated: Jan 30 '15