Click here to Skip to main content
15,881,882 members
Articles / Programming Languages / C#

Convert RGB to Gray Scale without using Pointers

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
17 Jan 2012CPOL 9.6K  
I would use the colormatrix for that... Look here under the grayscale methodhttp://pawjershauge.blogspot.com/2010/09/imagedrawing-extensions.html

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
13 Jan 2012Grasshopper.iics 4 alternatives  
Simple way of converting RGB Image to Gray Scale Image without using any pointers
Please Sign up or sign in to vote.
13 Jan 2012Luc Pattyn
This is an alternative to "Convert RGB to Gray Scale Without Using Pointers".
Please Sign up or sign in to vote.
17 Jan 2012YvesDaoust
You shouldn't rely on methods from the .NET classes (Bitmap::SetPixel, Bitmap::GetPixel, Color::FromArgb) in the inner loop as these are called intensively, million times per image, and their implementation are opaque to you.If their implementation is opaque to the compiler too, no code...
Please Sign up or sign in to vote.
18 Jan 2012YvesDaoust
A piece of warning, though: the LockBits method is not a transparent one, it does image format conversion before returning a pointer to the bitmap (this is why it has a PixelFormat argument). And conversely, the UnlockBits method converts back to the original format. My best guess is that when...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Denmark Denmark

Comments and Discussions