【发布时间】:2020-12-31 19:56:32
【问题描述】:
当我尝试对 OpenCV 打开的图像使用颜色项目的颜色检测库时,我想我必须将其转换为 RGB。但是当我这样做时,我收到了一个不正确的颜色检查器分割结果。在颜色检查器分割示例的原始示例中,图像打开使用:
COLOUR_CHECKER_IMAGES = [
colour.cctf_decoding(colour.io.read_image("IMG_1967.png"))
]
for image in COLOUR_CHECKER_IMAGES:
plot_image(colour.cctf_encoding(image))
# Detection
SWATCHES = []
# for image in COLOUR_CHECKER_IMAGES:
for swatches, colour_checker, masks in detect_colour_checkers_segmentation(
image, additional_data=True):
SWATCHES.append(swatches)
# Using the additional data to plot the colour checker and masks.
masks_i = np.zeros(colour_checker.shape)
for i, mask in enumerate(masks):
masks_i[mask[0]:mask[1], mask[2]:mask[3], ...] = 1
plot_image(
colour.cctf_encoding(
np.clip(colour_checker + masks_i * 0.25, 0, 1)))
在打开期间解码的图像然后编码以将其用于detect_colour_checkers_segmentation 并显示结果必须对结果图像进行编码。这些都需要很长时间,计算结果导致结果不准确。
我发现最好通过 OpenCV 将图像打开为 BGR 并在detect_colour_checkers_segmentation 中使用它并对结果图像进行编码。
谁能解释一下这是为什么?
【问题讨论】:
-
请实际向我们展示结果。也请考虑提供minimal reproducible example。就目前而言,您的代码不可重现,您的问题有被关闭的风险。
-
请分享您的输入和相应的输出图像。