constrast enhancement for browser image
This commit is contained in:
@@ -60,8 +60,12 @@ func GTiffToJPG(ftiff, fjpg string, reversed bool) error {
|
||||
channels := gocv.Split(img)
|
||||
for i, ch := range channels {
|
||||
switch config.GCONFIG.BrowserImg.Enhancement {
|
||||
case NoEnhancement:
|
||||
case StretchToMinimumMaximum:
|
||||
case StretchToCumulativeCutMinMax:
|
||||
channels[i] = cumulativeCountCutEnhancement(ch,
|
||||
config.GCONFIG.BrowserImg.CumulativeCutLower,
|
||||
config.GCONFIG.BrowserImg.CumulativeCutUpper)
|
||||
ch.Close()
|
||||
default:
|
||||
minVal, maxVal, _, _ := gocv.MinMaxLoc(ch)
|
||||
ce := NewContrastEnhancement(int(minVal), int(maxVal))
|
||||
for y := 0; y < height; y++ {
|
||||
@@ -71,12 +75,8 @@ func GTiffToJPG(ftiff, fjpg string, reversed bool) error {
|
||||
ch.SetShortAt(y, x, int16(value))
|
||||
}
|
||||
}
|
||||
case StretchToCumulativeCutMinMax:
|
||||
channels[i] = cumulativeCountCutEnhancement(ch,
|
||||
config.GCONFIG.BrowserImg.CumulativeCutLower,
|
||||
config.GCONFIG.BrowserImg.CumulativeCutUpper)
|
||||
ch.Close()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
img8bit := gocv.NewMat()
|
||||
|
||||
Reference in New Issue
Block a user