Ask Your Question
1

How to display an image center aligned in a openCV window?

asked 2012-12-05 00:40:06 -0500

Subramaniyan AL gravatar image

Hi All,

I'm just a week young to openCV. Now I'm working with opencv2.3 in VC++ 2008 Express Edition. I can display a image in openCV full screen window. But it is automatically positioned at left top corner how can I make it center align? Kindly guide me with your ideas.

Thanks in Advance.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2012-12-05 04:56:10 -0500

Haris gravatar image

I think this is what you are looking for

cvMoveWindow("WndowName",x,y);
edit flag offensive delete link more

Comments

Thank you Haris.

But my need is , the window should be of full screen and the image should be displayed at center of the window.(image resolution is less than display screen resolution).

Can you kindly suggest me with some more ideas....

Note: The function cvMoveWindow() will move the whole window to a particular offset in the screen.

Subramaniyan AL gravatar imageSubramaniyan AL ( 2012-12-07 00:08:14 -0500 )edit
1

You can pass 0 as second argument to the cvNamedWindow function like "cvNamedWindow("mainWin",0);" this will allow you to resize the window using your mouse. If you need fixed size window you can use window re-size function like "cvResizeWindow("mainWin",500,400);". But on both case while resizing the window the image also get re-sized. If you don't want to resize your image I think you need to create an image according to your window size and set imageRoi on that and copy your original image then display it.

Haris gravatar imageHaris ( 2012-12-07 04:14:44 -0500 )edit

Thank you Haris.

It is very useful for me.

Subramaniyan AL gravatar imageSubramaniyan AL ( 2012-12-09 22:40:45 -0500 )edit

Question Tools

Stats

Asked: 2012-12-05 00:40:06 -0500

Seen: 4,364 times

Last updated: Dec 05 '12