Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Opencv morphological closing gives src data type = 0 is not supported

I'm trying to morphologically close a volume with a ball structuring element created by the function SE3 = skimage.morphology.ball(8). When using closing = cv2.morphologyEx(volume_start, cv2.MORPH_CLOSE, SE) it returns TypeError: src data type = 0 is not supported Do you know how to solve this issue? Thank you

like image 625
David Avatar asked Nov 10 '15 11:11

David


1 Answers

Make sure volume_start is dtype=uint8. You can convert it with volume_start = np.array(volume_start, dtype=np.uint8).

Or nicer: volume_start = volume_start.astype(np.uint8)

like image 161
Daniel Azemar Avatar answered Nov 04 '22 23:11

Daniel Azemar