[英]What is the MS Office contrast algorithm?
Does anyone know what formula MS Office uses to apply contrast adjustments to image? 有谁知道MS Office用于将对比度调整应用于图像的公式?
It looks like the quadratic function, but I couldn't discover it. 它看起来像二次函数,但我找不到它。
Not too sure what formula they use. 不太确定他们使用什么公式。 I doubt you'll find out either since nothings opensource but here is code I use for contrast adjustment:
我怀疑您会发现这两者,因为没有什么开源,但这是我用于对比度调整的代码:
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)
}
This works really well for me. 这对我来说真的很好。
Note 注意
this assumes your pixel intensity values are on a scale of 0 to 1. If on a 255 scale, change lines im = ((im-0.5*255)*c)+0.5*255
and im[im>255] = 255
这假定您的像素强度值在0到1的范围内。如果在255的范围内,
im = ((im-0.5*255)*c)+0.5*255
和im[im>255] = 255
the function above is in R language 上面的功能是R语言
Good luck 祝好运
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.