From the course: Code Clinic: Swift

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Request facial data

Request facial data - Swift Tutorial

From the course: Code Clinic: Swift

Start my 1-month free trial

Request facial data

- [Instructor] Now what we're going to do is set up our code by creating a request to process faces within an image. Let's write that inside of a look for faces method. The first thing that we need to do is get the orientation of the image. The reason that we need to do this is because the orientation that we use for detecting faces is of the type CG image property orientation which is a different data type than what a UI image uses for its orientation. So create a variable here called orientation and it's data type is going to be CG image property orientation. And then we're going to use a switch case statement to check the orientation of the image. So switch and we're looking through imageView.image. We'll force unwrap that and then we'll get its image orientation which is of the type UI image orientation. So in the curly braces, we'll check to see if cases.down and if so, orientation will be set to .down. Yes, the value is the same but if you look at the data type, it's CG image…

Contents