• Advertisement
Sign in to follow this  

Some suggestion about conversion from pixel coordinate to window (object) coordinate

This topic is 1415 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everybody,
I have extracted some points using OpenCV from video. The imager esolution is ( 640X 480). The extracted coordinates are in pixel coordinates i.e. it looks like follows:

(x, y) : ( 403, 303)
(x, y): (414, 297)

Etc..


Now I would like to display the coordinates in 3D space using OpenGL. I know I need some transformation which involves rotation and translation for conversion from OpenCV to OpenGL pixel coordinates.

In my OpenGL, I also made the window resolution ( 640X480).

Now after transformation of pixel coordinates from OpenCV to OpenGL workspace, I need to display them in 3D object coordinate. Could any one let me know what I have to do for that purpose?

Thanks in advance.       

Share this post


Link to post
Share on other sites
Advertisement
I think you need to rephrase your question.
What do you want to draw in 3D? Points? What is preventing you from doing this if you already have the locations of the points?
Rephrase or add information.


L. Spiro

Share this post


Link to post
Share on other sites

Hi, I am getting the points in pixel, but I would like to draw in coordinates using glVertex3d( x , y, z); What is the easiest way to convert to coordinates from points? Do I need to do texture mapping for this? Please give me some suggestions.

Share this post


Link to post
Share on other sites

I think they're asking for unprojection, though that would probably require a depth value to have any meaningful third dimension.

Share this post


Link to post
Share on other sites

Are you just trying to show the video on the screen using OpenGL? - Or why do you wish to use 3D ? 

If you do wish to only display the video, you should just do it in 2D, set up your scene with gluOrtho2D (or equivalent depending on version )

Enable Texturing, load your information into the texture, and draw a textured Quad.

 

I worked on my final year project in college using something similar to this, i was allowed to use OpenCV to get information from the webcam, but that was all - and as far as i remember, the information would be given to you in the format : ptr* char array[640x480x3] { .. r,g,b,r,g,b ...  } - using this information you can build a Bitmap, then use that Bitmap for your texture.

 

If you really want it in 3d for some reason - do what i said above, and just draw your quad at glVertex3f( x, y, z );

Share this post


Link to post
Share on other sites

Hi, I fixed that problem, Just try to identify the screen resolution in OpenGL workspace and did some translation for proper mapping. Thanks for the advice.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement