object shape detection from the image.
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Naishil shah
el 11 de Oct. de 2013
Comentada: Image Analyst
el 3 de Dic. de 2013
Hello, I want to detect the shape from the attached image.Please help me to detect the shape from the image.Here is the image link(imgur.com/cpNL9oH)and i want to detect the irregular shape from this image and from this another image(imgur.com/JvRCD0g)i want to detect the circle shape.Like this(<http://imgur.com/tUtUvNM).This> is a mammogram photo. I did some segmentation operation.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150586/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150587/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150588/image.jpeg)
0 comentarios
Respuesta aceptada
Image Analyst
el 25 de Nov. de 2013
I'm not even sure where the mass starts and stops. I suggest you consult the literature http://iris.usc.edu/Vision-Notes/bibliography/contentsmedical.html#Medical%20Applications,%20CAT,%20MRI,%20Ultrasound,%20Heart%20Models,%20Brain%20Models for algorithms.
0 comentarios
Más respuestas (1)
Naishil shah
el 2 de Dic. de 2013
1 comentario
Image Analyst
el 3 de Dic. de 2013
Try this:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures if you have the Image Processing Toolbox.
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
% Read in a standard MATLAB color demo image.
folder = 'C:\Users\shah\Documents';
baseFileName = 'cc1.jpg';
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName)
if ~exist(fullFileName, 'file')
% Didn't find it there. Check the search path for it.
fullFileName = baseFileName; % No path this time.
if ~exist(fullFileName, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
rgbImage = imread(fullFileName);
% Get the dimensions of the image. numberOfColorBands should be = 3.
[rows, columns, numberOfColorBands] = size(rgbImage);
% Display the original color image.
subplot(2, 2, 1);
imshow(rgbImage);
title('Original Color Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Get binary image of the green rectangle
binaryImage = redChannel < 200 & greenChannel > 200 & blueChannel < 200;
% Display the image.
subplot(2, 2, 2);
imshow(binaryImage);
title('Binary Image', 'FontSize', fontSize);
% Fill the rectangle
binaryImage = imfill(binaryImage, 'holes');
% Get rid of small things
% binaryImage = bwareaopen(binaryImage, 1000);
% Get the convex hull
binaryImage = bwconvhull(binaryImage, 'objects');
% Display the image.
subplot(2, 2, 3);
imshow(binaryImage);
title('Binary Image', 'FontSize', fontSize);
% Measure areas
measurements = regionprops(binaryImage, 'Area', 'BoundingBox');
% Take the largest one
allAreas = [measurements.Area];
[sortedAreas, indexes] = sort(allAreas, 'Descend');
% Get it's bounding box.
boundingBox = measurements(indexes(1)).BoundingBox;
% Crop the image
croppedImage = imcrop(rgbImage, boundingBox);
% Display the cropped color image.
subplot(2, 2, 4);
imshow(croppedImage);
title('Cropped Color Image', 'FontSize', fontSize);
Ver también
Categorías
Más información sobre Image Data Workflows en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!