Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

I have generated a image which is having some dots & their area I've calculated by regionprops, now I've to compare the areas of small dots and if they are same then i'll have to get their amplitude from colour image

1 Ansicht (letzte 30 Tage)
clc
clear
% take data frm xcl and look for selected area
Amp=xlsread('C:\Users\AMIT\Desktop\CB\excel\4\Cast Billet Amp Data-(4-4).xls');
Th=xlsread('C:\Users\AMIT\Desktop\CB\excel\4\Cast Billet Thickness Data-(4-4).xls');
Z=Amp(2:1:514,2:1:256);
T=Th(2:1:514,2:1:256);
for i=1:1:513
for j=1:1:255
if ((Z(i,j)>=50) && (Z(i,j)<=70)) % selecting high amp regions
A(i,j)=Z(i,j);
B(i,j)=T(i,j);
else
A(i,j)=0;
B(i,j)=0;
end
end
end
for i=1:1:513
for j=1:1:255
C(i,j)= A(i,j);
D(i,j)= B(i,j);
end
end
axes('FontSize',20);
image(A');figure
axes('FontSize',20);
imagesc(B');figure
for i=1:1:513
for j=180:1:225
if B(i,j)>=6.5 && B(i,j)<=7
A4(i,j)=C(i,j);
else
A4(i,j)=0;
end
end
end
axes('FontSize',20);
imagesc(A4');figure
ylim([120 225])
clc
imagesc(A4');
background = imopen(A4',strel('disk',15));
I2 = A4'- background;
figure, imshow(I2)
I3 = imadjust(I2);
figure, imshow(I3);
level = graythresh(I3); %Threshold the Image
bw = im2bw(I3,level);
C = imcrop(bw);
bw2 = bwareaopen(C,3);
figure, imshow(bw2)
cc = bwconncomp(bw2,8) %Identify Objects in the Image
P=cc.NumObjects;
SP=0.64/4;
defectdata = regionprops(cc, 'all') %Compute Area of Each Object
DA = SP*[defectdata.Area];
[min_area, idx] = min(DA) %Compute Area-based Statistics
[max_area, idx] = max(DA)
nbins = 20; %Create Histogram of the Area
figure, hist(DA,nbins)
title('Histogram of defect Area');
xlabel('Area of defect mm2');
ylabel('Number of defects')
Ylim ([0 50])
DA

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by