Page 2 of 2

Re: Rastr

Posted: 2012-02-20T21:22:51-07:00
by anthony
goldskif wrote:This is all you need for volumetric 3D photos.
Is 8-12 photos (usually 10) , with a slight displacement.
Then all of the photos are processed.
This raster of each picture is cut 1 out of 10 bar.
Cut out the strips are formed near the overall picture.
Printing.
On top of glued lenticular image.
Through the lenses of the eyes see strips like 3D photo
I understand. You want an interleaving of 10 images (every 10th column from a different image) at very high resolutions to generate 3-D plastic lens images. Nice never had this before.

Hmm if you can black out all but the appropriate column of pixels from each o fthe 10 images, you can then simple 'add' the images together to interleave them.

That means you need a list if 10 tiling masks, which are then applied to 10 images, and then those 10 added together.

this is actually more like 'animation' work whcih deals with 'lists of images'.

Initial mask (one column in 10)

Code: Select all

     convert -size 1x1 xc:white -size 9x1 xc:black +append  mask_1_in_10.gif
now expand that mask (a GIF image can hold multiple images)
this uses animated image rolling to do the task
http://www.imagemagick.org/Usage/anim_mods/#distort

Code: Select all

    convert mask_1_in_10.gif -duplicate 9 -virtual-pixel tile \
               -distort SRT '0,0  1 0   %[fx:w*t/n],0' \
                masks_10.gif
Now read in your 10 images, and create a tiled mask
http://www.imagemagick.org/Usage/anim_m ... tter_tiles
Set your 'viewport' size to your image size.
then 'layer compose' the two lists together...
http://www.imagemagick.org/Usage/anim_mods/#composite
and finally 'add merge' the images into a single result
http://www.imagemagick.org/Usage/layers/#eval-seq_add

Code: Select all

   convert  images_*.png null: \
                \( masks_10.gif -virtual-pixel tile \
                    -set option:distort:viewport 180x180 -distort SRT 0 \
                \) -compose multiply -layers composite -compose over \
                 -evaluate-sequence add      column_interleaved_result.png
This could all combined into a single command...

Code: Select all

  convert  images_*.png null: \
                \( -size 1x1 xc:white xc:white -size 9x1 xc:black +append \
                   -duplicate 9 -virtual-pixel tile -distort SRT '0,0  1 0   %[fx:w*t/n],0' \
                   -set option:distort:viewport 180x180 -distort SRT 0 \
                \) -compose multiply -layers composite -compose over \
                 -evaluate-sequence add      column_interleaved_result.png
The '9' values is number of images/columns to interleave minus 1
the '180x180' should match the size of your input images.

Re: Rastr (lenticular)

Posted: 2012-02-20T21:44:49-07:00
by anthony
You make like use the 'sample' and 'resize' deinterlaceing technique on your input images to do some minor horizontal bluring of colors (as referenced previously) before you merge them together using the masks.

This will spread the colors and make the images less 'aliased' horizontally mask them. how critical this is I have no idea.

Re: Rastr (lenticular)

Posted: 2012-02-21T01:33:46-07:00
by goldskif
Hello everyone.
Thanks for the proposed options will be something to think about.
While I do so.

Code: Select all

echo "create rastr"
 convert -size 10x3000 xc:transparent -fill 'black' -draw 'rectangle 5,0 9,2999' rastr.png

echo "create mask 4441x2961(10x15) || 8882x5921(A4)"
 convert rastr.png -write mpr:tile +delete -size 4441x2961 -background none tile:mpr:tile maska.png

echo "process masking"
   increment=0;
   for i in `ls 752-*`
	do
	convert $i \( -roll +$increment+0 maska.png \) -compose DstOut -composite -alpha on rastr-$i
	echo "create $i offset $increment "
	increment=$((increment+1));
  done;

echo "combine"
  convert rastr-752-*.png -layers merge sborka.png
That is what wanted to draw attention.
Lenticular lens has a period of 75 DPI . When printing for each lens must fit (for example) 10 strips.
This means that if the photo for printing should be 750 DPI.
And then there is a problem. When printing, the ink may slightly prior to the neighbouring bars and spoil the overall 3D-effect .
Here it is necessary to think of something when cutting the strips. Perhaps, some interpolation method to strips are slightly narrower than it is.

Re: Rastr

Posted: 2012-02-21T10:48:48-07:00
by fmw42
anthony wrote:
I understand. You want an interleaving of 10 images (every 10th column from a different image) at very high resolutions to generate 3-D plastic lens images. Nice never had this before.

Hmm if you can black out all but the appropriate column of pixels from each o fthe 10 images, you can then simple 'add' the images together to interleave them.

That means you need a list if 10 tiling masks, which are then applied to 10 images, and then those 10 added together.

this is actually more like 'animation' work whcih deals with 'lists of images'.

Initial mask (one column in 10)

Code: Select all

     convert -size 1x1 xc:white -size 9x1 xc:black +append  mask_1_in_10.gif
now expand that mask (a GIF image can hold multiple images)
this uses animated image rolling to do the task
http://www.imagemagick.org/Usage/anim_mods/#distort

Code: Select all

    convert mask_1_in_10.gif -duplicate 9 -virtual-pixel tile \
               -distort SRT '0,0  1 0   %[fx:w*t/n],0' \
                masks_10.gif
Now read in your 10 images, and create a tiled mask
http://www.imagemagick.org/Usage/anim_m ... tter_tiles
Set your 'viewport' size to your image size.
then 'layer compose' the two lists together...
http://www.imagemagick.org/Usage/anim_mods/#composite
and finally 'add merge' the images into a single result
http://www.imagemagick.org/Usage/layers/#eval-seq_add

