Add contrast limiting adaptive histogram equalization (CLAHE) operator (#2726)

This commit is contained in:
Brad Parham
2021-05-23 18:36:04 +02:00
committed by GitHub
parent b69a54fc75
commit 4b6b6189bf
19 changed files with 245 additions and 6 deletions

View File

@@ -243,6 +243,30 @@ Alternative spelling of normalise.
Returns **Sharp**
## clahe
Perform contrast limiting adaptive histogram equalization (CLAHE)
This will, in general, enhance the clarity of the image by bringing out
darker details. Please read more about CLAHE here:
[https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE][8]
### Parameters
* `options` **[Object][2]**
* `options.width` **[number][1]** integer width of the region in pixels.
* `options.height` **[number][1]** integer height of the region in pixels.
* `options.maxSlope` **[number][1]** maximum value for the slope of the
cumulative histogram. A value of 0 disables contrast limiting. Valid values
are integers in the range 0-100 (inclusive) (optional, default `3`)
<!---->
* Throws **[Error][5]** Invalid parameters
Returns **Sharp**
## convolve
Convolve the image with the specified kernel.
@@ -252,7 +276,7 @@ Convolve the image with the specified kernel.
* `kernel` **[Object][2]**
* `kernel.width` **[number][1]** width of the kernel in pixels.
* `kernel.height` **[number][1]** width of the kernel in pixels.
* `kernel.height` **[number][1]** height of the kernel in pixels.
* `kernel.kernel` **[Array][7]<[number][1]>** Array of length `width*height` containing the kernel values.
* `kernel.scale` **[number][1]** the scale of the kernel in pixels. (optional, default `sum`)
* `kernel.offset` **[number][1]** the offset of the kernel in pixels. (optional, default `0`)
@@ -304,7 +328,7 @@ the selected bitwise boolean `operation` between the corresponding pixels of the
### Parameters
* `operand` **([Buffer][8] | [string][3])** Buffer containing image data or string containing the path to an image file.
* `operand` **([Buffer][9] | [string][3])** Buffer containing image data or string containing the path to an image file.
* `operator` **[string][3]** one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.
* `options` **[Object][2]?**
@@ -421,4 +445,6 @@ Returns **Sharp**
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
[8]: https://nodejs.org/api/buffer.html
[8]: https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE
[9]: https://nodejs.org/api/buffer.html

File diff suppressed because one or more lines are too long