I have an image and want to make a rectangle around black part which is in the middle of image.
Mostrar comentarios más antiguos
I have an image and want to make a rectangle around black part which is in the middle of image.

Respuestas (2)
Dishant Arora
el 23 de Jun. de 2014
1 voto
Go for connected component labelling and check out for bounding boxes parameter, plot it. For more information check out this demo by image analyst Image Segmentation Tutorial ("BlobsDemo")
1 comentario
abhishek
el 23 de Jun. de 2014
Image Analyst
el 23 de Jun. de 2014
1 voto
What are you starting with? A gray scale image, or that binary image? If you have that binary image, you might want to call imclose() to connect some regions together, then call bwareaopen() to get rid of small noise regions, Then call regionprops and get the centroids and bounding boxes. Find the centroid closest to the center of the image and extract only that one with ismember.
9 comentarios
abhishek
el 23 de Jun. de 2014
Image Analyst
el 23 de Jun. de 2014
Did you try what I said? Why does your binary image in your second image look much, much different than from your original question?
abhishek
el 23 de Jun. de 2014
Image Analyst
el 23 de Jun. de 2014
I don't have robust code for that, which will recognize any objects that doesn't "belong" in the image along the "path" that you want to travel. It would be very difficult, especially if the floor has different patterns and colorations.
abhishek
el 24 de Jun. de 2014
Image Analyst
el 24 de Jun. de 2014
[rows, columns] = size(binaryImage);
midx = columns/2; % Compute center of image.
midy = rows/2;
% Get centroids
labeledImage = bwlabel(binaryImage);
measurements = regionprops(labeledImage, 'Centroid');
abhishek
el 25 de Jun. de 2014
Image Analyst
el 25 de Jun. de 2014
Can't you just use the Pythagorean theorem? Or hypot()?
Categorías
Más información sobre Contrast Adjustment en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


