equalizing person heights in an image

i have been given with a task to automatic equalize heights in an image but i have no idea how to do it
please help.......!
if any one can give me a code for this i wil be very thankful.
Example picture is given below.
and is it really possible in matlab.....?????

Answers (1)

Assuming you have a nice image like this, with white space around all the people, I think the following algorithm should work. I haven't worked much with images in Matlab, so I don't know actual code except where I looked it up.
for each vertical slice, find the lowest non-white pixel
The min of this im_floor
for each vertical slice, find the highest non-white pixel
determine where each person is (e.g., cut at vertical lines where every pixel is white-ish). For each person, store positions as person_left, person_right, person_top (person_bot = floor for all)
extract the boxes containing each person
box{1} = old_img(person_left(1):person_right(1),im_floor:person_top(1))
resize each box to the max height (imresize)
res_box{1} = imresize(box{1},[max_height person_right(1)-person_left(1)])
paste them back in
new_img(person_left(1):person_right(1),im_floor:(max_height+im_floor)) = res_box{1}

3 Comments

zetokai
zetokai on 12 Jan 2020
Edited: zetokai on 12 Jan 2020
Can you plz write a full working code for it plz I am definitely not getting it bcz i just started matlab and have no idea about it Sorry for late reply Amd thanks for answering:) And this is a totally random image However images can be changed as well
Short answer: No, I will not write a full working code for you.
Long answer: There are several reasons why I (and probably anyone else) won't write a full code for this:
  • This is not a trivial question. A very coarse, works-on-this-image version could probably be coded up relatively quickly, but making a full working version given all the possible variation? That's a big project. I don't have time for that.
  • There is a high (near-certain) chance that this will involve me in dishonesty on your part. Am I doing your homework for you? Doing your job? I'm happy to give you suggestions for how to start or improve the code, but I'm not writing it for you. (If I happened to have already solved this problem, and made my code stable and readable, I might put it on the Matlab File Exchange, but that's different)
  • Copying hastily-written code wholesale is a poor way to start learning Matlab. To start getting familiar with the language, you might try https://www.mathworks.com/support/learn-with-matlab-tutorials.html and/or https://www.mathworks.com/help/matlab/getting-started-with-matlab.html.
I'm sorry if you've been given this task without the support necessary to succeed.

Sign in to comment.

Products

Release

R2017b

Asked:

on 9 Jan 2020

Commented:

on 13 Jan 2020

Community Treasure Hunt

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

Start Hunting!