object shape detection from the image.
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Naishil shah
il 11 Ott 2013
Commentato: Image Analyst
il 3 Dic 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.
0 Commenti
Risposta accettata
Image Analyst
il 25 Nov 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 Commenti
Più risposte (1)
Naishil shah
il 2 Dic 2013
1 Commento
Image Analyst
il 3 Dic 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);
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!