- Apply the dilation morphological transformations on the inverted binary mask obtained after “otsu thresholding”.
- Suppress the light structure connected to image border using the “imclearborder” function.
- Fill image region and holes using the “imfill” function.
- To further improve the cell detection, detect the largest white connected component and create a mask for it. Use the “bwlabel” and “regionprops” function for this purpose.
pixel intensity gradient makes object detection by binary image segmentation fail
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hy, I'm using Otsu's segmentation for the transversion of a greyscale image to a binary image but In some images I encounter a problem. The oocyte that needs to be detected has a high intensity gradient and this is the reason why often only half of the oocyte is detected by means of Otsu's method.
Is there a way to preprocess your image in such a way that the oocyte is detected as 1 entity?
Thanks
0 commentaires
Réponses (2)
VINAYAK LUHA
le 6 Oct 2023
Hi Quinten,
It is my understanding that you have an image of an oocyte cell, on which you are applying the “otsu thresholding” method to obtain a binary image of the cell, However due to high variation in pixel intensity inside the cell, the method fails and detects it only partially. Hence, you want to know a robust method to detect the cell as a whole.
Follow the below pointers to postprocess the mask to detect the cell as a whole:
Refer to the following code snippet to postprocess the mask to detect the cell as a whole:
image = imread('PathToImgFile');
grayImage = rgb2gray(image);
threshold = graythresh(grayImage);
binaryImage = imbinarize(grayImage, threshold);
binaryImage=~binaryImage;
se = strel('disk', 2);
binaryImage = imdilate(binaryImage, se);
binaryImage = imclearborder(binaryImage);
binaryImage = imfill(binaryImage, 'holes');
imshow(binaryImage)
labeledImage = bwlabel(binaryImage);
props = regionprops(labeledImage, 'Area');
areas = [props.Area];
[~, index] = max(areas);
largestRegionMask = labeledImage == index;
imshow(largestRegionMask)
Improved binary mask for the cell based on the above pointers.
Refer to the following links for more details on functions used in the code snippet:
Hope this helps in extracting the cell as a whole after “otsu thresholding”.
Regards,
Vinayak Luha
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!