I need to do a histogram stretch

后端 未结 3 1601
迷失自我
迷失自我 2021-02-10 02:57

I have an array of BitmapFrames and need to do a histogram stretch. I know this is different from a histogram equalization, and what the final outcome is... sorta. the problem i

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-10 03:44

    Don't forget to consider float. So a slight modification to dabonz413's answer:

    maxVal = image.maximumValue() # 153
    minVal = image.minumumValue() # 84
    dynamic = maxVal-minVal
    for pixel in image.Pixels():
        newPixel = ((float) (pixel-minVal)/dynamic)*255
    

提交回复
热议问题