Jump to content

  • Log In with Google      Sign In   
  • Create Account

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


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
5 replies to this topic

#1 jenny_wui   Members   -  Reputation: 200

Like
0Likes
Like

Posted 03 March 2014 - 07:45 PM

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.       



#2 L. Spiro   Crossbones+   -  Reputation: 23991

Like
0Likes
Like

Posted 03 March 2014 - 09:49 PM

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

#3 jenny_wui   Members   -  Reputation: 200

Like
0Likes
Like

Posted 04 March 2014 - 10:22 AM

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.



#4 Ectara   Crossbones+   -  Reputation: 3093

Like
0Likes
Like

Posted 04 March 2014 - 11:10 AM

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



#5 McGrane   Members   -  Reputation: 1471

Like
0Likes
Like

Posted 04 March 2014 - 11:15 AM

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



#6 jenny_wui   Members   -  Reputation: 200

Like
0Likes
Like

Posted 05 March 2014 - 07:46 PM

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.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.




PARTNERS