Shape recognition with added noise

10 visualizaciones (últimos 30 días)
Kyle Jenko
Kyle Jenko el 19 de Feb. de 2022
Respondida: Image Analyst el 19 de Feb. de 2022
I am trying to write a program that will recognize shapes. The program works for the png "Stickers" that has no noise but I am having trouble removing the added "noise" in the png "StickersWithNoise." I am having trouble knowing where to begin.
My Shape_recognition.m does the following (you can also see my comments in MATLAB)
  1. Reads picture
  2. Converts the white background to black
  3. Converts the picture from rgb to grayscale
  4. Converts picture from grayscale to binary
  5. Find connected components
  6. Use regionprops to find area and perimeter
  7. Calculate ratio of perimeter/sqrt(area) as suggested by the pdf "The Perimeter-Area Relation"
  8. Determine shape based upon these values

Respuestas (1)

Image Analyst
Image Analyst el 19 de Feb. de 2022
Try getting rid of the purple and brown line like this
[labeledImage, numBlobs] = bwlabel(BW_pic);
% Get rid of the purple line
purpleLine = ismember(labeledImage, 1); % First find purple line. It will be blob #1.
BW_pic(purpleLine) = false; % Then erase it from the binary image.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by