Photo Stacking in iOS with Vision and Metal

In this tutorial, you’ll use Metal and the Vision framework to remove moving objects from pictures in iOS. You’ll learn how to stack, align and process multiple images so that any moving object disappears. By Yono Mittlefehldt.

Leave a rating/review
Download materials
Save for later
Share
You are currently viewing page 4 of 4 of this article. Click here to view the first page.

Where to Go From Here?

Congratulations! You’ve made it through a lot of concepts in this tutorial. You’re now ready to work your magic in the real world!

However, if you want to try to improve your app, there are a couple of ways to do so:

  1. Use VNHomographicImageRegistrationRequest to calculate the perspective warp matrix to align the captured frames. This should create a better match between two frames, it’s just a bit more complicated to use.
  2. Calculate the mode pixel value instead of the average. The mode is the most frequently occurring value. Doing so will remove all influence of moving objects from the image, as they won’t be averaged in. This should create a cleaner looking output image. Hint: Convert the RGB to HSL and calculate the mode based on small ranges of the hue (H) value.

If you’re interested in more information about Metal, check out Metal Tutorial: Getting Started and the Metal by Tutorials book.

We hope you enjoyed this tutorial, and if you have any questions or comments, please join the forum discussion below!