Reputation: 3177
I have an image of specimen that has 3 regions of interest as the white areas. I would like to estimate area of each region of interest.
My segmentation code is
image1 = cv2.imread('/content/1622542016610 copy.jpg')
img_gray1 = cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY)
ret, thresh1 = cv2.threshold(img_gray1, 120, 250, cv2.THRESH_BINARY)
contours, hierarchy = cv2.findContours(thresh1, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)
image_copy1 = image1.copy()
cv2.drawContours(image_copy1, contours, -1, (0, 255, 0), 2, cv2.LINE_AA)
plt.imshow(image_copy1)
plt.title('LIST')
plt.show()
It could not give a very good segmentation as I expected, especially on the below left and below right. May I have your suggestions for
The original image is this image.
Upvotes: 0
Views: 484
Reputation: 1803
I think this solution needs two steps for the ideal segmentation.
The 1st step is the segmentation of only the Petri dish.
The next step is binarization of the Petri dish area.
2 steps are all binarization with different threshold values.
I think the 1st threshold value might be 40-45.
The 2nd threshold value must be determined using a histogram of the Petri dish area.
The final step is the identification and measuring of white areas.
PS. Q: Does the number of pixels in a region represent the area (in physical measurement)?
A: Yes. If you know the diameter of this Petri dish, you can calculate the actual area of the white areas.
Upvotes: 0