Message Boards Message Boards


Interlace 3 images into pixels using Wolfram Language?

Posted 1 month ago
7 Replies
2 Total Likes

I am trying to interlace 2 or 3 images and make them to look it pixels. How do I first interlace the 2 or 3 images and then divide the final image to pixels?

7 Replies
Posted 1 month ago

What do you mean by 'interlace'?

Posted 1 month ago

interweave of create Stereo Images the 2 or 3 images to create something like thisenter image description here

I really don't know if I understand what you want to do with the image...

I made an attempt below, see if it is useful in any way or if it has nothing to do with the goal (?):


im = ColorConvert[image, "RGB"];
a = Delete[Map[RGBColor[#] &, Tuples[{1, 0}, 3]], {{1}, {-1}}];
a1 = ColorQuantize[im, a];
swap = {a[[1]] -> a[[3]], a[[3]] -> a[[1]], a[[2]] -> a[[5]], 
   a[[5]] -> a[[2]], a[[4]] -> a[[6]], a[[6]] -> a[[4]]};
rule = {RGBColor[{1, 1, 0}] -> Black, RGBColor[{1, 0, 1}] -> Black, 
   RGBColor[{0, 1, 1}] -> Black};
left = ColorReplace[a1, rule];
right = ColorReplace[ColorReplace[a1, swap], rule];

{Grid[{{"", "left", ""}, {Black, Green, Black}, {Red, Black, Blue}}, 
  Frame -> All], 
 Grid[{{"", "right", ""}, {Red, Black, Blue}, {Black, Green, Black}}, 
  Frame -> All]}

{{"left", Show[left, ImageSize -> Medium]}, {"right", 
  Show[right, ImageSize -> Medium]}}


A small sample with the same pixel range for the two images:

interval = {484175 ;; 484185}[[1]];
{PixelValue[left, {All, All}][[interval]], 
 Map[RGBColor[#] &, PixelValue[left, {All, All}][[interval]]]}
{PixelValue[right, {All, All}][[interval]], 
 Map[RGBColor[#] &, PixelValue[right, {All, All}][[interval]]]}


Sorry if I couldn't help you (I think maybe I really couldn't understand)..

Posted 1 month ago

Claudio Chaib Thank you very much for the effort. What I wanted to do is design an auto-stereoscopic image by image partitioning into equal parts and mixing the two or three images that will do two or three-flip, or Multi-flip to create a smooth 3D animation effects using lenticular printing and lenticular lenses or lenticular displays. I hope this explains it. You may check the attached document for further visual explanation


Hi Peter,

I think you need ImagePartition:

{img1, img2} = ExampleData /@ {{"TestImage", "Lena"}, {"TestImage", "Mandrill"}};
(* decomposition of images into strips: *)
{ip1, ip2} = ImagePartition[#, {512, 8}] & /@ {img1, img2};
(* odd strips of img1: *)
stp1 = Table[ip1[[n]], {n, 1, Length[ip1], 2}];
(* even strips of img2: *)
stp2 = Table[ip2[[n]], {n, 2, Length[ip1], 2}];
ImageAssemble[Riffle[stp1, stp2]]

enter image description here

Posted 1 month ago

Henrik Schachner, Thank you very much. So what does this {512, 8} in " {ip1, ip2} = ImagePartition[#, {512, 8}] & /@ {img1, img2};" in script means? Is it Lines per Inch?

Hi Peter,

the documentation on ImagePartition states: Those units are pixels.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract