Star calibration and reprojection

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Star calibration and reprojection

PanoTools NG mailing list
Hello,

I have a couple of Vivotek IP8172 IP cameras which have semi-fisheye
lenses (150 degrees diagonally).  I'd like to be able to change the
projection.  So I've got some video from the cameras shot overnight
which includes the brightest stars, and I wrote a program tracking the
positions of the stars as they moved across the frame so that I now have
a fair amount of pixel positions (about 1500) in the frame and their
corresponding azimuth and altitude location in the sky.  Or put another
way, I have about 1500 control points: pixel positions from an image
taken with an unknown lens and their corresponding positions in an
equirectangular frame (using azimuth as x and 90-altitude as y).  So far
so good.

How can I use the data to make a .pto file needed for nona to reproject
frames from my cameras?

I made this .pto file:

i w2560 h1920 v115.3 f3 n"frame.jpg"
i w360 h180 f4 v360 n"dummy.jpg"

# specify variables that should be optimized
v v0
v r0
v p0
v a0
v b0
v c0
v d0
v e0
v g0
v t0

# control points
c n0 N1 x468.43 y794.73 X166.154 Y65.766
c n0 N1 x474.67 y795.08 X166.426 Y65.737
c n0 N1 x479.56 y795.81 X166.698 Y65.707
... [and about 1500 more points]

But where do I go from there?  I'm not really trying to stitch anything
here, the second frame doesn't really exists and would fully overlap
anyway (if I try to stich in Hugin, it complains about overlapping
frames...).

Let's say I want to change the camera frame "frame.jpg" into an
equirectangular projection.

Thanks!
--
Steinar
Reply | Threaded
Open this post in threaded view
|

Re: Star calibration and reprojection

PanoTools NG mailing list
I wrote a tutorial describing a technique for calibrating a lens which is essentially the same as what you are attempting to do. See:http://www.johnhpanos.com/starcal.htm . I used PTGui, but I have converted a sample PTGui project file into a Hugin project and uploaded it to: http://ge.tt/24F3sn22/v/0?c http://ge.tt/24F3sn22/v/0?c  .  This will generate a 360x180 version of a remapped 50mm camera image aligned with a 11500x5750 equirectangular star map.  I'm by no means a Hugin expert, but it should point you in the right direction.

 John
 
 .
Reply | Threaded
Open this post in threaded view
|

Re: Star calibration and reprojection

PanoTools NG mailing list
Thanks.  I had to turn off optimisation for the FOV for some reason,
otherwise I get huge numbers and a warning about incorrect results (FOV
would jump from 115.3 to far beyond 360 which doesn't seem to make any
sense).  Now I get a mean error of 0.2 pixels and a maximum error of
0.7, which doesn't sound bad for 1594 control points in a 2560x1920
frame.

Here's a video showing how I got these control points:

 https://www.youtube.com/watch?v=PdxiLrjTuj4

Whilst I got the pixel positions with no manual interference, I had to
identify 30 stars manually assigning them RA/Dec so I could compute the
Az/Alt for my position.  This is no huge task, but I'll now try to use
panotools to transform the frames into a projection accepted by
astrometry.net, so I can even get the star identification correctly.

My control points were based on a 70 minute video (sampling the
positions for the stars every minute), but with automatic star
indentification I can run the process on a full winter night of video
and get even more precise data.  And importantly easily rerun the
calibration if the camera shifts.

The point of all this is to use these cameras to monitor the sky for
fireballs and track their exact path across the sky.  If all goes well,
I should be able to achieve an accuracy of 3 arc minutes or so.


Are the mapping functions that Hugin/nona uses documented somewhere?  I
would like to write my own code that remaps positions in the frame to
az/alt.

-Steinar

"[hidden email] [PanoToolsNG]" <[hidden email]>
writes:

> I wrote a tutorial describing a technique for calibrating a lens which
> is essentially the same as what you are attempting to do.
> See:http://www.johnhpanos.com/starcal.htm . I used PTGui, but I have
> converted a sample PTGui project file into a Hugin project and
> uploaded it to: http://ge.tt/24F3sn22/v/0?c . This will generate a
> 360x180 version of a remapped 50mm camera image aligned with a
> 11500x5750 equirectangular star map. I'm by no means a Hugin expert,
> but it should point you in the right direction.
>
> John
>
> .
>
> ----------------------------------------------------------------------
> Posted by: [hidden email]
> ----------------------------------------------------------------------
>
>                                                                                                  
>  Reply via web     • Reply to sender  • Reply to group  • Start a New Topic  • Messages in this  
>  post                                                                          topic (2)          


