i want to create a Saliency Map based on itti model via OpenCV(Python). what i'm doing is that: 1- first i change image color space from RGB to LAB color space 2- for each color channel, i create a Pyramid with 6 level 3- from bigger image to smaller, first i make them a fixed size, then differ them via cv2.subtract command.
What i expect is that, in each step of differencing, i should lose details and focus on salient regions but what a get is a black screen. in fact, subtracting removes all image data.
this is my code:
import cv2 import numpy as np sign = cv2.imread("sign.jpg") #size of image height = np.size(sign, 0) width = np.size(sign, 1) #converting LAB color space lab = cv2.cvtColor(sign, cv2.COLOR_BGR2LAB) #extracting color channels l= lab[:,:,0] a= lab[:,:,1] b= lab[:,:,2] a_channel = a.copy() b_channel = b.copy() a_prm = [a_channel] b_prm = [b_channel] for i in xrange(6): a_channel = cv2.pyrDown(a_channel) b_channel = cv2.pyrDown(b_channel) a_prm.append(cv2.resize(a_channel, dsize=(width,height))) b_prm.append(cv2.resize(b_channel, dsize=(width,height))) a_map = a_prm for i in range(1,6): print(i) a_map = cv2.subtract(a_map,a_prm[i]) cv2.imshow('a_map',a_map)