Mat image = Cv2.ImRead(path, ImreadModes.AnyDepth);
//Cv2.Threshold(image, image, 45570, 65535, ThresholdTypes.Binary);
int height = image.Rows;
int width = image.Cols;
for (int row = 0; row < height; row++)
{
for (int col = 0; col < width; col++)
{
ushort gray = (ushort)SaturateCast.ToUInt16((image.At<ushort>(row, col)));
if (gray > 45570)
{
image.Set<ushort>(row, col, 65535);
}
}
}
使用OpenCVSharp修改像素的灰度值
最新推荐文章于 2024-06-17 12:04:26 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)