So welcome to the next section where we take a look at detecting blur in images, so open this notebook
and let's begin to listen.
So firstly, let's think about something.
What exactly is blue?
Now you instinctively know if you move your phone, camera or any camera fast when you're taking a picture
or using a manual camera and you increase the shutter speed and you get the camera when taking the picture,
you're going to get blurry photo.
I mean, that's intuitive, and you understand that everyone should understand how blurry photos are
right now.
How do you mentally or visually tell when a picture is blurry?
You can tell when a picture is buried, when the edges undefined.
That's basically what's happening to the image.
That's why it's blurry.
So to detect the basically the amount of edges in an image can basically tell us know how strong the
edges of an image can tell us how sharp that images.
So to do that, we actually just use the simple convolution operation within the policy.
And Colonel sounds a bit technical, but it's not that technical.
Then the plastic is the second derivative of an image.
So it highlights the areas of rapid intensity changes like an edge or corner.
So that's why we can tell with a high variance in it.
We should be able to detect edge like when known as like type things in the image.
So a low variance basically tells us that there are very little edges, meaning that it might be blurred.
And then basically the opposite is true a high variance with loss.
There's a lot more edges in the image and the image is shop.
OK, so let's look LoDo images and load the function and see delivery, which I've already done here.
And now let's apply some blue to some images.
So I'm going to load an image here.
It's of the Liberty Store in London, which I was in just a few weeks ago, and it's actually a pretty
nice Christmas store.
I mean, has a good look good, a good Christmas section right now, which is why I was still so we
can take a look and you can see this is the original image here.
It looks decently sharp notices semblance a little bit of blue ribbon not to worry.
This one is a bit mulberry can tell, and this one is the most fluid.
You can definitely see it looks quite smudgy.
Now, these aren't that badly blurred, to be fair.
But what we're going to do?
These are subtle changes in the blurriness of the image, which is why we intentionally did that.
So we're going to create we're going to create a function where we return to LA plus yellow often.
Image here.
So a grayscale of the image.
So we get, well, actually, it's not.
It doesn't have to be grayscale.
I mean, it does have to be grayscale.
But this function, if it's a colour grayscale or color image, do it because if it's a colour image,
it us detects that it has three dimensions in it and then applies the grayscale if it's to, if there's
everything else should be grayscale.
So and a return to the plus in right here.
That's basically the list school.
Plus the invariance can see the dot fire function here.
So remember, remember that was our definition of it, of getting a blue school.
So now just to find the function and you can see the Burscough is there, but let's run this again and
you can see for the first original image of the high.
The score is the variance is very high, which means that there a lot of edges in the original image
and you can tell you can see you can see it this.
It's quite distinctive schism, and there's a lot of little edges here in between, which is why I use
this picture and then continue to bleed ones.
It just continuously looks less and less.
You can see there's almost no definition with the little inner parts of it here.
And last one is heavily blurred and you can see how different the blue skies are.
You can.
So this is a very good way of detecting the shopper's image in the batch, and I've used this function
in license plate OCR reader previously, where it captures about, let's say, roughly three seconds
or even two seconds of a license plate passing an image.
And it uses a combination of the largest and sharpest image to run the OCR detector on it.
So it's definitely improved reliability of that license plate reader that that was actually for the
research paper I was working on that basically used a few of the cutting edge techniques to do something
simple, which is license plate reading, so that research paper may be out in early 2022.
So if it is, hopefully you guys can read it and critique it if you want.
So that's it for that lesson.
We're now going to do facial recognition using some pretty cool libraries that make it much easier for
us to do.
We're actually going to do this and a lot more detail later on in the deep learning section.
But for now, we're going to use a standard library that makes it quite easy.
US, so I'll see you in the next lesson.
Thank you.