I have attached two photos of component. In one of the piece there is a portion cut. Is it possible to produce output with or without comparison with the default using image processing. can someone provide the code?

2 ビュー (過去 30 日間)

採用された回答

Image Analyst
Image Analyst 2015 年 1 月 11 日
Simply take the red channel, threshold it, find the area, and if the area is less than some minimum allowable area, alert the user. Try this
rgbImage = imread(filename);
redChannel = rgbImage(:,:,1);
binaryImage = redChannel < 128; % Whatever...
binaryImage = bwareaopen(binaryImage, 100);
labeledImage = bwlabel(binaryImage, 4);
measurements = regionprops(labeledImage, 'Area');
allAreas = [measurements.Area];
minAllowableArea = 500; % Whatever.
for k = 1 : length
fprintf('Area = %d pixels.', allAreas(k));
if allAreas(k) < minAllowableArea
message = sprintf('Blob #%d is too small at %d pixels', k, allAreas(k));
uiwait(warndlg(message));
end
end
That's untested so you might have to tweak it.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by