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.

2 次查看(过去 30 天)
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 个评论
Image Analyst
Image Analyst 2022-5-24
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?

请先登录,再进行评论。

回答(1 个)

prabhat kumar sharma
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!

类别

Help CenterFile Exchange 中查找有关 Image Processing and Computer Vision 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by