Click here to Skip to main content
15,919,893 members
Home / Discussions / C#
   

C#

 
GeneralRe: Resources, namespaces, C# Pin
[Marc]20-Feb-06 7:57
[Marc]20-Feb-06 7:57 
Questionscrolling my custom control Pin
Susuko19-Feb-06 7:04
Susuko19-Feb-06 7:04 
QuestionReading Metadata Pin
Shaurya Rastogi19-Feb-06 3:47
Shaurya Rastogi19-Feb-06 3:47 
AnswerRe: Reading Metadata Pin
User 665819-Feb-06 7:15
User 665819-Feb-06 7:15 
Questionsending values between forms Pin
rmedo19-Feb-06 2:46
rmedo19-Feb-06 2:46 
AnswerRe: sending values between forms Pin
gnjunge19-Feb-06 2:56
gnjunge19-Feb-06 2:56 
GeneralRe: sending values between forms Pin
rmedo19-Feb-06 3:29
rmedo19-Feb-06 3:29 
QuestionDetect Edges Pin
haytham_mohammad19-Feb-06 1:48
haytham_mohammad19-Feb-06 1:48 
///<summary><br />
		///this method creates a black and white copy of the image<br />
		///</summary><br />
		public static void Detect Edges(Bitmap original, ref Bitmap modified, Color c, int noise)<br />
		{<br />
			Graphics g = Graphics.FromImage(original);<br />
			for(Int32 x = 0; x < original.Width; x++)<br />
			{<br />
				for(Int32 y = 0; y < original.Height; y++)<br />
				{<br />
					if(x > 2 && y > 2)<br />
					{<br />
						try<br />
						{<br />
							Color current = modified.GetPixel(x    , y);<br />
							Color right   = modified.GetPixel(x + 1, y);<br />
							Color left    = modified.GetPixel(x - 1, y);<br />
							<br />
							int total Current = current.R + current.G + current.B;<br />
							int total Right   = right.R   + right.G   + right.B;<br />
							int total Left    = left.R    + left.G    + left.B;<br />
<br />
						    if(total Current > (total Left + noise) || total Current > (total Right + noise))<br />
						    {<br />
						       modified.SetPixel(x - 1, y, Color.White);//white<br />
						    }<br />
						    else if(total Current > (total Right + noise))<br />
						    {<br />
						       modified.SetPixel(x + 1, y, Color.White);//white<br />
						    }<br />
						    else<br />
						        modified.SetPixel(x, y, Color.Black);//black<br />
						    <br />
						    Color upon   = modified.GetPixel(x, y - 1);<br />
						    Color down One = modified.GetPixel(x, y + 1);<br />
						    <br />
						    int totalUpOne   = upOne.R   + upOne.G   + upOne.B;<br />
						    int totalDownOne = downOne.R + downOne.G + downOne.B; <br />
						    <br />
						    if(totalUpOne > (total Current + noise)) <br />
						    {<br />
						        modified.SetPixel(x, y - 1, Color.White);<br />
						    }<br />
						    else if(totalDownOne > (total Current + noise))<br />
						    {<br />
						        modified.SetPixel(x, y + 1, Color.White);<br />
						    }<br />
						    else<br />
						        modified.SetPixel(x, y, Color.Black);     <br />
						        <br />
						        <br />
						        <br />
						        <br />
						    Color uplift    = modified.GetPixel(x - 1, y - 1);<br />
						    Color downright = modified.GetPixel(x + 1, y + 1);<br />
						    <br />
						    int totalUpLeft    = upLeft.R    + upLeft.G    + upLeft.B;<br />
						    int totalDownRight = downRight.R + downRight.G + downRight.B;<br />
						    if(totalUpLeft > (total Current + noise))<br />
						    {<br />
								modified.SetPixel(x - 1, y - 1, Color.White);<br />
						    }<br />
						    else if(totalDownRight > (total Current + noise))<br />
						    {<br />
								modified.SetPixel(x + 1, y + 1, Color.White);<br />
						    }<br />
						    else<br />
						        modified.SetPixel(x, y, Color.Black);  <br />
						    <br />
						    Color upright  = modified.GetPixel(x + 1, y - 1);<br />
						    Color down Left = modified.GetPixel(x - 1, y + 1);<br />
						    <br />
						    int totalupRight   = upRight.R  + upRight.G  + upRight.B;<br />
						    int totalDownLeft = downLeft.R + downLeft.G + downLeft.B;<br />
						    if(totalupRight > (total Current + noise))<br />
						    {<br />
								modified.SetPixel(x + 1, y - 1, Color.White);<br />
						    }<br />
						    else if(totalDownRight > (total Current + noise))<br />
						    {<br />
								modified.SetPixel(x - 1, y + 1, Color.White);<br />
						    }<br />
						    else<br />
						        modified.SetPixel(x, y, Color.Black);  <br />
						}<br />
						catch(System.ArgumentException)<br />
						{<br />
						<br />
						}<br />
					}<br />
				}<br />
			}<br />
			<br />
			<br />
		}		



in this method, there are four arguments
1- input picture
2- output picture (that is modified)
3- color
4-noise
this method making edge detection for the face
i want to passing a picture to this method and having the modified picture,.........how can this task accomplished
i will be grateful if the answer be in code
thanks to u in advance

haitham

-- modified at 7:49 Sunday 19th February, 2006
AnswerRe: Detect Edges Pin
Guffa19-Feb-06 2:07
Guffa19-Feb-06 2:07 
GeneralRe: Detect Edges Pin
haytham_mohammad19-Feb-06 5:27
haytham_mohammad19-Feb-06 5:27 
GeneralRe: Detect Edges Pin
Guffa19-Feb-06 6:16
Guffa19-Feb-06 6:16 
AnswerRe: Detect Edges Pin
Christian Graus19-Feb-06 8:26
protectorChristian Graus19-Feb-06 8:26 
AnswerRe: Detect Edges Pin
A.A.19-Feb-06 21:10
A.A.19-Feb-06 21:10 
GeneralRe: Detect Edges Pin
haytham_mohammad20-Feb-06 5:50
haytham_mohammad20-Feb-06 5:50 
Questioncontrol container design time problem Pin
bahaa_sa519-Feb-06 0:24
bahaa_sa519-Feb-06 0:24 
Questionchange a user's group or account type Pin
am2h18-Feb-06 23:36
am2h18-Feb-06 23:36 
QuestionwseAbout "WebBrowser" control Pin
zhouyinhui18-Feb-06 23:28
zhouyinhui18-Feb-06 23:28 
QuestionGetting progress of a Method Pin
emran83418-Feb-06 21:00
emran83418-Feb-06 21:00 
AnswerRe: Getting progress of a Method Pin
Stanciu Vlad18-Feb-06 22:07
Stanciu Vlad18-Feb-06 22:07 
QuestionPropery Grid Pin
deepscyberpulse18-Feb-06 18:56
deepscyberpulse18-Feb-06 18:56 
QuestionForm Count Pin
deepscyberpulse18-Feb-06 18:54
deepscyberpulse18-Feb-06 18:54 
QuestionMemory Reading Pin
Expert Coming18-Feb-06 17:55
Expert Coming18-Feb-06 17:55 
AnswerRe: Memory Reading Pin
Sean8918-Feb-06 18:19
Sean8918-Feb-06 18:19 
QuestionLink label transparency... Pin
Kasic Slobodan18-Feb-06 16:27
Kasic Slobodan18-Feb-06 16:27 
AnswerRe: Link label transparency... Pin
Joshua Quick18-Feb-06 17:16
Joshua Quick18-Feb-06 17:16 

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.