Hi, I have a matlab model that works for the given image. It basically finds the circle within the image and calculates the diameter and area.
1 view (last 30 days)
Show older comments
Hi, I have a matlab model that works for the given image. It basically finds the circle within the image and calculates the diameter and area. However I want this model to work with another type of image in terms of coloring.
The original image the image type that model works with.
The new image is the image type that I want this model to work with.
Thank you
i
1 Comment
Image Analyst
on 24 May 2022
So the circle can be either brighter or darker than the background? Do you have yet a binarization scheme that will give a rough segmentation of the circle disconnected from its background?
Answers (1)
prabhat kumar sharma
on 17 Jan 2024
Hi Burcu,
I understand that you're encountering issues with adapting your model to process images that have a different colour scheme. Whenever you adapt our model to work with images of different types, particularly those with varying colour schemes, making adjustments to the preprocessing steps and techniques is often necessary.
I suggest the following steps:
1. Image Conversion:
Both type of images can be converted first to grayscale for thresholding.
grayImage = rgb2gray(newImage);
2. Binarization: Image segmentation to segment out circle from the background would be really helpful. If the circle is brighter than the background, you can use a global thresholding method like Otsu's method, or if the contrast varies, you might need an adaptive thresholding method:
% Global thresholding using Otsu's method
thresholdValue = graythresh(grayImage);
binaryImage = imbinarize(grayImage, thresholdValue);
% Adaptive thresholding
binaryImage = imbinarize(grayImage, 'adaptive', 'ForegroundPolarity', 'bright', 'Sensitivity', 0.5);
3 .Morphological Operations:
se = strel('disk', 2); % You can adjust the size and shape according to your requirements.
binaryImage = imopen(binaryImage, se);
If there are small artifacts or noise in the binarized image, you can use morphological operations like imdilate, imerode, imopen, or imclose to clean up the binary image:
It's important to visually inspect the intermediate results of each processing step to ensure that the circle is being accurately segmented from the background.
I hope it helps!
0 Comments
See Also
Categories
Find more on Image Processing and Computer Vision in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!