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

You can post your problem related to MATLAB Projects here. We will try our best to help you out.
Posts: 12
Joined: Sat Feb 18, 2017 5:57 am

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

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.

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);``````