Without having looked at all the complicated code of Helmut Dersch, I found
two lines of code from which I assume that the optimizer realizes the
combination 2A, i.e.
The hfov is measured from the left of the left pixel area to the right of
the right pixel area . The reference point is in the mid of the pixels.
These lines are in the file adjust.c:
First (in function distSphere() ):
h2 = (double)optInfo->im[ n[j] ].height / 2.0 - 0.5;
w2 = (double)optInfo->im[ n[j] ].width / 2.0 - 0.5;
execute_stack_new( (double)optInfo->cpt[num].x[j] -
w2, // cartesian x-coordinate src
(double)optInfo->cpt[num].y[j] - h2, // cartesian y-coordinate
src
&x, &y, stack);
This corresponds to my terms x - (W-1)/2 that occur in the cases 2A and 1A.
Second (in function SetInvMakeParams() ):
case _rectilinear:
mp->distance = (double) pn->width / (2.0 * tan(b/2.0));
break;
Probably this mp->distance is some kind of distance D that is used when
modelling the camera with a simple pinhole model.
In the pinhole model the angle alpha would be calculated as: alpha =
arctan( x / D ) where D is the distance of the optical center (the
pinhole) to a plane parallel to the image plane and going through the point
in 3D space.
(the pinhole).
Here D = mp->distance .
If you insert it, you get:
alpha = arctan ( ( x - (W-1)/2 ) / mp->distance ) = arctan ( ( x -
(W-1)/2 ) / (W / (2*tan(b / 2))) ) .
Here b is hfov in radians, so I call it hfov_rad ( in the C-Code hfov is
used with the unit degrees ).
So:
alpha = arctan ( ( x - (W-1)/2 ) / (W / (2*tan(hfov_rad / 2))) ) =
arctan( (x - (W-1)/2) / (W/2) * tan(hfov_rad / 2) )
This is exactly the same as in my case 2A, so I assume that the case 2A is
realized in the optimizer.
Maybe I will also test it with numerical values.
Florian Königstein schrieb am Montag, 16. Mai 2022 um 08:54:16 UTC+2:
>
> But also the cases 1B and 2A could be identified in this way:
> If the combination 1B was realized in the optimizer, the x-coordinate 0,5
> must yield alpha = -hfov / 2, the coordinate x=W-0,5 must yield alpha
> =+hfov / 2 and x = W/2 must yield alpha = 0.
> In this case the example formula would be:
> alpha = arctan( (x- W/2) / ((W-1)/2) * tan(hfov / 2) )
>
> If the combination 2A was realized in the optimizer, the x-coordinate -0,5
> must yield alpha = -hfov / 2, the coordinate x=W-0,5 must yield alpha
> =+hfov / 2 and x = (W-1)/2 must yield alpha = 0.
> Then the formula would be:
> alpha = arctan( (x - (W-1)/2) / (W/2) * tan(hfov / 2) )
>
> Florian Königstein schrieb am Montag, 16. Mai 2022 um 06:57:11 UTC+2:
>
>> As already said, for the hfov the following possibilities exist:
>> 1. The hfov is calculated from the mid of the left pixel to the mid of
>> the right pixel
>> 2. The hfov is measured from the left of the left pixel area to the right
>> of the right pixel area
>>
>> Further more, for the reference point of the pixels is possible:
>> A The reference point is in the mid of the pixels
>> B The reference point is at the top, left point of the pixels
>>
>> Combining this, 4 possibilities would exist ( 1A, 1B, 2A, 2B ).
>> In my example formulas I assumed (but didn't know surely) that only the
>> combinations 1A and 2B are possible / reasonable.
>>
>> Of course, I didn't derive these formulas and it may be difficult to see
>> what I wanted to say.
>> But you can simply insert the values x = 0 and x = W-1 (first formula) in
>> order to get alpha = - hfov / 2 and alpha = + hfov / 2 .
>> Or x = 0 and x = W (second formula) in order to also get alpha = - hfov /
>> 2 and alpha = + hfov / 2 .
>>
>> The difference is that for alpha = + hfov you must insert x = W and not x
>> = W-1 in the second formula.
>> This corresponds to the combination 2 B : The x coordinate of the right
>> point in the rightmost pixel area is W is this case.
>> In the case 1A the x coordinate of the middle of the right pixel is W-1
>> and the x coordinate of the right of the right pixel area would be W-1 +
>> 1/2 = W - 1/2
>>
>> If I find the formulas of Helmut Dersch too complicated, I could try to
>> find out by numerical experiments which case (1A, 2B) is used there.
>>
>>
>> Florian Königstein schrieb am Sonntag, 15. Mai 2022 um 21:05:02 UTC+2:
>>
>>> Ok, another correction:
>>> The second formula would indicate that the hfov is measured from the
>>> left of the left pixel area to the right of the right pixel area. The first
>>> formula would indicate that the hfov is calculated from the mid of the left
>>> pixel to the mid of the right pixel.
>>>
>>> Florian Königstein schrieb am Sonntag, 15. Mai 2022 um 21:01:43 UTC+2:
>>>
>>>> ... Sorry for repeated deletion and re-posting, but there seems to be
>>>> no possibility the edit the message ...
>>>>
>>>> One question is e.g.: What is the exact meaning of the hfov (horizontal
>>>> field of view): Is it the angle measured from the left of the leftmost
>>>> pixel area to the right of the rightmost pixel or from the mid of the left
>>>> to the mid of the right pixel ?
>>>>
>>>> The formulas in the optimizer are faily complicated. But assume that
>>>> for a pixel the angle between the optical axis and the ray going through
>>>> the "reference point" of the pixel area was calcualted, call it alpha.
>>>> Assume the y coordinate is so that the y position is in the middle [[ y
>>>> = (H-1)/2 if the reference point of each pixel is in the middle of the
>>>> pixel area ]].
>>>>
>>>> W and H are the width and height of the image in pixels.
>>>>
>>>> Assume in the optimizer the angle alpha is calculated as:
>>>> alpha = arctan( (x- (W-1)/2) / ((W-1)/2) * tan(hfov / 2) )
>>>> This would indicate that the reference point is in the middle of the
>>>> pixels.
>>>>
>>>> If the calculation would be:
>>>> alpha = arctan( (x - W/2) / (W/2) * tan(hfov / 2) )
>>>> This would indicate that the reference point is in the left (and upper)
>>>> pixel area.
>>>>
>>>> The actual formulas are more complicated, but it should be possible to
>>>> get this information out of them.
>>>>
>>>> [email protected] schrieb am Sonntag, 15. Mai 2022 um 20:41:33
>>>> UTC+2:
>>>>
>>>>> If control points would link a pixel in one image to a pixel in
>>>>> another they could have integer coordinates.
>>>>> But if they link a 4.5 pixel wide and 2.5 pixel high leave of a tree
>>>>> to the same leaf in a different photo the leaf might be 300.45 pixels
>>>>> more
>>>>> to the left and 2.4 pixels higher in one picture than in the other.
>>>>>
>>>>> If you drop the digits after the comma the world might get a
>>>>> playstation-1-look.
>>>>>
>>>>
--
A list of frequently asked questions is available at:
http://wiki.panotools.org/Hugin_FAQ
---
You received this message because you are subscribed to the Google Groups
"hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/hugin-ptx/068d957d-a9cb-4cce-9069-6e315aa507cbn%40googlegroups.com.