Group Group Group Group Group Group Group Group Group

raywenderlich.com Forums

Video Depth Maps Tutorial for iOS: Getting Started

In this iOS video depth maps tutorial, learn how to harness iOS 11's incredibly powerful video depth maps to apply realtime video filters and create a special effects masterpiece!


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/60-video-depth-maps-tutorial-for-ios-getting-started
1 Like

Hey, from the mask screen can you find the percentage of white and black? If yes can you please help me.

Hi @era_z,

Do you mean pure black and pure white pixels, ignoring the grey ones? Take a look in the file CVPixelBufferExtension.swift. Inside is a function called clamp(). This function loops every single pixel in a CVPixelBuffer and clamps it to be no less than 0.0 or no more than 1.0.

You could write a similar function that counts the number of black pixels (0.0) and the number of white pixels (1.0) and divides those counts by the total number of pixels to get a percentage.

This tutorial is more than six months old so questions are no longer supported at the moment for it. Thank you!