Skip to content

rdbch/icosahedral_sampler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unwrapped Icosahedral Maps 🗺️

My humble attempt to create unwrapped icosahedral maps from equirectangular images. Insipration taken from here. If you find this useful, please consider giving it a star ⭐ image

Installation

This code was developed using python 3.8, however it should run on anything that has >= python 3.6.

To install the requirements, one can simply run:

$ pip install -r requiremets.py

Usage

The base class that one can use is the IcosahedralSampler class. Sample usage:

from ico_sampler import IcosahedralSampler

eq_image = imread('./assets/0.png')
ico_sampler = IcosahedralSampler(resolution = 600)

# generate unwrapped maps (as presented above)
unwrapped_image = ico_sampler.unwrap(eq_image, face_offset=0)

# generate unwrapped maps and shift they faces are put into the final panorama
unwrapped_image = ico_sampler.unwrap(eq_image, face_offset=2)


# create the image of the triangular face
face_image = ico_sampler.get_face_image(face_no=0, eq_image=eq_image)

# sample face colors from an eq image
face_colors = ico_sampler.get_face_rgb(face_no=0, eq_image=eq_image)

One can run the provided sample notebook to see exactly how the code works. One can create shift the output image by specifying the face_offset when calling ico_sampler.unwrap():

im

Command line

This repository also contains a command line utility program that can convert an equirectangular image to an incosahedral projection map:

$ python unwrap.py --input=<path to input> \ 
                   --output=<path to output> \
                   --face_resolution=600 \ 
                   --face_offset=0

TODOs

A list of TODOs that might be implemented in the future:

  • add interpolation when sampling the colors (current method: nearest) - this can cause grainy images, but increasing the face resolution (>600px) should diminish this effect
  • add a tutorial like notebook to go over spherical projections

References

During the creation of this repository I hhave found the following articles to be useful:

Releases

No releases published

Packages

No packages published