调整图像部分的亮度

时间:2013-01-20 18:51:53

标签: image matlab image-processing

我是Matlab和图像处理的新手,我知道如果我的图像为I

,我们可以通过以下公式更改图像亮度
newImg=imadjust(I, [low_in high_in], [low_out,high_out]);

它会调整图像的所有像素值,但是如何在图像的某些部分上进行调整,就像我现在在图像中检测到脸部一样,我想改变它的亮度,我该怎样才能使用imadjust

修改

我在二进制掩码中检测到区域。

我完成了,请看答案以及答案中的参考资料。

2 个答案:

答案 0 :(得分:2)

我做到了,

我想改变图像某些区域的亮度,我想要的区域是由二进制掩码mask计算的,所以我做了,首先我只是改变输入图像的亮度{{ 1}},并将结果存储在I中,如此

newImg

然后在我的orignal图像上应用蒙版并存储newImg = imadjust(I, [low_in high_in], [low_out,high_out]); 这样的蒙版区域的值

newImg

Reference

我认为它的内容丰富,而不是任何人,如果你们不会激励我,那么我无法学习,因为人们关闭my thread只是因为我在问问题,而我正在使用相同的Image数据库项目。

答案 1 :(得分:1)

%Suppose these are the coordinates of the rectangle in which the face is detected%
%You can do the following to adjust the brightness of that region

topLeft = 10;
topRight = 50;
bottomLeft = 50;

newImg = I;
newImg(topLeft:bottomLeft,topLeft:topRight) = imadjust(newImg(topLeft:bottomLeft,topLeft:topRight), [low_in high_in], [low_out,high_out]);