It is currently 19 May 2022, 02:33

• Featuring Members' Images •
Could be related to 'Magic-Eye Plug-in'
tim
tim
skinnyhouse
skinnyhouse
tim

GIMP/GL:  Tutorials | Tips | Questions | Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  🡆 Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

Magic-Eye Plug-in

Share your Python Fu Scripts/plug-ins for GIMP here
tim
GL Blogger
1st Place
5822 Post(s)

Magic-Eye Plug-in

Post#1 by tim » 25 May 2021, 14:52


This is for creating stereograph/cross-eye images from an existing texture.
Spawned from https://www.gimp-forum.net/Thread-sterograph which asked for a GIMP 2.10 version.
There is a link above post to some c-code magic-eye that generates it so what I did was translated it to a python plug-in.
Options are pretty much the same.
Here it is:
magic-eye.py #
(7.99 KiB) Downloaded 97 times
magic-eye.py #
version 2. Fix Progress Bar Updates and Friendlier Progress Updates
(8.28 KiB) Downloaded 52 times
magic-eye.py #
version 3. Major Speed Enhancement. From ~95 secs down to ~2 secs
(10.77 KiB) Downloaded 52 times
magic-eye.py #
version 4. More Speed. From ~2 secs down to ~1 sec.
(12.08 KiB) Downloaded 139 times
Plug-in Menu Location: Python-Fu/AAA Magic Eye...

Instructions:
0. have 2 images (gray-scale image and texture image) of same height.
1. Open a gray-scale (height-map) image.
2. Open an image to use as texture for the stereo image.
3. On the gray-scale, run plug-in. Select texture for texture image, choose stripe-width (the width of texture to repeat horizontally) default of 80 seems to work great. choose depth 15 seems to work great too for me...that's it and then select From Left/Middle and select Cross-Eye(YES) or Stereo(NO). Hit OK to run.
4. That's it..wait and let it finish, you'll see progress bar moving.
5. Enjoy.
magic-eye-options.png
Plug-in Options
magic-eye-options.png # (30.81 KiB) Viewed 4157 times Thumbnail
magic-eye-texture.png
Example Texture Input Image
magic-eye-texture.png # (63.94 KiB) Viewed 4157 times Thumbnail
magic-eye-map.png
Example Gray-scale Map image
magic-eye-map.png # (110.4 KiB) Viewed 4157 times Thumbnail
magic-eye-cross-eye.png
Example output when cross-eye is chosen
magic-eye-cross-eye.png # (459.56 KiB) Viewed 4157 times Thumbnail
magic-eye-stereo.png
Example output when Stereo is chosen
magic-eye-stereo.png # (455.83 KiB) Viewed 4157 times Thumbnail
aka Tin
World Food Program | Good Deeds Forum

         

Krikor
Forum Member
14th Place
1015 Post(s)

Post#2 by Krikor » 25 May 2021, 19:16


Tim,
Will any gray-scale image do?
Is it enough to convert to gray-scale?
What does the "From Left-Middle (yes/no)" function do?

Unfortunately the plugin did not work on my win10 Gimp 2.10.21 Samj's Portable.
NotOk.png
Krikor - Magic-Eye testing - error
NotOk.png # (31.85 KiB) Viewed 4140 times Thumbnail
Traceback (most recent call last):
File "C:\Users\...\Gimp-2.10.21_Portable-32-64bit-Win\lib\gimp\2.0\python/gimpfu.py", line 741, in response
dialog.res = run_script(params)
File "C:\Users\...\Gimp-2.10.21_Portable-32-64bit-Win\lib\gimp\2.0\python/gimpfu.py", line 362, in run_script
return apply(function, params)
File "C:\Users\...\magic-eye.py", line 118, in python_tt_magic_eye
hoehe = hoehe_pixel[0] * depth / 255;
IndexError: array index out of range
"I feel that in both art and music, it's not the success that matters but the pleasure it gives you. Focus on the pleasure and the learning will come naturally." - Brian Weston

