LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   CLI : Is There A Script To Skew Image With A Curve (https://www.linuxquestions.org/questions/linux-software-2/cli-is-there-a-script-to-skew-image-with-a-curve-4175424049/)

cin_ 08-26-2012 05:48 AM

CLI : Is There A Script To Skew Image With A Curve
 
Looking for a script that will skew an image for me through the command line.

The skew needs be a curve; stead the angle skews offered by imagemagick or lunapic.


I want it to look like it is placed up in a celestial sphere.
Basically able to fit inside of these boxes.

Thanks.


... fred's scripts: skew ... http://www.fmwconcepts.com/imagemagick/skew/index.php
... lunapic.com ... http://www.lunapic.com/editor/?action=skew
... wiki: Celestial Sphere ... http://en.wikipedia.org/wiki/Celestial_sphere
... wireframe of inside sphere ... http://www.dreamstime.com/royalty-fr...-image11717706

jschiwal 08-26-2012 06:28 AM

You might need to use something like Povray.

cin_ 08-26-2012 06:41 AM

Skew With A Curve
 
Thanks for the suggestion. I am looking at the software now and it seems like a 3D image renderer, but do you know if it can or how to manipulate 2D images to appear to be resting on the inside of an invisible sphere?

Looks like it can, using hollow spheres.


Installing now, I will update if it works.


... http://www.povray.org/documentation/view/3.6.0/155/

jschiwal 08-26-2012 03:56 PM

I've used blender rather than povray. I think you want to use the pictures as textures.Getting the lighting and environment right may be the hardest part.

cin_ 08-26-2012 08:04 PM

Figured
 
Now that I have had some time to play around with it, I have POVRay acting as I had hoped.
Here is the setup:

The .pov and .ini files are sort of hacked up from multiple sources.
For the layout and bulk of the .ini and .pov files :: http://www.mpa-garching.mpg.de/~msel...ay/povray.html
For the sphere texture :: http://www.f-lohmueller.de/pov_tut/tex/tex_876e.htm

Also the texture is applied to the outside of the sphere so for the image to be viewed from inside out and have the proper view you will have to transform the image as a horizontal mirror image.

Code:

# convert -flop InIMG.jpg OutIMG.jpg
MYPOVFILE.ini
Code:

Input_File_Name=MYPOVFILE.pov                        ; input file name(s)
;Library_Path=

+W400 +H400                                          ; resolution: W(idth) times H(ight)
Display=on

Quality=9                                            ; 0 .. 11 (best), default: 9
Bounding=on
;Bounding_Threshold=25
Light_Buffer=on                                      ; (requires bounding on)
Vista_Buffer=on                                      ; (requires bounding on)
Antialias=on
Sampling_Method=1                                    ; 1 or 2 (both adaptive, 2 recursive)
Antialias_Threshold=0.1                              ;
Antialias_Depth=6                                    ; 1 .. 9 (best), default: 6
Jitter=on                                            ;
Jitter_Amount=1.0                                    ; 0.0 .. 1.0 (best)
Field_Render=off

Output_to_File=on
Output_File_Type=N                                    ; N for PNG
Output_Alpha=off
Bits_per_Color=16                                    ; 8 .. 16 for PNG
;Output_File_Name=

;--------------------------------------------------------------------------------------------------

;Initial_Frame=0
;Final_Frame=36
;Initial_Clock=0
;Final_Clock=1

MYPOVFILE.pov
Code:

global_settings
{  ambient_light <1,1,1>
  assumed_gamma 1
}
camera
{
 location <-.3,0,0> 
//x,y,z
//x=.1+ rotate90cw move down; x=-.1- rotate90ccw move down
//y=.1+ move down; y=-.1- move down flip
//z=.1+ zoom ; z=-.1- zoomout
  up z
  right x                                 
  look_at <170,0,270>
//x move camera left to right
//y move camera up and down
//z  0,0,270 straight on view
}
light_source
{  <0,0,0>
  color rgb <1,1,1>
  media_interaction on
  media_attenuation on
  shadowless
}

//-------------------------------------------------------------------------------------------------
sphere{ <0,0,0>, 0.5
        texture{ pigment{ color rgb<1, 1,1>}
                finish { diffuse 0.9 phong 0.1}
              } // end of texture 1

        texture{ pigment{
                image_map{ gif "cmailoFLOP.gif"
                            map_type 0
                            once
                          }
                translate<-0.5,-0.5,0>
                scale<1,1,1>*0.35
                } // end pigment
              } // end of texture 2
  } // end of sphere  ------------------


//-------------------------------------------------------------------------------------------------

Simply move around the camera's location and look_at attributes and you can achieve any view angle of an image superimposed on a concave curved surface.
Keep the values small, ie .1, .3, else you may go outside the sphere.

Code:

# ls

# povray MYPOVFILE.ini
# ls
MYPOVFILE.png

To make the white background transparent...
Code:

# convert -transparent white MYPOVFILE.png MYTRANSPARFILE.png
Endless thanks to jschiwal for suggesting POVRay!


All times are GMT -5. The time now is 07:25 PM.