我正在使用 java opencv,这是我正在执行的行。
Imgproc.cvtColor(originalImage, hsvImage, Imgproc.COLOR_BGR2HSV);
Core.inRange(hsvImage, low, high, thresholdImage);
low 和 high 是一些标量值(每个大小为 3)。所以你可以看到我的原始图像有 3 个 channel ,但我的 thresholdImage
只有一个 channel ,为什么?因此,当我尝试显示 thresholdImage
时,我在 JFrame
中看到三个小图像。如何解决这个问题?
最佳答案
事实证明,Core.inRange
将第二个参数(即 Mat
)更改为单 channel 图像。因此,为了获得 3 个 channel ,我需要使用 Imgproc.cvtColor
函数将其重新转换回 3 个 channel 。
关于Java opencv inRange阈值函数使我的图像变成三个不同的图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43905110/