I currently have the salience map of an image below, the spectral saliency and fine grained saliency images are below obtained by the following code:
import cv2
imgpath = r'Content Image.jpg'
image = cv2.imread(imgpath)
width = 350
height = 450
dim = (width, height)
# resize image
resized = cv2.resize(image, dim, interpolation = cv2.INTER_AREA)
saliency = cv2.saliency.StaticSaliencySpectralResidual_create()
(success, saliencyMap) = saliency.computeSaliency(resized)
saliencyMap = (saliencyMap * 255).astype("uint8")
cv2.imshow("Image", resized)
cv2.imshow("Output", saliencyMap)
cv2.waitKey(0)
cv2.destroyAllWindows()
saliency = cv2.saliency.StaticSaliencyFineGrained_create()
(success, saliencyMap) = saliency.computeSaliency(resized)
All of these make sense and I understand why they were obtained.
However, when I try to get the threshold map using the code below:
ret, threshMap = cv2.threshold(saliencyMap.astype("uint8"), 120, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)
cv2.imshow("Image", resized)
cv2.imshow("Output", saliencyMap)
cv2.imshow("Thresh", threshMap)
cv2.waitKey(0)
I obtain the following image:
Not quite sure why this is the case since I'm pretty sure I've following everything that I have found online, any help is greatly appreciated.