Stuart’s MATLAB Videos

Watch and Learn

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

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

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

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.