Click here to Skip to main content
15,899,314 members
Home / Discussions / C#
   

C#

 
GeneralRe: Eventhandler in C# - How to send parameter Pin
Vikas K.31-Jul-07 1:55
Vikas K.31-Jul-07 1:55 
GeneralRe: Eventhandler in C# - How to send parameter Pin
Martin#31-Jul-07 2:05
Martin#31-Jul-07 2:05 
QuestionHow Can use Matlab Files in Visual Studio C# .Net? Pin
zeeShan anSari26-Jul-07 21:38
zeeShan anSari26-Jul-07 21:38 
AnswerRe: How Can use Matlab Files in Visual Studio C# .Net? Pin
Christian Graus26-Jul-07 21:39
protectorChristian Graus26-Jul-07 21:39 
AnswerRe: How Can use Matlab Files in Visual Studio C# .Net? Pin
Murali Babu26-Jul-07 23:00
professionalMurali Babu26-Jul-07 23:00 
QuestionDirectX in C# Pin
legolass26-Jul-07 21:36
legolass26-Jul-07 21:36 
AnswerRe: DirectX in C# Pin
Christian Graus26-Jul-07 21:40
protectorChristian Graus26-Jul-07 21:40 
QuestionSome Basic Question Related To Image Processing…(C# .Net) Pin
zeeShan anSari26-Jul-07 21:30
zeeShan anSari26-Jul-07 21:30 
I use the following code (obvious not my coding) in my program:
public static bool CovertToGray(Bitmap bmp)<br />
        {<br />
           <br />
            BitmapData bmData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height),<br />
                ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);<br />
            int stride = bmData.Stride;<br />
            System.IntPtr Scan0 = bmData.Scan0;<br />
        unsafe<br />
            {<br />
                byte* p = (byte*)(void*)Scan0;<br />
                byte red, green, blue;<br />
                int nOffset = stride - bmp.Width * 3;<br />
                for (int y = 0; y < bmp.Height; ++y)<br />
                {<br />
                    for (int x = 0; x < bmp.Width; ++x)<br />
                    {<br />
                        blue = p[0];<br />
                        green = p[1];<br />
                        red = p[2];<br />
                        p[0] = p[1] = p[2] = (byte)(.299 * red<br />
                            + .587 * green + .114 * blue);<br />
                        p += 3;<br />
                    }<br />
                    p += nOffset;<br />
                }<br />
            }<br />
            bmp.UnlockBits(bmData);<br />
            return true;<br />
        }

Questions are
What is the function of BitmapData?
Why PixelFormat.Format24bppRgb is used?
What is this int stride = bmData.Stride;?
Why unsafe used?
In short I can’t understand the 50% of above code for convert the picture in grayscale format?
I want learn……..please guide me …..I am waiting for your response
Smile | :)
AnswerRe: Some Basic Question Related To Image Processing…(C# .Net) Pin
Christian Graus26-Jul-07 21:42
protectorChristian Graus26-Jul-07 21:42 
QuestionHow to convert Struct to array Pin
Morad Kobi26-Jul-07 21:30
Morad Kobi26-Jul-07 21:30 
AnswerRe: How to convert Struct to array Pin
Malcolm Smart26-Jul-07 21:35
Malcolm Smart26-Jul-07 21:35 
AnswerRe: How to convert Struct to array Pin
Christian Graus26-Jul-07 21:38
protectorChristian Graus26-Jul-07 21:38 
QuestionCLR-Trigger coded in c# (Express Edition 2005) Pin
jacklynn_mei26-Jul-07 21:25
jacklynn_mei26-Jul-07 21:25 
AnswerRe: CLR-Trigger coded in c# (Express Edition 2005) Pin
leppie27-Jul-07 3:21
leppie27-Jul-07 3:21 
QuestionRe: CLR-Trigger coded in c# (Express Edition 2005) Pin
jacklynn_mei29-Jul-07 16:22
jacklynn_mei29-Jul-07 16:22 
QuestionAnonymous methods Pin
Michael Sync26-Jul-07 21:24
Michael Sync26-Jul-07 21:24 
AnswerRe: Anonymous methods Pin
Christian Graus26-Jul-07 21:33
protectorChristian Graus26-Jul-07 21:33 
GeneralRe: Anonymous methods Pin
Malcolm Smart26-Jul-07 21:37
Malcolm Smart26-Jul-07 21:37 
GeneralRe: Anonymous methods Pin
Christian Graus26-Jul-07 21:39
protectorChristian Graus26-Jul-07 21:39 
GeneralRe: Anonymous methods Pin
Malcolm Smart26-Jul-07 21:51
Malcolm Smart26-Jul-07 21:51 
GeneralRe: Anonymous methods Pin
Christian Graus26-Jul-07 22:01
protectorChristian Graus26-Jul-07 22:01 
AnswerRe: Anonymous methods Pin
szukuro26-Jul-07 21:51
szukuro26-Jul-07 21:51 
GeneralRe: Anonymous methods Pin
J4amieC26-Jul-07 22:07
J4amieC26-Jul-07 22:07 
GeneralRe: Anonymous methods Pin
Kevin McFarlane26-Jul-07 23:46
Kevin McFarlane26-Jul-07 23:46 
GeneralRe: Anonymous methods Pin
Michael Sync26-Jul-07 23:47
Michael Sync26-Jul-07 23:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.