Find an almost circular strip of bright pixels in this image.

This is the problem that I have: I have an image as shown below. I want to find a circular area, which I marked with a red line to display here (this is a special bright ring).

enter image description here

Initially this is what I am doing now: (MATLAB)

binaryImage = imdilate(binaryImage,strel('disk',5)); 
binaryImage = imfill(binaryImage, 'holes'); % Fill holes.
binaryImage = bwareaopen(binaryImage, 20000); % Remove small blobs.
binaryImage = imerode(binaryImage,strel('disk',300));
out = binaryImage;
img_display = immultiply(binaryImage,rgb2gray(J1));
figure, imshow(img_display);

enter image description here

The output, apparently, is cut out on one of the parts of the object (for another image as an input, and not for the one shown above). I want the result to be such that it is symmetrical (its not always an ideal circle when it rotates).

I want to strictly avoid im2bw, because as soon as I binarize, I lose a lot of form information.

This is what I was thinking:

( ) (). , , 50% ( , ). , . ?

,

+4
1

'log'. , , - 2- ( , ), , . , , .

img = im2double(rgb2gray(imread('wheel.png')));
img = imresize(img, 0.25, 'bicubic');

filt_img = imfilter(img, fspecial('log',31,5));
bin_img = filt_img < 0;

subplot(2,2,1);
imshow(filt_img,[]);

% Get regionprops
rp = regionprops(bin_img,'EulerNumber','Eccentricity','Area','PixelIdxList','PixelList'); 
rp = rp([rp.EulerNumber] == 0 & [rp.Eccentricity] < 0.5 & [rp.Area] > 2000);

bin_img(:) = false;
bin_img(vertcat(rp.PixelIdxList)) = true;
subplot(2,2,2);
imshow(bin_img,[]);

bin_img(:) = false;
bin_img(rp(1).PixelIdxList) = true;
bin_img = imfill(bin_img,'holes');

img_new = img;
img_new(~bin_img) = 0;

subplot(2,2,3);
imshow(img_new,[]);

bin_img(:) = false;
bin_img(rp(2).PixelIdxList) = true;
bin_img = imfill(bin_img,'holes');

img_new = img;
img_new(~bin_img) = 0;

subplot(2,2,4);
imshow(img_new,[]);

:

enter image description here

+5

Source: https://habr.com/ru/post/1598051/


All Articles