OpenCV / EmguCV 上限为 255,即使图像深度为 UInt16
OpenCV / EmguCV capping at 255 even though image depth is UInt16
我正在使用深度为 UInt16 (ushort) 的 EmguCV 在 C# 中创建一个图像对象。
然后我用线性渐变填充图像,行索引越高,值就越大。
我不明白的是,值 255 会产生 100% 的白色像素。但是我已经指定了 16 位的深度,据我所知,应该使用 65,535 来表示白色。我发现所有大于或等于 255 的东西都是白色的。
var image = new Image<Gray, UInt16>(255, 255);
for (int column = 0; column < image.Width; column++)
{
for (int row = 0; row < image.Height; row++)
{
image.Data[row, column, 0] = (UInt16)row;
}
}
image.Save("temp.jpg");
意外结果:
我错过了什么?我如何创建图像并用 0 - 65,535 之间的值填充它实际上映射到 0 是黑色,65,535 是白色?
问题是我保存的 JPG 格式不支持 16 位。 PNG 确实如此。
谢谢 Miki 的 。
我正在使用深度为 UInt16 (ushort) 的 EmguCV 在 C# 中创建一个图像对象。 然后我用线性渐变填充图像,行索引越高,值就越大。
我不明白的是,值 255 会产生 100% 的白色像素。但是我已经指定了 16 位的深度,据我所知,应该使用 65,535 来表示白色。我发现所有大于或等于 255 的东西都是白色的。
var image = new Image<Gray, UInt16>(255, 255);
for (int column = 0; column < image.Width; column++)
{
for (int row = 0; row < image.Height; row++)
{
image.Data[row, column, 0] = (UInt16)row;
}
}
image.Save("temp.jpg");
意外结果:
我错过了什么?我如何创建图像并用 0 - 65,535 之间的值填充它实际上映射到 0 是黑色,65,535 是白色?
问题是我保存的 JPG 格式不支持 16 位。 PNG 确实如此。
谢谢 Miki 的