1

I am using the following image

enter image description here

I would like to calculate the properties for example area,mean_intensity', 'solidity of the maroon color. I have used some code in python to read the image and convert it in grayscale then Ostu threshold to convert it binary image

image = img_as_ubyte(rgb2gray(io.imread("1.jpg")))
plt.imshow(image, cmap='gray')

from skimage.filters import threshold_otsu
threshold = threshold_otsu(image)

#Generate thresholded image
thresholded_img = image < threshold
plt.imshow(thresholded_img,cmap='gray') 

After applying the little code I got the following binary image

enter image description here

I can see few scattered black pixels around the solid area. First of all, I want to clear those and then Calculate the properties of my Region of Interest which is black.

What could be the next way it can be done. I have seen measure.regionprops() in from skimage. Not sure can I use it here.

Catree
  • 2,477
  • 1
  • 17
  • 24
  • You can use measure.regionprops() from skimage or connectedComponentsWithStats from OpenCV. The former has more properties. – fmw42 May 11 '21 at 15:15
  • Can you write a simple code how measure.regionprops() I can use in my example – user3471773 May 11 '21 at 16:50
  • See https://scikit-image.org/docs/stable/auto_examples/segmentation/plot_regionprops.html and https://scikit-image.org/docs/dev/api/skimage.measure.html#skimage.measure.regionprops and https://stackoverflow.com/questions/51249781/using-regionprops-in-python – fmw42 May 11 '21 at 18:27

0 Answers0