-
Notifications
You must be signed in to change notification settings - Fork 21
White Point Select
White point selection works by changing all pixel values above the integer value whitePoint
into 255
and then mapping the rest of pixels which are currently in range [0, whitePoint] to the range [0,255].
The first of the above mentioned two operations is achieved using THRESH_TRUNC type thresholding.
Desired thresholding in Python is acheived by following code,
_,img = cv.threshold(img, whitePoint, 255, cv.THRESH_TRUNC)
Java code for the above mentioned thresholding operation,
Imgproc.threshold(processedImg, processedImg, whitePoint, 255, Imgproc.THRESH_TRUNC);
Now, in the next step we have to map the pixel values. When coding on Python, we have to take care that numpy arithmetics are modulo type i-e any value exceeding 255 in 'uint8' type moves towards 0. Hence, such map operations in Python require type conversion to 'int32' and then back to default image type i-e 'uint8'.
Whereas, in Java we don't require any such type conversions as arithmetics provided by OpenCV Core are saturation based i-e any value exceeding 255 saturates to 255.
Desired map operation is implemented the same way as discussed in blackPoint page hence completing the white point selection operation successfully !
email id : [email protected]