tim
GL Blogger
1st Place
5822 Post(s)

Post#3 by tim » 25 May 2021, 19:34


Try Gray Scale Image but in RGB mode but make sure the Gray Scale Image and the Texture Image are of the same height.

According to the code I translated, if you choose from Left (YES) the it maps from the left hand side, and if you chose NO then it maps from the middle and maps to the left then from middle to the right. I think it might have to do with perspective.

Your error shown looks like it's failing to pick up pixel value at index [0] so I think it might bugging out because of the fact the image is not in RGB mode I don't think it's GIMP version related.
aka Tin
World Food Program | Good Deeds Forum

         

Krikor
Forum Member
14th Place
1015 Post(s)

Post#4 by Krikor » 25 May 2021, 19:40


tim wrote:
25 May 2021, 19:34
Try Gray Scale Image but in RGB mode but make sure the Gray Scale Image and the Texture Image are of the same height.

According to the code I translated, if you choose from Left (YES) the it maps from the left hand side, and if you chose NO then it maps from the middle and maps to the left then from middle to the right. I think it might have to do with perspective.

Your error shown looks like it's failing to pick up pixel value at index [0] so I think it might bugging out because of the fact the image is not in RGB mode I don't think it's GIMP version related.
Okay, now it worked.
I was using the gray-scale image in gray-scale mode and not in RGB mode.

Now that I know that the plugin runs, I need to know if it actually allows me to view the omitted image.

Thanks Tim!
"I feel that in both art and music, it's not the success that matters but the pleasure it gives you. Focus on the pleasure and the learning will come naturally." - Brian Weston

tim
GL Blogger
1st Place
5822 Post(s)

Post#5 by tim » 25 May 2021, 19:42


Curious, what omitted image?
aka Tin
World Food Program | Good Deeds Forum

         

Krikor
Forum Member
14th Place
1015 Post(s)

Post#6 by Krikor » 25 May 2021, 20:02


tim wrote:
25 May 2021, 19:42
Curious, what omitted image?
omitted image = the gray-scale image hidden by the texture image.
The reverse view.
"I feel that in both art and music, it's not the success that matters but the pleasure it gives you. Focus on the pleasure and the learning will come naturally." - Brian Weston

tim
GL Blogger
1st Place
5822 Post(s)

Post#7 by tim » 25 May 2021, 20:03


Ah you mean the effect...gotcha.
aka Tin
World Food Program | Good Deeds Forum

         

tim
GL Blogger
1st Place
5822 Post(s)

Post#8 by tim » 25 May 2021, 20:06


It's meant to be viewed as stereo image where the viewer must focus beyond the screen.
When I view it using cross-eye method (It's not a true cross-eye) just slightly cross them like focus closer like if you're looking at the space above the screen (in front of screen instead of the behind the screen)...
I have an easier time viewing the cross-eye (slightly cross-eye).. as I am unable to focus behind the screen.
aka Tin
World Food Program | Good Deeds Forum

         

Krikor
Forum Member
14th Place
1015 Post(s)

Post#9 by Krikor » 25 May 2021, 20:36


Until today only one image I could visualize. One posted by Nidhogg on GC.
I just reviewed the image there and again was able to see the effect very quickly.
But this one in the post and the one I tried to create... nothing yet.
"I feel that in both art and music, it's not the success that matters but the pleasure it gives you. Focus on the pleasure and the learning will come naturally." - Brian Weston

Krikor
Forum Member
14th Place
1015 Post(s)

Post#10 by Krikor » 25 May 2021, 21:11


Tim, I did it!
The plugin really works as expected!
After creating a lagoon of tears, I was successful in viewing two images created by the plugin. :yes:

There must be a way to create a better contrast image (height-map). I will check it out.

Thanks Tim!
"I feel that in both art and music, it's not the success that matters but the pleasure it gives you. Focus on the pleasure and the learning will come naturally." - Brian Weston


GIMP/GL:  Tutorials | Tips | Questions | Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  🡆 Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

Post Reply New Topic
  • Similar Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 20 guests