I have an Image object from the Windows Image Class and I want to get information on specific pixels.
Like, for example, if I have:
Image* myImage = Image::FromFile(L"example.jpg");
I would like to call something like:
myImage->GetPixel(400,400).red;
that should tell me the value of red for the pixel at coordinates 400x400.
But there is no such method, or at least I'm unable to find it. There's only a method for getting the pixel format, which doesn't help me.
How can I go about getting information on specific pixels?
More info on the class: http://msdn.microsoft.com/en-us/library/windows/desktop/ms534462(v=vs.85).aspx
Use the file or stream to create a Bitmap object instead:
Bitmap *myBitmap = new Bitmap("example.jpg");
Color pixelColor;
myBitmap->GetPixel(400, 400, &pixelColor);
cout<<(int)pixelColor.GetRed()<<endl;