884 B
884 B
Conformal Mapping and Video Generation
What is the mapping?
u = mapparam * (scale_s*scale_t) * x / (x*x+y*y)
v = mapparam * (scale_s*scale_t) * y / (x*x+y*y)
is equivalent to the normalized version:
u/scale_t = mapparam * (x/scale_s) / ((x/scale_s)**2 + (y/scale_s)**2)
v/scale_t = mapparam * (y/scale_s) / ((x/scale_s)**2 + (y/scale_s)**2)
This explains why there is a "hole" in the output image: small normalized x,y maps to big normalized u,v. If the normalized u,v has an absolute value greater than 0.5, there is no corresponding pixel in the texture input file, we output the default color black.
How to get the example results
Environment: Python 3.11. Do pip install -r requirements.txt
to get necessary packages.
python map2video.py color_rotate.png color_rotate.gif --num_frames 40
python map2video.py grid.jpg grid.mp4 --num_frames 40