Stuart’s MATLAB Videos

Watch and Learn

Writing A Script to Automate the Cropping of Many Photos Using Face Detection

Posted by Stuart McGarrity,

My colleague Tim makes a video presentation of new hires joining MathWorks for each quarterly company meeting. He likes to use uniformly cropped photos of staff members, similar to this one of when I joined 20 years ago today (I was more pixelated in those days).

But this can be time consuming to do manually, especially when we hire more than 100 staff members a quarter. So he asked if I could automate it for him. Here is my first attempt to build a script to do that.

Features covered in this code-along style video include:

  • vision.CascadeObjectDetector System object, from Computer Vision System Toolbox for the face detection
  • imread, imwrite
  • tables, and dir for extracting multiple files for processing in a loop

Follow me (@stuartmcgarrity) if you want to be notified via Twitter when I post.

Play the video in full screen mode for a better viewing experience. 

Add A Comment

Your email address will not be published. Required fields are marked *

What is 5 + 8 ?

Preview: hide