[英]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*255
和im[im>255] = 255
上面的功能是R語言
祝好運
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.