Structure of ImageData
The color image data structure is encapsulated in
a Mathematica ImageData
expression. ImageData
is a graphics primitive that facilitates the easy manipulation and
handling of single-channel and multichannel images. This loads the
package.
![[Graphics:Images/index_gr_25.gif]](Images/index_gr_25.gif)
This reads in a small example image in RGB color format.
![[Graphics:Images/index_gr_26.gif]](Images/index_gr_26.gif)
ImageData,
like other graphics primitives, may be displayed using the
Show
command.
![[Graphics:Images/index_gr_27.gif]](Images/index_gr_27.gif)
![[Graphics:Images/index_gr_28.gif]](Images/index_gr_28.gif)
Here is the input form of ImageData.
![[Graphics:Images/index_gr_29.gif]](Images/index_gr_29.gif)
ImageData[{{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}, {255, 255, 255}, {0, 0, 0}}, {{255, 0, 0}, {0, 255, 0}, {0, 0, 255}, {255, 255, 255}, {0, 0, 0}}, {{196, 225, 242}, {96, 204, 248}, {106, 122, 211}, {219, 112, 131}, {144, 42, 55}}, {{202, 172, 172}, {111, 229, 152}, {227, 140, 232}, {175, 149, 115}, {249, 229, 3}}, {{2, 168, 101}, {176, 116, 98}, {206, 37, 113}, {185, 107, 237}, {76, 76, 45}}} PixelInterleave -> True, ColorFunction -> RGBColor]
This converts the image to a planar format.
![[Graphics:Images/index_gr_30.gif]](Images/index_gr_30.gif)
ImageData[{{{255, 0, 0, 255, 0}, {255, 0, 0, 255, 0}, {196, 96, 106, 219, 144}, {202, 111, 227, 175, 249}, {2, 176, 206, 185, 76}}, {{0, 255, 0, 255, 0}, {0, 255, 0, 255, 0}, {225, 204, 122, 112, 42}, {172, 229, 140, 149, 229}, {168, 116, 37, 107, 76}}, {{0, 0, 255, 255, 0}, {0, 0, 255, 255, 0}, {242, 248, 211, 131, 55}, {172, 152, 232, 115, 3}, {101, 98, 113, 237, 45}}}, PixelInterleave -> False, ColorFunction -> RGBColor]
This returns a monochrome (i.e., single-channel) image.
![[Graphics:Images/index_gr_31.gif]](Images/index_gr_31.gif)
ImageData[{{76.24499999999999, 149.685, 29.07, 255., 0.}, {76.24499999999999, 149.685, 29.07, 255., 0.}, {218.26699999999997, 176.724, 127.362, 146.159, 73.97999999999999}, {180.97, 184.94, 176.501, 152.898, 209.216}, {110.728, 131.888, 96.195, 145.142, 72.466}}, PixelInterleave -> None, ColorFunction -> GrayLevel]
|