How do I get the area of a zone covered by disconnected blobs in an image?

1 次查看(过去 30 天)
I'm trying to get the following dimensions from a specific image of a chip:
  • the perimeter of the entire chip
  • the area covered by the pins (it's not the sum of every pin's area)
  • the area covered by the transistors (the internal black square)
I've found a solution for first point but I don't have any idea for the last two points.
The image is the following:
  4 个评论
Image Analyst
Image Analyst 2024-1-4
编辑:Image Analyst 2024-1-4
I've read it several times and it's still ambiguous. Anyway I'm glad that @Sulaymon Eshkabilov made the correct assumptions, though he does compute pin area as the sum of the individual pin areas which you explicitly said was not correct. Since you say it does everything exactly as you want, go ahead and accept his answer.
I'll try to remember not to help you anymore. In fact I went back and deleted my answer I posted a few minutes ago to your latest question about spatial calibration. Good luck though.
By the way, his answer is actually totally wrong. There are several errors in it that give wrong pixel counts. Did you even do a sanity check on it? How can the pins area be nearly the same area as the entire image? I made some modifications to @Sulaymon Eshkabilov code to show you the blobs that he identified as pins and transistors and here is the result (full code is attached.)
Look at all the white blobs in the left image. That's is what he's calling pins. But perhaps you were able to fix it.
mirko
mirko 2024-1-4
It was a wrong code but he gave me a hint that helped me instead of criticizing my question. Could you please repost your answer on my latest question and help me?

请先登录,再进行评论。

回答(1 个)

Sulaymon Eshkabilov
It will be somewhat like this one:
close all;
clearvars
% Image Import:
I = imread('Chip_image.png');
% Grayscale Conversion:
G_Img = im2gray(I);
figure
imagesc(G_Img)
title('Imported Gray Scaled Image')
% Find a Thresh of the chip area from background
B_Img = G_Img > 90; % Adjust this threshold
% Morphological operations to clean up the binary image:
CB_Img = imclose(B_Img, strel('disk', 5));
% Connected Component Analysis:
CCA = bwconncomp(CB_Img);
stats = regionprops(CCA, 'Area', 'BoundingBox');
% Filter connected components based on area. Still, some adjustment for
% thresholds required
Pin_Threshold = 500;
Transistor_Threshold = 200;
% Initialize variables:
Total_Chip_Area = sum([stats.Area]);
Pin_Area = 0;
Transistor_Area = 0;
% Iterate through connected components
for i = 1:length(stats)
% Check the area and categorize into pins or transistors
if stats(i).Area > Pin_Threshold
Pin_Area = Pin_Area + stats(i).Area;
elseif stats(i).Area > Transistor_Threshold
Transistor_Area = Transistor_Area + stats(i).Area;
end
end
% Display the calc. results:
fprintf('Total Chip Area: %d \n', Total_Chip_Area);
Total Chip Area: 2013878
fprintf('Area covered by Pins: %d \n', Pin_Area);
Area covered by Pins: 2006139
fprintf('Area covered by Transistors: %d \n', Transistor_Area);
Area covered by Transistors: 2743
% Display the segmented chip area
figure;
imshow(CB_Img);
title('Segmented Chip Area');

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by