2

有谁知道 MS Office 使用什么公式对图像应用对比度调整?

它看起来像二次函数,但我找不到它。

4

1 回答 1

0

不太确定他们使用什么公式。我怀疑你会发现,因为没有开源,但这里是我用于对比度调整的代码:

function(im, contrast=10){
   # Get c-value from contrast
   c = (100.0 + contrast) / 100.0
   # Apply the contrast
   im = ((im-0.5)*c)+0.5
   # Cap anything that went outside the bounds of 0 or 1 
   im[im<0] = 0
   im[im>1] = 1
   # Return the image
   return(im)
}

这对我来说真的很好。

笔记

这假设您的像素强度值在 0 到 1 的范围内。如果在 255 范围内,请更改线条im = ((im-0.5*255)*c)+0.5*255im[im>255] = 255

上面的函数是R语言的

祝你好运

于 2013-05-01T16:44:45.447 回答