【发布时间】:2016-04-15 13:32:04
【问题描述】:
我正在读取图像并在蓝色通道上进行一些处理,而不更改红色或绿色通道。
当我完成蓝色通道的处理后,我将三个通道合并为一个 RGB 图像。当我使用 imshow 查看频道时,一切都很好,我可以看到我所做的更改只影响蓝色频道,它们不会影响红色或绿色频道。
到目前为止,一切都很好!
但是当我使用 imwrite 保存图像时,生成的图像略有不同,因为在蓝色通道上所做的更改似乎会传播到红色和绿色通道,这就像 imwrite 在3 个频道:
image = imread('image.jpg', IMREAD_COLOR);
split(image, channels);
// Create some changes on channels[0]
merge(channels, 3, image);
// Up to this point every thing is alright
imwrite("modified.jpg", image); // Image changes when written;
有没有办法避免这种行为?
【问题讨论】: