Closed ji-ze closed 12 months ago
I found on Stack Overflow, but it doesn't work.
This works for me
import cv2
cvImg = cv2.imread('test.png')
cvImg2 = cv2.cvtColor(cvImg, cv2.COLOR_BGR2RGB)
from PIL import Image
pilimg = Image.fromarray(cvImg2)
what error do you get?
One other comment to this code snippet:
self.object_filename[:-4]
looks like you want to get rid of the file extension. for this exists a library function os.path.splitext
which I would recommend to use instead. imagine someone uses a tiff file which might have a longer extension. your version would fail but the library function will handle it just fine.
The problem is in a different place:
contourI and contourII are 0.
The problem was with the function for the measure area. It assumed a black and white image, but got an RGB image.
so its solved? we can close the issue?
https://github.com/dkriegner/micro-flakes/blob/8ee5b7d330160a3ebd19f979080583e6dcbbc28e/Detector/find_objects.py#L337-L340