IT Community - Software Programming, Web Development and Technical Support

GRB Value

This is a discussion on GRB Value within the C# Programming forums, part of the Software Development category; Hi, I am working on project where I have to calculate the value RGB value of particular pixel. I make ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 01-02-2008, 11:29 PM
Mramesh Mramesh is offline
D-Web Sr.Programmer
 
Join Date: Sep 2007
Location: Chennai
Posts: 106
Mramesh is on a distinguished road
Send a message via MSN to Mramesh
Default GRB Value

Hi,
I am working on project where I have to calculate the value RGB value of particular pixel. I make a function in C#. Please check, Is there any error in function. What I am trying to get is pass the cordinate of X and Y and I want the corresponding RGB value of particular Cordinate.



Code:
Public Double GetRGBValue(int X, int Y)
{
Bitmap grayscale=(Bitmap)pioOriginal.Image.Clone("Path of Image Saved");
Color color = grayscale.GetPixel(X,Y);
Double graycolorVal= (color.R + Color.G + color.B)/3;
Return graycolarVal;
}

And I want to call like this:

lbl.text=GetRGBValue(144,49);
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-03-2008, 02:02 AM
$enthil $enthil is offline
D-Web Sr.Programmer
 
Join Date: Apr 2007
Posts: 162
$enthil is on a distinguished road
Smile Re: GRB Value

Can you plz figure out the error message you are facing?

and GetRGBValue() function returns a double value and in the below line you are storing the return value in lbl.text which accepts only string.

lbl.text=GetRGBValue(144,49);
__________________
$enthil
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-03-2008, 02:22 AM
it.wily it.wily is offline
D-Web Programmer
 
Join Date: Jul 2007
Posts: 89
it.wily is on a distinguished road
Cool Re: GRB Value

Try this function

Quote:
public Double GetRGBValue(int X, int Y)
{
Bitmap grayscale = new Bitmap(@"Path of Image Saved");
Color color = grayscale.GetPixel(X,Y);
Double graycolorVal= (color.R + color.G + color.B)/3;
return graycolorVal;
}
Store the return value like this

Double rgbval = GetRGBValue(150,10);
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-19-2008, 11:22 PM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Default Re: GRB Value

if i get the value from all pixels of an image ..for change the effects of an image....it should be slow right?
__________________
The KINGMAKER
Makes Every Thing Possible

Stuffs (My Blog)

Last edited by kingmaker : 01-20-2008 at 08:19 PM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 09:06 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0