6 photos are stitched into a panorama.
For this I have a working Hugin .pto template file. It stitches well with the Hugin workflow.
The pto template needs to be converted to rig_spec.xml for the new NVIDIA VRWorks 360 workflow which expects parameters from a successful OpenCV calibration while I need to use the values from the pto template.
Example for just a single source image from the pto file:
```
# image lines
#-hugin cropFactor=6.4
i w2560 h1920 f3 v118.537956650131 Ra0 Rb0 Rc0 Rd0 Re0 Eev14 Er1 Eb1 r94.606329053126 p-12.649859004975 y-70.9201302573682 TrX0 TrY0 TrZ0 Tpy0 Tpp0 j0 a-0.0128476647589936 b0 c-0.0263288686271355 d24.148292065888 e-42.619120967644 g0 t0 Va1 Vb0 Vc0 Vd0 Vx0 Vy0 Vm5 n"2.jpg"
```
The same data entered into the NVIDIA VRWorks rig_spec.xml equivalent.
My challenges are marked bold:
```
<camera width="2560" height="1920" layout="equatorial">
<input_calib_file name="2.png"/>
<pose>
<rotation roll_deg="94.606329053126" pitch_deg="-12.649859004975" yaw_deg="-70.9201302573682"/>
<translation x_cm="0.0" y_cm="0.0" z_cm="0.0"/>
</pose>
<optics>
<focal_length focal_pixels="1257"/>
<principal_point center_offset_x="0.0" center_offset_y="0.0"/>
<lens type="fisheye" k1="0.0" k2="0.0" k3="0.0" k4="0.0"/>
<fisheye_radius radius_pixels="1400"/>
</optics>
</camera>
```
Solved:
rig_spec.xml - .pto
roll_deg - same as `r` pto value
pitch_deg - same as `p` pto value
yaw_deg - same as `y` pto value
center_offset_x - same as `d` pto value
center_offset_y - same as `e` pto value
radius_pixels - 1400 pixels is a decent approximation
My challenge:
Can someone point me into the right direction to figure out how to properly calculate/convert `focal_pixels` and the `k1, k2, k3, k4` parameters ?
k1 - Most likely corresponds to `c` pto value. In Hugin this parameter is called: Radial distortion (c).
k2 - Most likely corresponds to `a` pto value. In Hugin this parameter is called: Radial distortion (a).
k3 -
k4 -
Here is how the `k` parameters are described in the VRWorks documentation: “Radial distortion coefficients for fisheye”.
For `focal_pixels` I have tried the following:
```
Sensor size in mm:
Horizontal (hfov): 5.7 mm
Vertical (vfov): 4.28 mm
Sensor size in pixel:
Horizontal (w): 2592 pixel
Vertical (h): 1944 pixel
cropFactor: 6.4
hfov: corresponds to `v` PTO value.
var d = Math.sqrt(36.0 * 36.0 + 24.0 * 24.0) / cropFactor;
var r = w / h; //“r” is not a radius.
var sensorSizeX = d / Math.sqrt(1 + 1 / (r * r));
var sensorSizeY = sensorSizeX / r;
var focalLengthMm = sensorSizeX / (hfov / 180 * Math.PI);
var focalLengthPx = (focalLengthMm / 5.70) * w;
```
This gives a value close to correct one, but the images are still not properly aligned when stitching with the rig_spec.xml file.
I have also tried:
focal_pixel = (image_width_in_pixels * 0.5) / tan(FOV * 0.5 * PI/180)
But this gives an even worse result, the value is too low.
If you need the source images, the .pto file, or the lens parameters they all can be found in this archive:
https://drive.google.com/open?id=1OzKGh8oieXIIMCn5Ou22rakxHY2TpFxB0V_x7OBmuyc
My challenge:
Can someone point me into the right direction to figure out how to properly calculate/convert `focal_pixels` and the `k1, k2, k3, k4` parameters ?
k1 - Most likely corresponds to `c` pto value. In Hugin this parameter is called: Radial distortion (c).
k2 - Most likely corresponds to `a` pto value. In Hugin this parameter is called: Radial distortion (a).
k3 -
k4 -
Thank you for the info. I will try the suggestions from the link you provided, maybe it will be a fit (or at least good enough) for my case also, since I only use the `a` and `c` parameters.Any idea if my method for calculating `focal_pixels` is correct?
--
A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
---
You received this message because you are subscribed to a topic in the Google Groups "hugin and other free panoramic software" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hugin-ptx/ZbrCrgLdNJk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hugin-ptx+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hugin-ptx/1bfc845a-bcc9-42de-a42b-68f0e2b48f5f%40googlegroups.com.
The projection is equirectangular, I have attached a screenshot of the project tab from Hugin.
--
A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
---
You received this message because you are subscribed to a topic in the Google Groups "hugin and other free panoramic software" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hugin-ptx/ZbrCrgLdNJk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hugin-ptx+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hugin-ptx/7d0dcbb5-2ee6-4aa2-9599-5395a790ee6b%40googlegroups.com.
Full frame fisheye ? is that it ? not 100% sure.
var focalLengthMm = sensorSizeX / (hfov / 180 * Math.PI);
var focalLengthPx = (focalLengthMm / 5.70) * w;
But you are mixing constants and variables, e.q. you are calculating the sensorSizeX in the first place and then you are using the constant 5.7 in the last equation.
And when you combine both equation you don't need sensorSizeX at all.
Also I don't know if OpenCV/nvidia is using the same convention.
--
A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
---
You received this message because you are subscribed to a topic in the Google Groups "hugin and other free panoramic software" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hugin-ptx/ZbrCrgLdNJk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hugin-ptx+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hugin-ptx/d31c61d0-32d4-4d35-b119-9fa97b84987c%40googlegroups.com.