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

Started by
4 comments, last by jenny_wui 10 years, 2 months ago

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.

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

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

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.

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

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 );

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.

This topic is closed to new replies.

Advertisement