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?

1 visualización (últimos 30 días)

Respuesta aceptada

Image Analyst
Image Analyst el 11 de En. de 2015
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.

Más respuestas (0)

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by