この2つのクラスに2つの異なる名前空間を使用するだけで、メソッドの名前を変更しようとはしません-したがって、名前空間は最終的に...次のようになります
myFirstNamecpace.GetPixels(..)
mySecondNamespace.GetPixels(...)
[編集 - OP の質問]
GetPixels の続き - jpeg 画像のピクセル値を取得し、それらを合計して 1 つの整数値にしたいと考えています。しかし、JPEG 画像には赤、緑、青のチャンネルがありますよね?画像ボックスでビットマップとして開きました。では、各ピクセルの 3 つのチャネルすべてをループする必要がありますか、それとも各ピクセルの単一の値を取得するだけですか?
private Color[,] GetPixels_1(string filename)
{
Bitmap myImage1 = (Bitmap)pictureBox1.Image;
//Bitmap bmp = (Bitmap)Bitmap.FromFile(filename);
Color[,] results = new Color[myImage1.Width, myImage1.Height];
for (int y = 0; y < myImage1.Height; y++)
{
for (int x = 0; x < myImage1.Width; x++)
{
results[x, y] = myImage1.GetPixel(x, y);
}
}
return results;
}
[編集済み - 回答] コードを貼り付けるには、上記のエディターの {} を使用します。だから、私はこれを見つけました、HTH: https://stackoverflow.com/a/10128284/1758762
using System.Drawing;
Bitmap img = new Bitmap("*imagePath*");
for (int i = 0; i < img.GetWidth; i++)
{
for (int i = 0; i < img.GetWidth; i++)
{
Color pixel = img.GetPixel(i,j);
if (pixel == *somecondition*)
{
**Store pixel here in a array or list or whatever**
}
}
}