shape detection and classification without regionprop command
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
jason
el 11 de Nov. de 2014
Comentada: Image Analyst
el 19 de Mzo. de 2017
1. A binary (black and white) image with all the shapes in white and background in black. In addition, a number, indicating the classification according to the above numbered descriptors, must be inserted in the center of each shape. A value of zero (0) should be placed in the center of the shape that does not fall into one of the above classifications.
A color image with each shape displayed in a pre-assigned color i.e. instead of inserting a number into each shape they can be displayed in different colors e.g. blue for all circles and yellow for all hexagons. The color black must be assigned to all unclassified shapes. The background of this image must be white.
A binary (black and white) image with all the shapes in white and background in black. In addition, a number, indicating the area (in m2 and 3 decimal places), must be inserted in the center of each shape in the image. A text value of "N/A" should be placed in the center of the shape that does not fall into one of the above classifications. Assume each pixel represents a distance of 1 mm.
In my attached files you would find my progress on each part of the question. I have done most of it, i just need your help to see where i am wrong.
9 comentarios
Image Analyst
el 19 de Mzo. de 2017
Attach YOUR code. I'm attaching my shape detection demos.
Respuesta aceptada
Guillaume
el 11 de Nov. de 2014
Using text on a figure, only displays that text on the figure. It doesn't write it on the original image that you've used to create the figure.
Therefore, if you want all the numbers to be displayed on the final figure. You need to store their position and value until you're ready to write them at the end.
So at the beginning of your script, once you know how many shapes, predeclare a matrix for your centroids and a cell array for your text:
allcentroids = zeros(2, Ne);
texts = cell(1, Ne);
After you display your individual figures, you then store the centroid and text in the corresponding column of the above matrix/cell
allcentroids(:, n) = Centroid';
texts{n} = num2str(a);
Then after you display the final image, you also display the text at the coordinate you saved
figure(99),imshow(img_wk_bw_L_total);
for shapenumber = 1:Ne
text(allcentroids(1, shapenumber), allcentroids(2, shapenumber), texts{shapenumber});
end
11 comentarios
Más respuestas (2)
Ver también
Categorías
Más información sobre Deep Learning with Simulink 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!