Main Site Documentation

Image Processing


#1

HI,

How can I use the Bitmap or Image class to store the image from Camera Module?
Did .NETMF or GHI have class to get the pixel from the image?
For my application, I need to get the R,G,B pixel and store to array for further processing.
Thanks.


#2

Check this post.

http://www.tinyclr.com/forum/21/4703/#/2/msg45145

There is piece of code that converts bitmap into a BMP byte array. BMP is 54 bytes of header information and then raw rgb values.


#3

Thanks;
Next step is how to get the position pixel.

How to do in NETMF like this

public int[,,] getRGBData() 
{
           
            Bitmap Bpimage = new Bitmap(image);
            int Height = Bpimage.Height;
            int Width = Bpimage.Width;
            int[,,] rgbData=new int[Width,Height,3];
           
for(int y=0;y<Height;y++)
          {
                for(int x=0;x<Width;x++)
               {
                    Color color=bimage.GetPixel(x,y);
                    rgbData[x, y, 0] = color.R;
                    rgbData[x, y, 1] = color.G;
                    rgbData[x, y, 2] = color.B;
                }
            }
return rgbData;
        }


#4

Here is one scenario.

Get the byte array of all the pixels like in the post i have mentioned earlier, after that you can do simple math to get location of the first byte for any pixel. That would be your R (RGB) or B (BGR) value.I am not sure if it is stored as RGB or BGR, but it is easy to check.