0

我正在用 C# 开发一个应用程序,将 COLOR 图像转换为灰度图像切片。我使用以下代码将彩色图像转换为灰度。

public void grayscale()
    {
        gray = Cv.CreateImage(src.Size, BitDepth.U8, 1);
        Cv.CvtColor(src, gray, ColorConversion.RgbToGray);
        Cv.SaveImage("3.jpg", gray);
    }

现在的问题是我想确定像素值并将其设置为 0 或 255。我不知道如何获取灰度图像的像素值。你能帮我么。提前致谢。

4

1 回答 1

0

In opecv c++ there's get2D function that returns the color. I assume that c# has something similar.

Anyway, it may be easier to get the same result using one or more threshold() and maybe boolean operations (and,or,not)

于 2014-02-02T20:53:42.113 回答