Code: Select all

   convert  images_*.png null: \
                \( masks_10.gif -virtual-pixel tile \
                    -set option:distort:viewport 180x180 -distort SRT 0 \
                \) -compose multiply -layers composite -compose over \
                 -evaluate-sequence add      column_interleaved_result.png
This could all combined into a single command...

Code: Select all

  convert  images_*.png null: \
                \( -size 1x1 xc:white xc:white -size 9x1 xc:black +append \
                   -duplicate 9 -virtual-pixel tile -distort SRT '0,0  1 0   %[fx:w*t/n],0' \
                   -set option:distort:viewport 180x180 -distort SRT 0 \
                \) -compose multiply -layers composite -compose over \
                 -evaluate-sequence add      column_interleaved_result.png
The '9' values is number of images/columns to interleave minus 1
the '180x180' should match the size of your input images.

The problem with both my method using -roll and Anthony's is that the number of images must be evenly divisible into the image width. To avoid this, I believe, one can tile out the mask image for the first image (with the first column white and the next N black). Then use -virtual-pixel black -distort SRT '0,0 1 0 %[fx:w*t/n],0' to simply shift the image to the right by one pixel for each image filling in the left with black. This is not yet tested.

Re: Rastr (lenticular)

Posted: 2012-02-21T10:53:36-07:00
by fmw42
goldskif wrote:
Lenticular lens has a period of 75 DPI . When printing for each lens must fit (for example) 10 strips.
This means that if the photo for printing should be 750 DPI.
And then there is a problem. When printing, the ink may slightly prior to the neighbouring bars and spoil the overall 3D-effect .
Here it is necessary to think of something when cutting the strips. Perhaps, some interpolation method to strips are slightly narrower than it is.

Can you explain this issue in more detail? Does this mean that you have a 1 pixel strip per image or need more than that?

If 1 pixel strips, then you can simply set the DPI for the whole image as 75*number of images used, by adding at the end -density 750.

Re: Rastr (lenticular)

Posted: 2012-02-21T13:55:00-07:00
by goldskif
Just when creating the final результатат should be taken into account, that you need to have a maximum of a clear distinction between the strips. And do not allow интеполяции or another color mixing.

Re: Rastr (lenticular)

Posted: 2012-02-21T14:47:36-07:00
by fmw42
goldskif wrote:Just when creating the final результатат should be taken into account, that you need to have a maximum of a clear distinction between the strips. And do not allow интеполяции or another color mixing.

Using google to translate, it appears that you want no color mixing from strips and that you want the density of the final image to be 75*number of images. If that is correct, then the above should work with the modifications that I mentioned.

Again if you can provide links to some example set of images, then we can process them and you can verify it they work correctly.

Re: Rastr (lenticular)

Posted: 2012-02-21T18:02:01-07:00
by fmw42
According to http://wehner.org/tools/len/, it would be better to average the images down horizontally (using -sample) and then interleave them back to the original width, via something like my script, interleave.

Re: Rastr (lenticular)

Posted: 2012-02-21T18:24:35-07:00
by anthony
fmw42 wrote:According to http://wehner.org/tools/len/, it would be better to average the images down horizontally (using -sample) and then interleave them back to the original width, via something like my script, interleave.
Basically what I said about pre-processing the images before masking and merging.
posting.php?mode=quote&f=1&p=81193#pr81154

Re: Rastr (lenticular)

Posted: 2012-02-21T19:00:24-07:00
by fmw42
Here is a quick test using -sample and then passing the images to my interleave script. Note that as the number of frames in the animation is not evenly divisible into the width, some pixels are truncated at the right side. Also I had to create separate tmp images and then pass those to the script as my current script does not know how to deal with multi-frame animations (though it could be made so and to merge the -sample operation). I have not set the output density, though that would be easy to add.

Input (from http://www.vicgi.com/):
Image


fact=`convert xc: -format "%[fx:100/24]" info:`
convert 1Red-Eyed-Tree-Frog.gif -coalesce -sample ${fact}%x100%! 1tmp_%02d.png
interleave -t col 1tmp*.png 1Red-Eyed-Tree-Frog_lenticular.png


Image

It looks odd (too sharp bands), so I am not sure if this is correct or not. Comments or corrections are welcome.

Re: Rastr (lenticular)

Posted: 2012-02-21T22:21:33-07:00
by goldskif
Yes, to create additional pictures really use some software to generate animations. However, this software should be able to handle large (8000h6000) photos, and be able to save individual frames as photos jpg, tiff, etc.

Re: Rastr (lenticular)

Posted: 2012-02-22T10:32:35-07:00
by fmw42
goldskif wrote:Yes, to create additional pictures really use some software to generate animations. However, this software should be able to handle large (8000h6000) photos, and be able to save individual frames as photos jpg, tiff, etc.

I don't understand how the lenticular process would be saving more than one image? Is it not the point to interleave multiple images into one image?

Please clarify

Re: Rastr (lenticular)

Posted: 2012-02-23T19:02:15-07:00
by anthony
fmw42 wrote:

Code: Select all

fact=`convert xc: -format "%[fx:100/24]" info:`
convert 1Red-Eyed-Tree-Frog.gif -coalesce -sample ${fact}%x100%! 1tmp_%02d.png
interleave -t col 1tmp*.png 1Red-Eyed-Tree-Frog_lenticular.png
It looks odd (too sharp bands), so I am not sure if this is correct or not. Comments or corrections are welcome.
I think for the lenticular image you would only use half of the animated 'patrol cycle' (which half is another matter!)
Also it looks odd due to the image actually representing a image with a 1/10th loss of horizontal resolution.

Other than that it looks correct.