------------------------------------

------------------------------------

--
<*> Wiki: http://wiki.panotools.org
<*> User Guidelines: http://wiki.panotools.org/User_Guidelines
<*> Nabble (Web) http://panotoolsng.586017.n4.nabble.com/
<*> NG Member Map http://www.panomaps.com/ng
<*> Moderators/List Admins: [hidden email]

------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/PanoToolsNG/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/PanoToolsNG/join
    (Yahoo! ID required)

<*> To change settings via email:
    [hidden email]
    [hidden email]

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo Groups is subject to:
    https://info.yahoo.com/legal/us/yahoo/utos/terms/

Reply | Threaded
Open this post in threaded view
|

Re: Star calibration and reprojection

PanoTools NG mailing list
Am 27.10.2014 15:05, schrieb Steinar Midtskogen:

> Are the mapping functions that Hugin/nona uses documented somewhere?  I
> would like to write my own code that remaps positions in the frame to
> az/alt.

You should find some basics on the panotools wiki:
http://wiki.panotools.org/Lens_correction_model
Fisheye projection: http://wiki.panotools.org/Fisheye
http://wiki.panotools.org/Image_positioning_model

However, it might be there's a command line program contained in the
hugin package (bin folder) that already does what you want: pano_trafo
"transform between image and panorama coordinates (and vice versa)"
Unfortunately there's not much documentation on it, only command line help.

Also interesting:
http://wiki.panotools.org/Panorama_scripting_in_a_nutshell

--
Erik Krause
http://www.erik-krause.de


------------------------------------

------------------------------------

--
<*> Wiki: http://wiki.panotools.org
<*> User Guidelines: http://wiki.panotools.org/User_Guidelines
<*> Nabble (Web) http://panotoolsng.586017.n4.nabble.com/
<*> NG Member Map http://www.panomaps.com/ng
<*> Moderators/List Admins: [hidden email]

------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/PanoToolsNG/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/PanoToolsNG/join
    (Yahoo! ID required)

<*> To change settings via email:
    [hidden email]
    [hidden email]

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo Groups is subject to:
    https://info.yahoo.com/legal/us/yahoo/utos/terms/

Reply | Threaded
Open this post in threaded view
|

Re: Star calibration and reprojection

PanoTools NG mailing list
[Erik Krause]

> However, it might be there's a command line program contained in the
> hugin package (bin folder) that already does what you want: pano_trafo
> "transform between image and panorama coordinates (and vice versa)"
> Unfortunately there's not much documentation on it, only command line help.

Yes, perfect!

And the reverse function means that I can draw a grid on the sky showing
azimuth and altitude.

--
Steinar
Reply | Threaded
Open this post in threaded view
|

Re: Star calibration and reprojection

PanoTools NG mailing list
I don't know if you are taking into account refraction of the light rays by the earth's atmosphere, but this bending of the light becomes significant down towards the horizon.

 John
Reply | Threaded
Open this post in threaded view
|

Re: Star calibration and reprojection

PanoTools NG mailing list
"[hidden email] [PanoToolsNG]" <[hidden email]>
writes:

> I don't know if you are taking into account refraction of the light
> rays by the earth's atmosphere, but this bending of the light becomes
> significant down towards the horizon.

I did take that into account when I converted ra/dec into az/alt for the
stars, which then was given to Hugin, so what the solution gives me is
the apparent position in the sky, not the position it would have if
there were no atmosphere.

Since this is going to be used to determine the trajectory of meteors,
those calculations should take refraction into account.  Currently they
don't.  It hasn't really been a big issue because the image quality used
to be poor, but that is what I'm aiming to improve with this project
using 3 or 4 multimegapixel wide angle cameras to cover the entire sky,
effectively giving me a 25 megapixel all sky view (optics would rather
be the limitation not sensors if it had been a single lens).

Using pano_trafo I can easily add a sky grid to images from the cameras
(one degree grid):

 http://norskmeteornettverk.no/bilder/2014/meteor-20140815.jpg

In theory I should get a 3 arc minute resolution, and for much of the
sky it seems to work out!

--
Steinar