C# 我需要知道什么是最高和最低像素之间的两个图像在WPF与C

C# 我需要知道什么是最高和最低像素之间的两个图像在WPF与C,c#,wpf,bitmap,pixel,C#,Wpf,Bitmap,Pixel,我将每个图像的像素存储在Col1和Col2中。我如何知道哪一个像素是最高的,并将其放入第三个图像中 我对最高像素的定义为本视频中的por mayor结果: 我还想知道如何在视频中为最低像素por mayor做到这一点 private void RadioButton_Checked(object sender, RoutedEventArgs e) { WriteableBitmap imagen1bmp; WriteableBitmap imagen2bmp; W

我将每个图像的像素存储在Col1和Col2中。我如何知道哪一个像素是最高的,并将其放入第三个图像中

我对最高像素的定义为本视频中的por mayor结果:

我还想知道如何在视频中为最低像素por mayor做到这一点

   private void RadioButton_Checked(object sender, RoutedEventArgs e)
{
    WriteableBitmap imagen1bmp;
    WriteableBitmap imagen2bmp;
    WriteableBitmap imagencombinada;
    int x, y;
    imagen1bmp = (WriteableBitmap)laimagen1.Source;
    imagen2bmp = (WriteableBitmap)laimagen2.Source;


    for (y = 0; y < imagen1bmp.Height; y++)
    {
        for (x = 0; x < imagen1bmp.Width; x++)
        {
            //Get both colors in the pixel point
            Color col1 = LeePixel(imagen1bmp, x, y);
            Color col2 = LeePixel(imagen2bmp, x, y);


        }
        UpdateLayout();
    }
    UpdateLayout();
}

所以首先要做的是根据你的定义理解最高像素是什么。从视频的结果来看,这似乎是原始RGB值的比较。所以基本上你选择红色最多的颜色,如果它等于绿色最多的颜色,那么就选择蓝色最多的颜色

要获取颜色的原始值,您需要调用该方法以获得RGB。一个例子是:

Color col3; //the color for the output image for this pixel
if(col1.toArgb()>col2.toArgb())
    col3=col1;
else
   col3=col2;
对于最低颜色,您只需在矫揉造作中交换col1和col2即可


至于将输出写入另一个图像,您似乎已经使用该像素创建了一些自定义方法,因此我不确定如何以适合您的程序的方式执行该操作。

您对最高值的定义是什么?将像素值与原始像素值进行比较几乎没有任何意义。你能更好地解释一下你想做什么吗?Ok在文章开头的视频中。