### How to integrate an element in an image according to the intensity?

Posted:

**Mon Mar 06, 2017 12:17 pm**I have a squared image img that I cut in two parts vertically, I calculate the mean of intensity in each part and then I compare these means with minimal function. I create a square of one with a size 200 by 200.

My question is : How can I say that I want place the square in the part of the image where there is the minimal mean of intensity (so once it can be in the right part and an other once it can be in the left part and the place in the part is not significant at first)? I wold like to do this automatically because I have several images.

My question is : How can I say that I want place the square in the part of the image where there is the minimal mean of intensity (so once it can be in the right part and an other once it can be in the left part and the place in the part is not significant at first)? I wold like to do this automatically because I have several images.

Code: Select all

```
img=imread('image.tif')
dim=size(img,1);
meam1=mean(mean(:,1:dim/2));
mean2=mean(mean(:,dim+1/2:end));
Min=min(mean1,mean2);
Square= ones(200,200);
```