Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

TLDR;

ThresholdedImage=(Original<ThresholdsMAX & Original>ThresholdsMIN) * Original

Ok,

I have still to figure out why the results are not consistent between each function call (help?) but my method of thresholding and masking seems to be either horrendously outdated or just plain wrong.

I was looking for methods on how to perform thresholding, and the closest thing I found was by using the cv2.inRange() function. Furthermore, my method of applying a mask was to do a cv2.bitwise_and() comparison on the original image whilst using a mask argument using image from previous operation (see details in main post).

This was overly complicated, whereas the code I needed was simply:

ThresholdedImage=(Original<ThresholdsMAX & Original>ThresholdsMIN) * Original

Where ThresholdedImage retains original background.

Hope this helps someone else...

TLDR;

ThresholdedImage=(Original<ThresholdsMAX & Original>ThresholdsMIN) * Original

LONG VERSION;

Ok,

I have still to figure out why the results are not consistent between each function call (help?) but my method of thresholding and masking seems to be either horrendously outdated or just plain wrong.

I was looking for methods on how to perform thresholding, and the closest thing I found was by using the cv2.inRange() function. Furthermore, my method of applying a mask was to do a cv2.bitwise_and() comparison on the original image whilst using a mask argument using image from previous operation (see details in main post).

This was overly complicated, whereas the code I needed was simply:

ThresholdedImage=(Original<ThresholdsMAX & Original>ThresholdsMIN) * Original

Where ThresholdedImage retains original background.

Hope this helps someone else...