繁体   English   中英

什么是MS Office对比算法?

[英]What is the MS Office contrast algorithm?

有谁知道MS Office用于将对比度调整应用于图像的公式?

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

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

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语言

祝好运

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM