【发布时间】:2018-06-26 17:50:11
【问题描述】:
我正在尝试使用矩阵运算对图像进行阈值处理,但不是将阈值结果设置为固定值,例如 256 或其他值,而是尝试将结果设置为等于像素值的计算来自另外两个相同大小的图像。所以,例如:
firstImage = img1;
secondImage = img2;
thirdImage = img3;
secondImage(firstImage < 100) = thirdImage(at the same indexes as where the thresholding condition holds true) .* 10;
MATLAB 通常会尝试将整个 thirdImage .* 10 相乘并保存,但我想要的只是那些匹配的特定像素以执行操作并覆盖 secondImage 中的相应值。
如何做到这一点?
【问题讨论】:
-
你已经在问题中自己回答了:
secondImage(firstImage<100)=thirdImage(firstImage<100)*10; -
@SardarUsama 谢谢!如果您想将其写为完整评论,我可以将其标记为答案。
标签: matlab matrix image-thresholding