I need to know a way to convert an equirectangular spherical panorama image into a cubic panorama using C#.
If you don't know what a cubic panorama is, look at this:
Then download the source image for what you're seeing:
http://infectionist.com/images/halo_...h_Panorama.jpg (WARNING: 4.5MB, 4000x2000 resolution)
I need to be able to do this on-the-fly from within the program. Here is my logic, which appears to be wrong:
Equirect. panoramas must have a 2: aspect ratio, meaning the width must be exactly twice the height. Cubic panoramas are basically a flattened cube with all 6 faces arranged together so that if you formed a cube with the faces, they would fit together perfectly.
Each face of a cubic panorama has exactly a 90°x90° field of view. My reasoning was that since an equirect panorama basically shows all 360° in the width and 180° in the height, that 90° should be exactly the WIDTH x (HEIGHT/2). I tried cropping my image to half height, then making it a square by scaling the height to 4000 pixels. Then I applied a Rectangular to Polar filter in Photoshop, which is supposed to correct my image, but leaves me with a circle on the outside where the pixels are stretched. I figured out the area of the square that would fit inside the circle (D = diameter; a = square side; a = sqrt(D^2/2);) and cropped out that portion...the problem is, while it's close to what I need, it's not exactly what I need, since the resulting parts still don't fit perfectly together.
So, enough of my explanation of that, does anyone know how I might go about converting an equirectangular image to a cubic one in C#? I can't really finish my project if it can't be done.
If you don't know what a cubic panorama is, look at this:
Then download the source image for what you're seeing:
http://infectionist.com/images/halo_...h_Panorama.jpg (WARNING: 4.5MB, 4000x2000 resolution)
I need to be able to do this on-the-fly from within the program. Here is my logic, which appears to be wrong:
Equirect. panoramas must have a 2: aspect ratio, meaning the width must be exactly twice the height. Cubic panoramas are basically a flattened cube with all 6 faces arranged together so that if you formed a cube with the faces, they would fit together perfectly.
Each face of a cubic panorama has exactly a 90°x90° field of view. My reasoning was that since an equirect panorama basically shows all 360° in the width and 180° in the height, that 90° should be exactly the WIDTH x (HEIGHT/2). I tried cropping my image to half height, then making it a square by scaling the height to 4000 pixels. Then I applied a Rectangular to Polar filter in Photoshop, which is supposed to correct my image, but leaves me with a circle on the outside where the pixels are stretched. I figured out the area of the square that would fit inside the circle (D = diameter; a = square side; a = sqrt(D^2/2);) and cropped out that portion...the problem is, while it's close to what I need, it's not exactly what I need, since the resulting parts still don't fit perfectly together.
So, enough of my explanation of that, does anyone know how I might go about converting an equirectangular image to a cubic one in C#? I can't really finish my project if it can't be done.
Comment