WEBVTT

00:00.120 --> 00:05.600
We created image capture, preview, executor and camera provider.

00:05.880 --> 00:10.200
Now let's set up the real Android camera.

00:10.360 --> 00:19.200
So as we learned before in the previous section, we need to use the Android view to set up camera X

00:19.240 --> 00:21.120
and camera X is not.

00:21.520 --> 00:27.600
There is no composable or ready made composable for handling the camera preview.

00:27.760 --> 00:37.480
For this, we use the Android view that let us run the the the the camera X widget or view inside our

00:37.480 --> 00:38.480
composables.

00:38.640 --> 00:45.760
Okay, the first parameter is the modifier modifier dot fill maximum size.

00:45.800 --> 00:49.240
The factory equals to context.

00:49.240 --> 00:51.560
And let me start by this.

00:51.600 --> 00:57.600
This is what we've done before and we created in the previous application.

00:57.640 --> 01:00.000
Don't worry we're going to clarify everything.

01:00.160 --> 01:09.270
Preview view pass the context and camera provider future dot add listener inside this camera.

01:09.310 --> 01:10.910
Future dot add listener.

01:11.110 --> 01:17.230
We need to set up the image analyzer and image capture and camera provider.

01:17.230 --> 01:22.710
So we're going to set up the previously created variables and states.

01:22.710 --> 01:27.110
I want from you to focus with me and pay attention.

01:27.150 --> 01:39.350
The first step is the image analyzer val image analyzer equals to image analyzer dot builder dot set

01:39.430 --> 01:43.750
target rotation to surface dot rotation zero.

01:43.910 --> 01:48.750
Set back pressure strategy to image analysis.

01:48.870 --> 01:52.830
Keep only latest dot build dot.

01:53.030 --> 02:00.390
Also, don't worry, we're gonna clarify everything image analysis and pass it before lecture.

02:00.390 --> 02:02.710
There is a mistake here.

02:02.750 --> 02:06.390
Set target rotation, not name.

02:06.550 --> 02:09.980
Don't worry the error here create exception.

02:10.300 --> 02:14.660
And if we hover the mouse there is a returning type.

02:14.780 --> 02:19.300
Um is a view but actually is unit.

02:19.300 --> 02:23.460
So don't worry, we're going to solve it in the next couple of minutes.

02:23.460 --> 02:24.860
But please pay attention.

02:24.980 --> 02:32.860
Image analysis dot builder creates a builder for image analysis.

02:33.020 --> 02:34.900
Set target to rotation.

02:35.100 --> 02:40.460
Sets the image rotation to zero degrees for portrait.

02:40.460 --> 02:44.820
So this is the portrait set back pressure strategy.

02:44.860 --> 02:46.900
Drops all the frames.

02:46.900 --> 02:53.900
Only keeps the most recent one when busy and build function builds.

02:53.900 --> 03:05.100
The image analysis instance also immediately calls on image analysis callback with the build instance.

03:05.420 --> 03:09.420
So this is how we set up the image analysis.

03:09.620 --> 03:13.130
Again guys the purpose here is to configure.

03:13.170 --> 03:22.770
Configure real time image analysis from the camera strategy keeps only latest optimal for ML machine

03:22.770 --> 03:27.930
learning or computer vision tasks when you only need the latest frame.

03:28.090 --> 03:35.810
Since we are not capturing the videos or photos, we just need to keep updating and keep only the latest

03:35.810 --> 03:36.450
frame.

03:36.650 --> 03:45.810
Target rotation ensures images are oriented correctly for analysis and here setting it rotation to zero,

03:45.850 --> 03:47.330
which is the portrait.

03:47.370 --> 03:57.090
The on image analysis function and callback typically sets up an analyzer to process each camera frame.

03:57.130 --> 04:03.410
This creates a performant image analysis pipeline for real time process.

04:03.490 --> 04:11.930
So this is the real time process pipeline for real time processing.
