INNER CODE UNIT · Python
img_fg
andrewssobral/bgslibrary · tools/fet/fet.py:52
img_fg = cv2.imread(path_fg + file_fg,cv2.IMREAD_GRAYSCALE)
# img_gt = cv2.resize(img_gt, (0,0), fx=0.5, fy=0.5)
# print(img_gt.shape,img_fg.shape)
rows,cols = img_gt.shape
img_fg = cv2.resize(img_fg,(cols,rows))
img_res = np.zeros((rows,cols,3),np.uint8)
for i in xrange(rows):
for j in xrange(cols):
pixel_gt = img_gt[i,j]
pixel_fg = img_fg[i,j]
if(pixel_gt == 255 and pixel_fg == 255):
TP = TP + 1
img_res[i,j] = white
if(pixel_gt == 0 and pixel_fg == 255):
FP = FP + 1
img_res[i,j] = red
if(pixel_gt == 0 and pixel_fg == 0):
TN = TN + 1