I found this script which allows extracting a rectangular image from a fishey image:
Fisheye2Rect
Unfortunately it looks like it uses cartesian coordinates to refer a point in the source spherical picture... which is a circle, so it's a little complicated to figure out which coordinates I need to use to split the original images into 12 rectangular images, as if they where manually shot turning around.
Splitting spherical/pano image into square "components"
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Splitting spherical/pano image into square "components"
You probably need to use pano2rect. Then cut that resulting image into your 12 pieces. Fisheye2rect is not likely what you want to use.
Re: Splitting spherical/pano image into square "components"
I guess pano2rect starts from equirectangular images, so I would need both fisheye2pano and pano2rect?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Splitting spherical/pano image into square "components"
No pano2rect starts for a fisheye view and unwraps it into a 360 linear panorama. See the example page. Sorry the name might be misleading.
Re: Splitting spherical/pano image into square "components"
Ok now I am a bit confused.
Input images for pano2rect and fisheye2pano scripts (from your pages):
![Image](http://www.fmwconcepts.com/imagemagick/pano2rect/images/testimage2_diagram.jpg)
![Image](http://www.fmwconcepts.com/imagemagick/fisheye2pano/images/testimage2_diagram.jpg)
pano2rect output:
![Image](http://www.fmwconcepts.com/imagemagick/pano2rect/images/testimage2_depolar0_flip_roll37p2_resize.jpg)
fisheye2pano output:
![Image](http://www.fmwconcepts.com/imagemagick/fisheye2pano/images/testimage2_vm90x52p5_h211p5_angle.jpg)
Output looks the same, but first image appears erroneously flipped left-to-right.
Anyway what I need are separate images, so rather than using one of above scripts and manually splitting images, I think I'll use fisheye2rect, which directly provides single images; maybe it is slower, but maybe I can... script the script to repeteadly launch the script to produce all the 12 frames I need.
I have just to setup a converter from polar to rectangular coordinates, put it into a spreadsheet and make it generate needed command lines.
![Shocked :shock:](./images/smilies/icon_eek.gif)
Input images for pano2rect and fisheye2pano scripts (from your pages):
![Image](http://www.fmwconcepts.com/imagemagick/pano2rect/images/testimage2_diagram.jpg)
![Image](http://www.fmwconcepts.com/imagemagick/fisheye2pano/images/testimage2_diagram.jpg)
pano2rect output:
![Image](http://www.fmwconcepts.com/imagemagick/pano2rect/images/testimage2_depolar0_flip_roll37p2_resize.jpg)
fisheye2pano output:
![Image](http://www.fmwconcepts.com/imagemagick/fisheye2pano/images/testimage2_vm90x52p5_h211p5_angle.jpg)
Output looks the same, but first image appears erroneously flipped left-to-right.
Anyway what I need are separate images, so rather than using one of above scripts and manually splitting images, I think I'll use fisheye2rect, which directly provides single images; maybe it is slower, but maybe I can... script the script to repeteadly launch the script to produce all the 12 frames I need.
I have just to setup a converter from polar to rectangular coordinates, put it into a spreadsheet and make it generate needed command lines.
Re: Splitting spherical/pano image into square "components"
Ok this set of commands, applied to 4 different spherical images created moving around a room (from test01.jpg to test04.jpg) should produce 48 different images, which should allow a 3d reconstruction of the room.
Source images must be spherical images, 235° FOV, 2048x2048.
"Just" 48 images because 50 is the usual limit of accepted images for freeware versions of stereophotogrammetry programs.
Ok, theory is over; now it's just a matter of testing...![Smile :)](./images/smilies/icon_smile.gif)
Source images must be spherical images, 235° FOV, 2048x2048.
Code: Select all
./fisheye2rect -i 235 -o 90 -l 2048,1024 800x600 test01.jpg out01.jpg
./fisheye2rect -i 235 -o 90 -l 1911,512 800x600 test01.jpg out02.jpg
./fisheye2rect -i 235 -o 90 -l 1536,137 800x600 test01.jpg out03.jpg
./fisheye2rect -i 235 -o 90 -l 1024,0 800x600 test01.jpg out04.jpg
./fisheye2rect -i 235 -o 90 -l 512,137 800x600 test01.jpg out05.jpg
./fisheye2rect -i 235 -o 90 -l 137,512 800x600 test01.jpg out06.jpg
./fisheye2rect -i 235 -o 90 -l 0,1024 800x600 test01.jpg out07.jpg
./fisheye2rect -i 235 -o 90 -l 137,1536 800x600 test01.jpg out08.jpg
./fisheye2rect -i 235 -o 90 -l 512,1911 800x600 test01.jpg out09.jpg
./fisheye2rect -i 235 -o 90 -l 1024,2048 800x600 test01.jpg out10.jpg
./fisheye2rect -i 235 -o 90 -l 1536,1911 800x600 test01.jpg out11.jpg
./fisheye2rect -i 235 -o 90 -l 1911,1536 800x600 test01.jpg out12.jpg
./fisheye2rect -i 235 -o 90 -l 2048,1024 800x600 test02.jpg out13.jpg
./fisheye2rect -i 235 -o 90 -l 1911,512 800x600 test02.jpg out14.jpg
./fisheye2rect -i 235 -o 90 -l 1536,137 800x600 test02.jpg out15.jpg
./fisheye2rect -i 235 -o 90 -l 1024,0 800x600 test02.jpg out16.jpg
./fisheye2rect -i 235 -o 90 -l 512,137 800x600 test02.jpg out17.jpg
./fisheye2rect -i 235 -o 90 -l 137,512 800x600 test02.jpg out18.jpg
./fisheye2rect -i 235 -o 90 -l 0,1024 800x600 test02.jpg out19.jpg
./fisheye2rect -i 235 -o 90 -l 137,1536 800x600 test02.jpg out20.jpg
./fisheye2rect -i 235 -o 90 -l 512,1911 800x600 test02.jpg out21.jpg
./fisheye2rect -i 235 -o 90 -l 1024,2048 800x600 test02.jpg out22.jpg
./fisheye2rect -i 235 -o 90 -l 1536,1911 800x600 test02.jpg out23.jpg
./fisheye2rect -i 235 -o 90 -l 1911,1536 800x600 test02.jpg out24.jpg
./fisheye2rect -i 235 -o 90 -l 2048,1024 800x600 test03.jpg out25.jpg
./fisheye2rect -i 235 -o 90 -l 1911,512 800x600 test03.jpg out26.jpg
./fisheye2rect -i 235 -o 90 -l 1536,137 800x600 test03.jpg out27.jpg
./fisheye2rect -i 235 -o 90 -l 1024,0 800x600 test03.jpg out28.jpg
./fisheye2rect -i 235 -o 90 -l 512,137 800x600 test03.jpg out29.jpg
./fisheye2rect -i 235 -o 90 -l 137,512 800x600 test03.jpg out30.jpg
./fisheye2rect -i 235 -o 90 -l 0,1024 800x600 test03.jpg out31.jpg
./fisheye2rect -i 235 -o 90 -l 137,1536 800x600 test03.jpg out32.jpg
./fisheye2rect -i 235 -o 90 -l 512,1911 800x600 test03.jpg out33.jpg
./fisheye2rect -i 235 -o 90 -l 1024,2048 800x600 test03.jpg out34.jpg
./fisheye2rect -i 235 -o 90 -l 1536,1911 800x600 test03.jpg out35.jpg
./fisheye2rect -i 235 -o 90 -l 1911,1536 800x600 test03.jpg out36.jpg
./fisheye2rect -i 235 -o 90 -l 2048,1024 800x600 test04.jpg out25.jpg
./fisheye2rect -i 235 -o 90 -l 1911,512 800x600 test04.jpg out26.jpg
./fisheye2rect -i 235 -o 90 -l 1536,137 800x600 test04.jpg out27.jpg
./fisheye2rect -i 235 -o 90 -l 1024,0 800x600 test04.jpg out28.jpg
./fisheye2rect -i 235 -o 90 -l 512,137 800x600 test04.jpg out29.jpg
./fisheye2rect -i 235 -o 90 -l 137,512 800x600 test04.jpg out30.jpg
./fisheye2rect -i 235 -o 90 -l 0,1024 800x600 test04.jpg out31.jpg
./fisheye2rect -i 235 -o 90 -l 137,1536 800x600 test04.jpg out32.jpg
./fisheye2rect -i 235 -o 90 -l 512,1911 800x600 test04.jpg out33.jpg
./fisheye2rect -i 235 -o 90 -l 1024,2048 800x600 test04.jpg out34.jpg
./fisheye2rect -i 235 -o 90 -l 1536,1911 800x600 test04.jpg out35.jpg
./fisheye2rect -i 235 -o 90 -l 1911,1536 800x600 test04.jpg out36.jpg
Ok, theory is over; now it's just a matter of testing...
![Smile :)](./images/smilies/icon_smile.gif)