POV-Ray : Newsgroups : povray.advanced-users : Image coord of a projected disc center Server Time
25 Dec 2024 10:08:13 EST (-0500)
  Image coord of a projected disc center (Message 1 to 6 of 6)  
From: Matheus
Subject: Image coord of a projected disc center
Date: 23 Mar 2007 09:10:02
Message: <web.4603df15c1b4053d848d063d0@news.povray.org>
Hi everyone!
Is it possible to know the pixel coordinate with sub-pixel precision of a
projected disc (or any object) center (in image coord)?
I'm trying to simulate camera calibration generating images with Pov-Ray and
I need to recover this kind of information.

Thanks!


Post a reply to this message

From: Alain
Subject: Re: Image coord of a projected disc center
Date: 23 Mar 2007 16:13:11
Message: <460442e7$1@news.povray.org>
Matheus nous apporta ses lumieres en ce 23-03-2007 10:07:
> Hi everyone!
> Is it possible to know the pixel coordinate with sub-pixel precision of a
> projected disc (or any object) center (in image coord)?
> I'm trying to simulate camera calibration generating images with Pov-Ray and
> I need to recover this kind of information.

> Thanks!


Not obvious as the result you want is resolution dependent. It's also dependent 
on the kind of camera used, the direction vector lenght and angle, any 
translation or rotation or other transformation applied.
The simplest case would be that of an orthographic camera looking along the Z 
axis. The X and Y coordinates can then be converted to pixel location. Create 
the object at the origin, translate it, then, if the camera and resolution are 
set so that 1 unit = ,say, 50 pixels, divide the translation by 50 and you get 
the pixel you want. If you used rotation, then you need to use trigonometric 
formulas.

-- 
Alain
-------------------------------------------------
SHOPPING MATH
A man will pay $20 for a $10 item he needs.
A woman will pay $10 for a $20 item that she doesn't need.


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Image coord of a projected disc center
Date: 23 Mar 2007 16:54:36
Message: <46044c9c$1@news.povray.org>
Matheus wrote:
> Hi everyone!
> Is it possible to know the pixel coordinate with sub-pixel precision of a
> projected disc (or any object) center (in image coord)?
> I'm trying to simulate camera calibration generating images with Pov-Ray and
> I need to recover this kind of information.

I assume you are rendering a calibration object to obtain test images
for an image processing algorithm. Have a look at section 3.3.1.1 in
the documentation, which should give you enough information to
calculate the values you need.

It would probably be useful to place the camera at <0,0,-1> and specify
"direction z", so that your image plane is the x-y plane. Then, all you 
need to do is to calculate the intersection point of the line from the
object center point to <0,0,-1> with the x-y-plane, and scale this to
the actual pixel values considering image size and aspect ratio.


Post a reply to this message

From: Matheus
Subject: Re: Image coord of a projected disc center
Date: 25 Mar 2007 20:20:01
Message: <web.46071ec1de8dc2d79fc90ab60@news.povray.org>
Christian Froeschlin <chr### [at] chrfrde> wrote:
> Matheus wrote:
> > Hi everyone!
> > Is it possible to know the pixel coordinate with sub-pixel precision of a
> > projected disc (or any object) center (in image coord)?
> > I'm trying to simulate camera calibration generating images with Pov-Ray and
> > I need to recover this kind of information.
>
> I assume you are rendering a calibration object to obtain test images
> for an image processing algorithm. Have a look at section 3.3.1.1 in
> the documentation, which should give you enough information to
> calculate the values you need.
>
> It would probably be useful to place the camera at <0,0,-1> and specify
> "direction z", so that your image plane is the x-y plane. Then, all you
> need to do is to calculate the intersection point of the line from the
> object center point to <0,0,-1> with the x-y-plane, and scale this to
> the actual pixel values considering image size and aspect ratio.

Thank you Alain and Christian!

Christian, that's exatly what I'm doing: rendering a calibration object. The
solution you gave me solved my problem. Well, in fact now I just need to
write a program to perform it automatically, because there are 864 white
discs on my calibration object that I need to know the right center
location in image coordinates. Maybe I'll try to edit the Pov-ray codes to
export me the discs center after each rendering... it could be exported in
a .txt file. Do you think it would be hard to do? I mean, edit and compile
the Pov-ray codes?
Thank for your help!

Best regards!


Post a reply to this message

From: Chambers
Subject: Re: Image coord of a projected disc center
Date: 27 Mar 2007 13:02:21
Message: <46095c2d@news.povray.org>
Matheus wrote:
> Maybe I'll try to edit the Pov-ray codes to
> export me the discs center after each rendering... it could be exported in
> a .txt file. Do you think it would be hard to do? I mean, edit and compile
> the Pov-ray codes?

I think it would be easier to have your scene write the values to a text 
file as they are computed (during the parse stage).

...Chambers


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Image coord of a projected disc center
Date: 27 Mar 2007 14:24:29
Message: <46096f6d$1@news.povray.org>
Matheus wrote:

> Christian, that's exatly what I'm doing: rendering a calibration object. The
> solution you gave me solved my problem. Well, in fact now I just need to
> write a program to perform it automatically, because there are 864 white
> discs on my calibration object that I need to know the right center
> location in image coordinates. Maybe I'll try to edit the Pov-ray codes to
> export me the discs center after each rendering... it could be exported in
> a .txt file. Do you think it would be hard to do? I mean, edit and compile
> the Pov-ray codes?

As Chambers said, do it in SDL (#fopen, #write). Although, on second
thought, I'm not really sure why you need the image coordinates. After
all, the camera calibration should allow you to reconstruct the 3D
positions, so you can just compare those with the object specs ;)

Also, I'm not really sure how the camera model works in POV-Ray.
Probably a mathematically perfect pinhole, so it wouldn't show real
world effects like radial distortions. You might be able to simulate
some of that by modelling a transparent "lens" object (ior > 1).


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.