problem with image rectification

View: New views
2 Messages — Rating Filter:   Alert me  

problem with image rectification

by aroleng :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I try to write a small java program(it's more like a script) that stitches photos automatically but I'm having a problem with the image rectification. Maybe somebody can help me.
First I get the features with autopano-sift-c

autopano-sift-c --projection 0,50 --maxmatches 8 keypoints.pto img0_0.jpg img0_1.jpg img0_2.jpg img0_3.jpg img0_4.jpg

Then I detect 2 horizontal and 2 vertical lines in each image and write the coordinates into the pto file. So it looks something like that:

# Hugin project file generated by APSCpp

p f0 w3000 h3000 v90  n"JPEG q90"
m g1 i0 f0 m2 p0.00784314

i w704 h576 f0 a0 b-0.01 c0 d0 e0 p0 r0 v50 y0  u10 n"img0_0.jpg"
i w704 h576 f0 a=0 b=0 c=0 d0 e0 p0 r0 v=0 y0  u10 n"img0_1.jpg"
i w704 h576 f0 a=0 b=0 c=0 d0 e0 p0 r0 v=0 y0  u10 n"img0_2.jpg"
i w704 h576 f0 a=0 b=0 c=0 d0 e0 p0 r0 v=0 y0  u10 n"img0_3.jpg"
i w704 h576 f0 a=0 b=0 c=0 d0 e0 p0 r0 v=0 y0  u10 n"img0_4.jpg"

v v0
v p1 r1 y1
v p2 r2 y2
v p3 r3 y3
v p4 r4 y4

# automatically generated control points
c n0 N1 x280.119375 y205.432558 X101.489310 Y191.576169 t0
c n0 N1 x280.119375 y205.432558 X101.489310 Y191.576169 t0
c n0 N1 x280.119375 y205.432558 X101.489310 Y191.576169 t0
c n0 N1 x411.583797 y470.454740 X240.147392 Y456.715450 t0
c n0 N1 x301.536845 y161.984534 X123.072073 Y148.687758 t0
c n0 N1 x286.486930 y133.199545 X106.084581 Y119.921403 t0
c n0 N1 x440.903316 y316.654024 X267.915809 Y300.347719 t0
[and so on]

c n0 N0 x176 y438 X703 Y552 t2
c n1 N1 x176 y149 X702 Y196 t2
c n1 N1 x176 y462 X703 Y559 t2
c n2 N2 x176 y481 X700 Y556 t2
c n2 N2 x176 y151 X703 Y186 t2
c n3 N3 x176 y493 X668 Y544 t2
c n3 N3 x176 y149 X703 Y175 t2
c n4 N4 x176 y498 X496 Y518 t2
c n4 N4 x176 y143 X502 Y156 t2
c n0 N0 x654 y144 X634 Y575 t1
c n0 N0 x432 y144 X426 Y573 t1
c n1 N1 x468 y144 X462 Y574 t1
c n1 N1 x255 y144 X259 Y573 t1
c n2 N2 x533 y144 X521 Y574 t1
c n2 N2 x292 y144 X295 Y574 t1
c n3 N3 x615 y144 X598 Y573 t1
c n3 N3 x354 y144 X353 Y573 t1
c n4 N4 x177 y144 X187 Y574 t1
c n4 N4 x436 y144 X430 Y573 t1

And then I want to optimise the coordinates and rectify the images with the help of autooptimiser

autooptimiser -p -s -o keypoints2.pto keypoints.pto

But when I take a look at the resulting pto file with hugin or stitch and blend it with nona and enblend no rectification is done.
So to get the desired result with hugin, I select Optimise "Positions and View(y,p,r,v)" and afterwards I press "Calulate Field of View". But I'd like to have those steps automated.

So my questions is, is it possible to get a perfectly rectified image just by using free available command line tools like the ones from hugin's bin folder?
And if so, which parameters do I need to pass?
I'd be thankful for any hint.

Best regards

Fabian

Re: problem with image rectification

by Bruno Postle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Mon 26-Oct-2009 at 14:14 -0700, aroleng wrote:
>
>I try to write a small java program(it's more like a script) that stitches
>photos automatically but I'm having a problem with the image rectification.
>Maybe somebody can help me.

[snip]
>v v0
>v p1 r1 y1
>v p2 r2 y2
>v p3 r3 y3
>v p4 r4 y4

>autooptimiser -p -s -o keypoints2.pto keypoints.pto
>
>But when I take a look at the resulting pto file with hugin or stitch and
>blend it with nona and enblend no rectification is done.

You need to also set the -n parameter, otherwise autooptimiser
ignores any 'v' lines you have added:

   autooptimiser -n -p -s -o optimised.pto project.pto

..alternatively you should get a similar result with the -a
parameter without needing to add 'v' lines:

   autooptimiser -a -s -o optimised.pto project.pto

--
Bruno

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "hugin and other free panoramic software" group.
A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to hugin-ptx@...
To unsubscribe from this group, send email to hugin-ptx+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/hugin-ptx
-~----------~----~----~----~------~----~------~--~---