Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8908615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:13:34+00:00 2026-06-15T03:13:34+00:00

I’m pretty new to Matlab and have to do some work for a lab.

  • 0

I’m pretty new to Matlab and have to do some work for a lab.
Basically I have to calculate the height of persons in an image. There are some markers next to the persons which I’ve already identified. So now I now converted the image to an binary image: enter image description here

I need the x and y positions of every person in the picture to compare it with the markers I already found.
I tried to iterate over the image and check the surroundings if I’ve already found a person near this coordinates but it does not work, nor it is very “matlab like”. (Performance is also bad because of the loops)

NOTE: I’m not allowed to use most of the “good or sophisticated” functions like imfilter… (I also had to write the conversion to the binary image for example)

I have no idea how I should tackle this problem (other than the method I described above).
I can post my code here but I guess that won’t help answer this question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:13:35+00:00Added an answer on June 15, 2026 at 3:13 am

    If you can use built-ins (or write your own) here’s what I have been thinking of as a partial solution.

    First, invert the image so the people are in white and the background is black. Find the sum of all the rows.

    data = sum(im);
    

    This will give you some noisy data that shows the number of on pixels in each row. If you plot it, the peaks are the people, and the valleys are the areas between them. But there will be a lot of false peaks. To fix this, use convolution like:

    data2 = conv(data,ones(1,50)/50,'same');
    

    A size of 50 seemed to work pretty well. It may differ from image to image, but if they are all more or less like the one above, 50 should work.

    Now you should have a clean set of data showing the peaks where the people are (and specifically the highest points of the people). You can do a single for loop to find those peaks. But don’t start looking for the next peak until you’ve crossed a valley. If it helps you can use the derivative to find where the derivative passes zero (these are the peaks and valleys).

    deriv = (data2(2:end)-data(1:end-1));
    

    But I found that there aren’t always literal zero points on the derivative, so you’ll have too look for sign changes instead.

    There are also public functions out there that you can download to automatically find the peaks.

    So let’s say you have your peaks stored in some vector peaks. Now you know the x location of the person, so isolate the columns and find the first nonzero (the top of the people’s head, and y locations) then subtract that from the total column size to find the height. So for the first peak:

    x = peaks[1];
    y = find(im(:,x),1,'first');
    height = size(im,1)-y;
    

    I think somthing along those lines might work for you. You still need to do some iterating, but not a whole lot.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.