to divide the silhouette image into segments

1 view (last 30 days)
{ https://www.dropbox.com/sh/m50igo9rqc4efrp/AAAdjdaSSvoAnewmIgpCCGbYa?dl=0 }
The above link contains image file of silhouette. I want to divide the silhouette image into six segments.Could you help me with the matlab code for doing so .I'm new to image processing.
The only hint i'm having is that the area above the centroid is considered upper body and area below as lower body.Next, one third of the upper body is divided as the head and neck. The remaining
two thirds of the upper body are classified as the torso. The lower body is divided into
two portions – (i) hips and thighs (ii) lower legs and feet with the ratio one to two.
Again, the centroid coordinate is used to divide the two portions into the final four segments – (i) right hip and thigh (ii) lower right leg and foot (iii) left hip and thigh and (iv) lower left leg and foot.
THANK YOU.
  2 Comments
akshata k
akshata k on 9 Mar 2015
you can use regionprops function to find the centroid.
And then depending on that use mat2cell function to divide the silhouette
Besly Thomas
Besly Thomas on 15 Apr 2015
I've tried both and was successful in dividing the binary image into four equal segments using mat2cell function.By dividing the total number of rows and columns by two.But when i tried to get the 1/3rd part of the upper body(head), i was getting errors due to the row size problems.
%% program
clc;
clear all;
close all;
% //Read in image im = imread('sil.png');
%// Threshold and clear border im = imclearborder(im > 32);
%// Do opening to clean up some noise im = imopen(im, strel('square', 5));
%//Perform regionprops fI = regionprops(im, 'FilledImage');
%//Initialize cell array out = cell(1, numel(fI));
%// For each region we have... for idx = 1 : numel(fI)
%// Grab the region
img = fI(idx).FilledImage;
%// Get the dimensions of the region
[rows, cols] = size(img);
%// Split up the region into a 2 x 2 grid and place into individual
%// cells
top_half = floor(rows/2);
% head = floor(top_half/3);
% torso = top_half - head;
bottom_half = rows - top_half;
left_half = floor(cols/2);
right_half = cols - left_half;
out{idx} = mat2cell(img, [top_half bottom_half], [ left_half right_half]);
end
%// Now create a figure for each region where we place a portion in its %// respective place in a 2 x 2 grid % close all; for idx = 1 : numel(fI) figure; img = out{idx}.'; for idx2 = 1 : 4 subplot(2,2,idx2); imshow(img{idx2}); end end

Sign in to comment.

Answers (0)

Categories

Find more on Image Processing and Computer Vision in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!