I currently have a salience map for an image using the code below:
img = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
saliency = cv2.saliency.StaticSaliencyFineGrained_create()
(success, saliencyMap) = saliency.computeSaliency(image)
# cv2.imshow("Image", image)
cv2.imshow("output", saliencyMap)
The output is the salience map below. It is normalized (I believe) and the array only contains values between 0 and 1.
I was wondering if there was a way to put this saliency mask over the image below to get an output image that highlights the salient regions?
I have tried splitting the image into 3 channels and multiplying each channel by the map and then stacking them back together but this hasn't shown to work. The code I tried was:
(B, G, R) = cv2.split(resized)
y = saliencyMap
# cv2.imshow("Blue", B)
# cv2.imshow("Green", G)
# cv2.imshow("Red", R)
# cv2.waitKey(0)
B = B * y.astype(y.dtype)
G = G * y.astype(y.dtype)
R = R * y.astype(y.dtype)
img = cv2.merge((B,G,R))
cv2.imshow("Image", img)
cv2.waitKey(0)
However, the output image I obtained was:
Which is obviously wrong. Any tips or advice?



