Group Abstract Group Abstract

Message Boards Message Boards

Combine three 2D matrices into a single array via nested lists?

Posted 6 years ago
POSTED BY: Philip Anon
7 Replies
Anonymous User
Anonymous User
Posted 6 years ago
POSTED BY: Anonymous User
POSTED BY: Mikayel Egibyan

ColorCombine should do the trick. Mathematica works with lists and to loop over list one uses the Map operator, which in short notation is /@. Also data in an array is something different that data stored as and Image. Some functions are convenient but only work on Images and not Lists.

cols = {r, g, b} = ImageData /@ ColorSeparate[img];
imgs = {ri, gi, bi} = Image /@ cols

In[11]:= Head@img
Head /@ cols
Head /@ imgs

Out[11]= Image

Out[12]= {List, List, List}

Out[13]= {Image, Image, Image}

ColorCombine[Image /@ cols, "RGB"]
POSTED BY: Martijn Froeling
Posted 6 years ago
POSTED BY: Philip Anon

BTW - John is also correct about storing your data in a matrix, you just need to decide what form it should be in. Since C is Row-major format, I think it likely will be consistent with Mathematica's Image[] format. Also, I assumed you would want to reconstruct the image eventually.

Regards,

Neil

POSTED BY: Neil Singer
POSTED BY: Neil Singer

You could do this: rgb = {imgr, imgg, imgb}

POSTED BY: John Shonder
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard