Now that we have images in the computer represent us, we learn in the previous

video discrete 2-dimensional arrays. Basically, we started from a continuous

picture and we finish with the 2-dimension discrete array.

Now, we can start doing operations on these images.

There are network computer, there are just 2-dimensional arrays of pixels we

can do very different types of operations to do the kind of things that we saw in

the first couple of videos in this class. During the next few weeks, we're going to

learn very sophisticated operations. But let's start with just a few very

simple ones that, they are very simple but they are extremely useful and will

tell us how we actually can manipulate images.

And you can go into your computer and do any of the examples that I'm going to

show in the next few slides in just a few minutes or, or even less if you have a, a

program like Mathlab that are natural to work with 2-dimensional arrays.

Once we have a 2-dimensional array, one of the things that we can start talking

is about neighborhoods. So remember, we have a 2-dimensional

array, and we're talking about pixels. So, this

is a pixel, and I can ask where are the neighbors of this pixel.

And there are two types of standard neighborhoods that are taken in image

processing. One is called a four neighborhood, and

only these four are considered. And that's basically, you can only go

North, South, East, or West, so it's just a four neighborhood.

There is another very popular that is an eight neighborhood,

and you probably already guessed how it works.

So, if I'm here, the neighbors, the A neighbors of this

pixel are all the pixels around it. So, you can go north and south, east and

west, as before. But you can also go like northeast and

start going diagonal. So, for example, if I look at this image

here, this pixel, in a four neighborhood relationship is

not a neighbor of this one. So, these two 1s are not neighbors.

Because I cannot go diagonal in a four neighborhood relationship.

In an eight neighborhood relationship, there are neighbors.

And that of course translates also to a group of pixels.

So, this group of pixels has an eight neighborhood relationship with this one.

Because there is a one here, and a one diagonal.

And I'm allowed to go diagonal, okay?

Now, if I were to talk about fourth neighborhood, I will say that this group

of ones is not neighbor of this group of ones.

Because from this one, I can only go south.

I don't see anybody from this group, any ones.

I can go right, east, I don't see anybody.

So basically, depending on how we define neighborhood in this discrete space,

what kind of operations we can do. And were going to see that's very important.

This is the most common neighborhood today used in most modern image

processing. But it's important to be aware of this

type of neighborhood. Especially, when we're going to be doing

segmentation and things like that. We're also going to, later on when we

talk about the last week, we're going to talk about 3D images.

So, not images that have a great values on the plane,

like here, where every pixel has a great value.

But we're going to talk about volumetric images where every point in the volume,

those are going to be called voxels have great values.

And the neighborhood relationships are very important there, for example, in

medical images, to decide that this organ is neighbor to

this organ, we're going to have to define the neighborhood relationships.

And the same when we're going to do segmentation.

So, neighborhoods are important. But now that we have 2-dimensional

arrays, we can do simple operations between 2-dimensional arrays.

For example, we can add them. Remember, every point, so if I look at

this image, every point here has a value. So, I can take that image and add to a

second image. So I can take image one,

and add it to image two. That means that I take, and I'm drawing a

small image in purpo, on purpose, this is a three by three image.

I'm going to take the value here and add it to the value here.

So if here it say seven and here it say ten I'm going to get a result which is

seventeen. Then, I go to the next pixel and I do the

same. It's a simple addition of images.

That's an extremely important operation by itself,

very simple. So here, we see that operation.

We basically have NASA took images, multiple images, of the same galaxy.

Multiple times, they go once, and again, and take more and more and more images.

The images are very noisy, but all the images are aligned.

So they don't move the camera and nothing is moving.

They take one after the other, and then they start adding them.

And, when they add the image, when they add the images, they start getting

clearer and clearer. So here, they basically added five,

then they added ten, so on until they got a hundred images.

So, they did I1 + I2 a hundred times. So, they have a hundred images of this galaxy

and they added them together. And what happens is the image starts

becoming clearer and clearer because the image has noise.

The image is always, the actual scene is always the same scene.

The noise is the one that changes, that changes, and when you add all those

images, you're adding the same number, plus the noise that is random, and then

the noise gets reduced. And when we talk about spatial noisy, and

how to do image enhancing, we're going to discuss this very, very in detail.

But the basic idea is that we can simply add this 2-dimensional race to do a

number of interesting operations. We can do other things.

Basically, we can also mask them. We can subtract them.

So, we can have an image like this, and our image like this. Let's say, two

variations of the same scene, but taken under different conditions.

And then, we take the difference between them.

And look, the difference shows something that might

be very, very important for the doctor. And this is just an enhance that we're

going to talk about this, we enhance images for example by changing the grey

value distributions to make them more clear.

So, in this case, we take, we took I1, I2, and we basically did I1 - I2.

Sometimes, we take the absolute value if you don't, if we don't care about the

sign. And sometimes, we just basically shift

all the pixels so the negative value become zero.

once again, a very simple operation that can have tremendous value.

Some, we can also do logic operations in images.

So we can have basically, an image A and our image B, and do AUB.

So basically, we, let's say that this is all 255, the rest

is zero. B again, is all 255, so we get the union

of them. We get the interception of the pixels

that both objects have 255 or Y values. So again, think about any type of

operations that you could do with 2-dimensional arrays in your computer.

You can start doing with images, now that we know that there are nothing else in

the computer than 2-dimensional arrays. We can also basically take the inverse of

an image, and the basic idea is that this remember was zero, very black.

The brightest point, 255.

And then, we can actually invert it. We can make the zero go to 255,

and the 255 go to zero. It would be a map like this.

If this is the input and this is the output,

it would be something like this. A zero goes to 255, 255 goes to zero.

So we invert the image, and then we can, using that we can find some interesting

things and that might be easier to observe certain objects in the image in

the inverted image than it was in the original image.

Again, a simple operation with the arrays that we have representing our images in

the computer. We can also do different spatial.

So, this was adding images. So I take an image,

I take another image, I add it.

Or, I invert an image. But, we can do more sophisticated things.

We can actually take a pixel in the image, and replace it by the average of

its neighbors. Now remember, I have to define what our

neighbors, okay?

So, let's consider an eight neighborhood, as we talk before.