Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I'm working on a windows universal app with visual studio 2015. But I meet the error when I tried to use GetPixel in System.drawing.Imaging. I can't find the solution for this problem. Anyone has met the same problem and have a solution?
Thanks in advance!



C#
Color imagecolor;
float[,] imagegray = new float[image.Width, image.Height];
for (int i = 0; i < image.Width; i++)
{
    for (int j = 0; j < image.Height; j++)
    {
        imagecolor = image.GetPixel(i, j);
        imagegray[i, j] = 0.299f * imagecolor.R + 0.587f * imagecolor.G + 0.114f * imagecolor.B;
    }
}
Posted
Updated 30-Aug-15 21:51pm
v3
Comments
OriginalGriff 31-Aug-15 3:47am    
Perhaps showing us the code that generates the problem might help?
Nicholas Chen 31-Aug-15 3:53am    
Ok, questions has been updated. Thanks for your suggestion.
sreeyush sudhakaran 2-Sep-15 4:38am    
You need to browse and add refrence from .NET assemblies?

1 solution

You need to browse and add refrence from .NET assemblies?

It is in System.Drawing

Refer :

https://msdn.microsoft.com/en-us/library/system.marshalbyrefobject(v=vs.110).aspx

https://msdn.microsoft.com/en-us/library/system.drawing.bitmap.getpixel(v=vs.110).aspx

http://stackoverflow.com/questions/16390148/getpixel-method-is-not-found
 
Share this answer
 
v2
Comments
Nicholas Chen 4-Sep-15 22:50pm    
Thanks a lot for your answer.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900