Find Objects And Define circle

Dear ;
I have simulation lock-in thermography data. And on image i want to find circle but images(data) not clear to see circle and i could not find way to solve this problem.
I already wrote some code but it is working just on one data but on the rest it is not accuretly.
Do you have any suggestion or could you show me a way to solve my problem?
In the attached you can see some component image of data .
it is my code :
clc
close
A = PCT_20_1;
subplot(1,3,1)
imshow(A)
title('A')
C = colormap; % Get the figure's colormap.
L = size(C,1);
% Scale the matrix to the range of the map.
Gs = round(interp1(linspace(min(A(:)),max(A(:)),L),1:L,A));
H = reshape(C(Gs,:),[size(Gs) 3]); % Make RGB image from scaled.
subplot(1,3,2)
image(H) % Does this image match the other one?
title('IMAGE (MxNx3)')
H;
D = segmentImage(H);
[B,L] = bwboundaries(D,'noholes');
subplot(1,3,3)
imshow(label2rgb(L, @jet, [.5 .5 .5])),title('colour') %add colour to
title('morphology')
hold on % waited for image
for k = 1:length(B)
boundary = B{k}; %choose coordinat of 'k' using by (X,Y)
plot(boundary(:,2), boundary(:,1), 'w', 'LineWidth', 2);
end
below shows image segmenter code I use to find circle :
function [BW,maskedImage] = segmentImage(RGB)
%segmentImage Segment image using auto-generated code from imageSegmenter app
% [BW,MASKEDIMAGE] = segmentImage(RGB) segments image RGB using
% auto-generated code from the imageSegmenter app. The final segmentation
% is returned in BW, and a masked image is returned in MASKEDIMAGE.
% Auto-generated by imageSegmenter app on 09-Mar-2020
%----------------------------------------------------
% Convert RGB image into L*a*b* color space.
X = rgb2lab(RGB);
% Auto clustering
sz = size(X);
im = single(reshape(X,sz(1)*sz(2),[]));
im = im - mean(im);
im = im ./ std(im);
s = rng;
rng('default');
L = kmeans(im,2,'Replicates',2);
rng(s);
BW = L == 2;
BW = reshape(BW,[sz(1) sz(2)]);
% Clear borders
BW = imclearborder(BW);
% Clear borders
BW = imclearborder(BW);
% Fill holes
BW = imfill(BW, 'holes');
% Create masked image.
maskedImage = RGB;
maskedImage(repmat(~BW,[1 1 3])) = 0;
end

2 Comments

Are the "circles" always in the same place, such that you can use a fixed template/mask? Or can they occur anywhere scattered around the image? Do they always occur in a grid, such that you can get average vertical and horizontal profiles to find peaks? Will there always be a signal, or is it possible that the signal could be missing, like the whole thing just looks like a uniform background? For a robust solution, these need to be answered, otherwise we're solving the question for just one specific image and that algorithm might not perform well over the wider variety of appearances you might encounter.
Dear ;
Normally I have different simulation data (almolst 50) based on different hz.
In those for 50 data, circles at the same place but those data just for training and testing. After testing I will receive different data and i will not know where circles are , how many there are and i will not know r.Sometimes signal could be missing.
BTW i worked with measurement data (10 different data based on different hz). It was nice because there was no paraziyts and circles were clear to detect and find.
My new task is about simulation data and in order to accurace result i will receive a lot of data more;

Sign in to comment.

Answers (0)

Categories

Find more on Mathematics and Optimization in Help Center and File Exchange

Asked:

on 11 Mar 2020

Commented:

on 11 Mar 2020

Community Treasure Hunt

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

Start Hunting!