Strange problem with ImageApply on byte images when Interleaving is
- To: mathgroup at smc.vnet.net
- Subject: [mg100679] Strange problem with ImageApply on byte images when Interleaving is
- From: Sebastien Roy <roys at iro.umontreal.ca>
- Date: Wed, 10 Jun 2009 20:36:07 -0400 (EDT)
Hello everyone,
ImageApply seems to act strange when using imported images ("Byte"
image rather than "Real") , when Interleaving is true. I use version
7.0.1.
a = ImageResize[Import["ExampleData/lena.tif"], {4, 4}]; (* Resizing
is only to make it notebook friendly *)
Reap[ImageApply[(Sow[#]; #) &, a, Interleaving -> True]]//InputForm
will output something like:
{Image[{{{172, 96, 58}, {185, 130, 108}, {192, 163, 149},
{134, 101, 85}}, {{169, 99, 63}, {138, 96, 86}, {163, 135,
126}, {153, 121, 101}}, {{137, 90, 76}, {116, 80, 76}, {161,
106, 89}, {175, 145, 111}}, {{114, 87, 80}, {97, 69, 67},
{169, 120, 97}, {174, 142, 106}}}, "Byte",
ColorSpace -> "RGB", Interleaving -> True,
Magnification -> Automatic],
{{{0.6745098039215687, 0.3764705882352941,
0.22745098039215686}, {0.6745098039215687,
0.3764705882352941, 0.22745098039215686},
{Image`LocalProcessingDump`x[1],
Image`LocalProcessingDump`x[2],
Image`LocalProcessingDump`x[3]},
Image`LocalProcessingDump`x[1], Image`LocalProcessingDump`x[
2], Image`LocalProcessingDump`x[3], 0.6745098039215687,
0.3764705882352941, 0.22745098039215686,
0.7254901960784313, 0.5098039215686274, 0.4235294117647059,
0.7529411764705882, 0.6392156862745098, 0.5843137254901961,
0.5254901960784314, 0.396078431372549, 0.3333333333333333,
0.6627450980392157, 0.38823529411764707,
0.24705882352941178, 0.5411764705882353,
0.33725490196078434, 0.5294117647058824,
0.49411764705882355, 0.6, 0.4745098039215686,
0.5372549019607843, 0.35294117647058826,
0.2980392156862745, 0.4549019607843137, 0.3137254901960784,
0.6313725490196078, 0.41568627450980394,
0.34901960784313724, 0.6862745098039216,
0.5686274509803921, 0.43529411764705883,
0.4470588235294118, 0.3411764705882353, 0.3803921568627451,
0.27058823529411763, 0.2627450980392157,
0.47058823529411764, 0.6823529411764706,
0.5568627450980392}}}
What are these LocalProcessingDump things? Any idea? It creates a lot
of problems.
If you say:
b=Image[ImageData[a]];
Reap[ImageApply[(Sow[#]; #) &, a, Interleaving -> True]]//InputForm
you get the expected result:
{Image[{{{0.6745098039215687, 0.3764705882352941,
0.22745098039215686}, {0.7254901960784313,
0.5098039215686274, 0.4235294117647059},
{0.7529411764705882, 0.6392156862745098,
0.5843137254901961}, {0.5254901960784314, 0.396078431372549,
0.3333333333333333}}, {{0.6627450980392157,
0.38823529411764707, 0.24705882352941178},
{0.5411764705882353, 0.3764705882352941,
0.33725490196078434}, {0.6392156862745098,
0.5294117647058824, 0.49411764705882355}, {0.6,
0.4745098039215686, 0.396078431372549}},
{{0.5372549019607843, 0.35294117647058826,
0.2980392156862745}, {0.4549019607843137,
0.3137254901960784, 0.2980392156862745},
{0.6313725490196078, 0.41568627450980394,
0.34901960784313724}, {0.6862745098039216,
0.5686274509803921, 0.43529411764705883}},
{{0.4470588235294118, 0.3411764705882353,
0.3137254901960784}, {0.3803921568627451,
0.27058823529411763, 0.2627450980392157},
{0.6627450980392157, 0.47058823529411764,
0.3803921568627451}, {0.6823529411764706,
0.5568627450980392, 0.41568627450980394}}}, "Real",
ColorSpace -> Automatic, Interleaving -> True],
{{{0.6745098039215687, 0.3764705882352941,
0.22745098039215686}, {0.6745098039215687,
0.3764705882352941, 0.22745098039215686},
{0.7254901960784313, 0.5098039215686274,
0.4235294117647059}, {0.7529411764705882,
0.6392156862745098, 0.5843137254901961},
{0.5254901960784314, 0.396078431372549,
0.3333333333333333}, {0.6627450980392157,
0.38823529411764707, 0.24705882352941178},
{0.5411764705882353, 0.3764705882352941,
0.33725490196078434}, {0.6392156862745098,
0.5294117647058824, 0.49411764705882355}, {0.6,
0.4745098039215686, 0.396078431372549},
{0.5372549019607843, 0.35294117647058826,
0.2980392156862745}, {0.4549019607843137,
0.3137254901960784, 0.2980392156862745},
{0.6313725490196078, 0.41568627450980394,
0.34901960784313724}, {0.6862745098039216,
0.5686274509803921, 0.43529411764705883},
{0.4470588235294118, 0.3411764705882353,
0.3137254901960784}, {0.3803921568627451,
0.27058823529411763, 0.2627450980392157},
{0.6627450980392157, 0.47058823529411764,
0.3803921568627451}, {0.6823529411764706,
0.5568627450980392, 0.41568627450980394}}}}
What is going on? Any idea?
Cheers,
Sebastien