I have a program that detects floors, so the floors I detect are removed and become a transparent png, but there are still black lines around the edges
src = cv2.imread(file_name)
tmp = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)
_,alpha = cv2.threshold(tmp,0, 255, cv2.THRESH_BINARY)
b, g, r = cv2.split(src)
rgba = [b,g,r, alpha]
dst = cv2.merge(rgba,1)
You can mitigate the effect of the black transition line in Python/OpenCV/Skimage by antialiasing the alpha channel as follows:
Input:
Result: