Distance transform function is not working

Hey, everyone! I am trying to create a watershed algorithm, but the function cv.distanceTransform doesn’t make any sense at all. I mean, the image dist = cv.distanceTransform is the same as original mask

import cv2 as cv
image = cv.imread('path')
low_cube = (120,50,50)
high_cube = (155,255,255)
hsv_im = cv.cvtColor(image, cv.COLOR_BGR2HSV)
hsv_mask = cv.inRange(hsv_im, low_cube, high_cube)
cnt, _ = cv.findContours(hsv_mask, cv.RETR_CCOMP, cv.CHAIN_APPROX_NONE)
c = max(cnt, key=cv.contourArea)
#cv.drawContours(image, c, -1, (0,0,255), thickness=3)
dist = cv.distanceTransform(hsv_mask, cv.DIST_L1, 0)

cv.imshow('win1', hsv_mask)
cv.imshow('win', dist)

do you think seeing the image would matter?

1 Like

can you add your hsv_mask, please ?

Well, i’ve seen a video, where a man displays it and I confused when I couldn’t do this. Now it works, but without displaying. Thank you!