필터 지우기
필터 지우기

object shape detection from the image.

조회 수: 2 (최근 30일)
Naishil shah
Naishil shah 2013년 10월 11일
댓글: Image Analyst 2013년 12월 3일
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.

채택된 답변

Image Analyst
Image Analyst 2013년 11월 25일
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.

추가 답변 (1개)

Naishil shah
Naishil shah 2013년 12월 2일
Thank you Image analyst.I want to crop the green
outline portion from the image.Here is the image and i want only inner portion.Image analyst i want to crop it automatically please help me for this.I want output which i am showing you in a different image.
  댓글 수: 1
Image Analyst
Image Analyst 2013년 12월 3일
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);

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by