Python Forum
put an image into 3 parts - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: put an image into 3 parts (/thread-29977.html)



put an image into 3 parts - Nickd12 - Sep-28-2020

So I have a question regarding images and movies or more like gifs but lets say I have an image and I want to put it in to 3 parts if any one is familiar with the peppers ghost hologram effect they will know what im talking about you place an image on each side of the glass well im trying to take one image and build a function in python where I can copy the image and lay it out in 3 parts one on each side. Is there an interpreter that already does this or is there one I can use to help me make this any thoughts on this would be helpful.

To get an idea of what im trying to do I've uploaded an image with the layout im trying to go for but the image I would import would be just be one image of something like that but just in the middle of the screen and I would want it to come out looking like that.


RE: put an image into 3 parts - Larz60+ - Sep-28-2020

This appears to be something very similar, I haven't tried it: https://github.com/eokeeffe/Pyramid-Hologram-Generator
This shows how it's done with camera and mirrors (not python): https://www.twowaymirrors.com/peppers-ghost-illusion/


RE: put an image into 3 parts - Nickd12 - Sep-29-2020

I tried using that package and got this error idk what it means

hologram[0:up.shape[0], center_x - vert_x + distance:center_x + vert_x + distance] = up
TypeError: slice indices must be integers or None or have an __index__ method


RE: put an image into 3 parts - scidam - Sep-29-2020

If you need to rotate an image and compose an another image from its rotated copies, you can use
numpy. If you have scikit-image installed, you can try the following:

from skimage import data
from matplotlib import pyplot as plt
im = data.astronaut()
m, n, c = im.shape
new_im = np.zeros((m*2, n*3, c))
new_im[:m, :n, ...] = im
new_im[:m, 2*n:, ...] = np.rot90(im)
new_im[m:, n:2*n, ...] = np.flipud(im)
new_im = new_im.astype(np.uint8)
plt.imshow(new_im)
You can consequently apply np.rot90 to get desired rotation of the image.


RE: put an image into 3 parts - Nickd12 - Sep-30-2020

So I was able to get it working the only problem is that when in full screen mode there are these white borders on the side so the image does not take up the full screen when in full screen mode. now ive done some research and I guess this is an OpenCV bug or something. I have found that there are some solutions on a windows pc but I have not found solutions for Macs does anyone have any ideas or any solutions that they know of?