Welcome back.
We implemented this interface image analysis analyzer.
And we said that its only element is analyze function.
So in this video we're gonna learn how to write this analyze and override this analyze function.
Let's start with the image rotation degrees.
Set it to image.image.info dot rotation degrees.
We are getting the rotation degrees of the image.
Then let's start with the background scoop.
We need to use the coroutines to do this job in the background dot launch and as usual, use try and
catch val detections equals to detect here in the next video or next couple of minutes we're gonna use
and uh create this detect function.
Set the listener to detections.
So listener of Detections.
And here set the catch block E of type exception print stack.
Stack trace and finally image dot close.
Also we need to set the listener and empty list.
This analyze a function is a camera X image analysis pipeline that preprocess processes the camera frames
for real time object detection.
Here's that the the importance of this function by capturing the rotations, processes a synchronously
performing detections, returning results and cleaning up the cap the capturing rotation.
We started with the image rotation degrees, stores the current device orientation for proper coordinate
mapping and preprocessor processes asynchronously using launches.
This is the background scoop.
This is the code of the launches detection on a background thread.
To avoid blocking the camera pipeline.
Performs detection using the detect function.
Runs object detection on the current camera frame.
And here the image represents an image proxy, which is an image frame and return results and detections
to the listener.
So here I want from you to understand that we are performing detection on the current camera frame and
below it, sending detections to a listener, for which is the typical UI for drawing bounding boxes,
drawing for drawing, bounding boxes.
Okay, this is the logic behind this analyze function.