[FFmpeg-user] v360 filter with h_offset option
Michael Koch
astroelectronic at t-online.de
Wed Jan 12 20:16:04 EET 2022
Am 12.01.2022 um 19:00 schrieb Paul B Mahol:
> On Wed, Jan 12, 2022 at 5:00 PM Michael Koch <astroelectronic at t-online.de>
> wrote:
>
>> Hello,
>>
>> I have a projector with a 180° fisheye lens in a dome. Things are easy
>> if the lens is at the center of the dome. Any input format can be
>> transformed to fisheye output with the v360 filter. But things are
>> getting complicated when the lens isn't at the dome's center. Let's
>> assume the dome has 1m radius and the lens is shifted 0.5m to the side.
>> In this case the +60° point from the input image must be mapped to the
>> center of the output image (because acos(0.5) = 60°) ).
>> The center of the input image must be mapped to 63.4° in the output
>> image (because 90° - atan(0.5) = 63.4°).
>>
>> The v360 filter has h_offset and v_offset options. There isn't much
>> documentation for these options, so let's just try out what they do.
>> I'm using the test pattern from Paul Bourke:
>> http://www.paulbourke.net/dome/testpattern/1200.png
>>
>> ffmpeg -i 1200.png -vf v360=fisheye:fisheye:h_offset=0.5 -y out.png
>>
>> The +60° point from the input image is not mapped to the center of the
>> output image, that's wrong.
>> The center of the input image is mapped to +60°, that's also wrong.
>>
>>
>> Next I did try 0.577 (=tan(30°)) as offset:
>>
>> ffmpeg -i 1200.png -vf v360=fisheye:fisheye:h_offset=0.577 -y out.png
>>
>> Now the +60° point from the input image is mapped to the center of the
>> output image, that's good.
>> The center of the input image is mapped to about 54.5°, that's wrong.
>>
>>
>> These results leave me with two questions:
>> -- Obviously the offset options aren't doing what I was hoping for. What
>> else are they supposed to do?
>> -- How can a fisheye image be transformed to an off-center fisheye image?
>>
> http://paulbourke.net/panorama/sphere2persp/
>
> I got idea from that one, and I believe its correctly implemented.
ok, I didn't test it with perspective output, may be that works
correctly. But in my case for fisheye it doesn't work. Also I would need
3 offset parameters, including one for Z axis offset (if the lens is
below the dome's center). I'll try to figure out the mathematics. But
it's not so easy.
Michael
More information about the ffmpeg-user
mailing list