How do I get the area of a zone covered by disconnected blobs in an image?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Image Analyst
le 4 Jan 2024
Modifié(e) : Image Analyst
le 4 Jan 2024
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.
Réponses (1)
Sulaymon Eshkabilov
le 3 Jan 2024
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);
fprintf('Area covered by Pins: %d \n', Pin_Area);
fprintf('Area covered by Transistors: %d \n', Transistor_Area);
% Display the segmented chip area
figure;
imshow(CB_Img);
title('Segmented Chip Area');
0 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!