Skip to content

arash-ahmadi/body_measure

 
 

Repository files navigation

alt text

set up environment

run the code step by step

alt text

  • activate conda environment

      cd ./body_measure/src
      conda activate body
    
  • extract pose:

    • this program uses OpenPose to calculate pose, which consists of joint positions and output data to the ouput folder. This module just requires openpose and opencv

    • run: pose_extract.py -i ../data/images -o ../data/pose

    • check the folder ../data/pose for visualization

  • extract silhouette:
    • This program first downloads a Deeplab model, loads it to tensorflow to extract silhouette. Unfortunately, the deeplab silhouete often doesn't fit to the real human contour. To solve it, we refine deeplab contour by applying grab-cut on human body parts independently. To apply grab-cut on each body part, we need two information:

      • a local window around each body part: it is calculated from the pose of each body part.
      • the sure foreground mask and sure background mask:
        • the sure foreground mask for grab-cut operations is calcualted by dilating skeleton adaptively.
        • the sure background mask is calculated by dilating the deepsilhouette with window size of 15
    • run: silhouette.py -i ../data/images/ -p ../data/pose/ -o ../data/silhouette/

    • check the fodler ../data/silhouette for visualization

  • extract body slices and measurement:
    • this program uses the refined silhouette and pose information to calculate body slices. For example, the shoulder landmarks are estimated from the shoulder joints in the front image, or the bust landmarks are estimated based on the contour curvature in the side image.

    • run: body_measure.py -i ../data/images -s ../data/silhouette -po ../data/pose -pa ../data/front_side_pair.txt -o ../data/measurement

    • check the folder ../data/measurement for visualization

run all in one on a single image

  • run: body_measure_util.py -f ../data/images/IMG_1928_front_.JPG -s ../data/images/IMG_1928_side_.JPG -h_cm 165 -o ../data/measurement/
  • check the folder ../data/measurement for visualization

visualize and interpret data

  • this program draws landmark segments calculated from previous step on front and side image and print out their length in centimet. It also print out body measurements estimated from these segments

  • please check the code for information about the output data format

  • run: viz_measurement_result.py -f ../data/images/IMG_1928_front_.JPG -s ../data/images/IMG_1928_side_.JPG -d
    ../data/measurement/IMG_1928_front_.npy

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%