WEBVTT

00:00.120 --> 00:01.000
Welcome back.

00:01.360 --> 00:05.520
We implemented this interface image analysis analyzer.

00:05.520 --> 00:11.480
And we said that its only element is analyze function.

00:11.480 --> 00:18.920
So in this video we're gonna learn how to write this analyze and override this analyze function.

00:18.920 --> 00:22.320
Let's start with the image rotation degrees.

00:22.600 --> 00:28.360
Set it to image.image.info dot rotation degrees.

00:28.480 --> 00:31.760
We are getting the rotation degrees of the image.

00:32.000 --> 00:35.600
Then let's start with the background scoop.

00:35.600 --> 00:45.720
We need to use the coroutines to do this job in the background dot launch and as usual, use try and

00:45.720 --> 00:57.320
catch val detections equals to detect here in the next video or next couple of minutes we're gonna use

00:57.360 --> 01:01.000
and uh create this detect function.

01:01.040 --> 01:04.240
Set the listener to detections.

01:04.240 --> 01:07.160
So listener of Detections.

01:07.160 --> 01:14.440
And here set the catch block E of type exception print stack.

01:14.560 --> 01:19.960
Stack trace and finally image dot close.

01:20.000 --> 01:25.960
Also we need to set the listener and empty list.

01:26.000 --> 01:38.520
This analyze a function is a camera X image analysis pipeline that preprocess processes the camera frames

01:38.520 --> 01:41.560
for real time object detection.

01:41.600 --> 01:52.400
Here's that the the importance of this function by capturing the rotations, processes a synchronously

01:52.480 --> 02:02.000
performing detections, returning results and cleaning up the cap the capturing rotation.

02:02.160 --> 02:10.840
We started with the image rotation degrees, stores the current device orientation for proper coordinate

02:10.880 --> 02:17.470
mapping and preprocessor processes asynchronously using launches.

02:17.870 --> 02:19.830
This is the background scoop.

02:19.870 --> 02:25.790
This is the code of the launches detection on a background thread.

02:25.790 --> 02:28.830
To avoid blocking the camera pipeline.

02:28.870 --> 02:33.510
Performs detection using the detect function.

02:33.510 --> 02:37.150
Runs object detection on the current camera frame.

02:37.390 --> 02:45.830
And here the image represents an image proxy, which is an image frame and return results and detections

02:45.830 --> 02:47.430
to the listener.

02:47.430 --> 02:57.110
So here I want from you to understand that we are performing detection on the current camera frame and

02:57.230 --> 03:06.510
below it, sending detections to a listener, for which is the typical UI for drawing bounding boxes,

03:06.510 --> 03:10.350
drawing for drawing, bounding boxes.

03:10.390 --> 03:15.270
Okay, this is the logic behind this analyze function.
