I have an image I(200*200*3) , and I am looking to get the scale of each pixel of the image. I wonder if there is a method or function on matlab dedicated to that ?
The last answer will give you the scale in positive values, adn I would do just like Sandeep said. If you want to have a scale that consider negative values, you must change the class to int32 (you decide 8, 16 or 32) and then the step 2) you must assigne as zero, then you can normalize values (max negative and max positive that must be the same) and then divide by this value. You will have scale between -1, 0, 1.
I thank you for your answer, indeed I tried what you proposed to me by the code below:
% step 1 :Subtract the minimum intensity of your image from each pixel intensity.
min1 = min(min(I1_test(:,:,3)));
stp1=I1_test(:,:,3)-min1;
%step 2 : Find the difference of maximum and minimum intensity.
max1=max(max(I1_test(:,:,3)));
stp2=max1-min1;
%Step 3 : Divide the result of step 1 by step 2.
stp3=stp1/stp2;
%Step 4 : multiply the step 3 result by 255 to scale the pixel intensity between [0-255].
stp4=stp3*255;
But I have two problems:
1. I have to get a single value for each pixel.and I ask if this will be fixed by adding the result of the 3 plans (if I don't say stupid things)??
2.2. by multiplying by 255, I get very large values of what expected (I normally have values between 1 and 10 in maximum). is that still correct when we don't multiplying by 255 ??
thank you so much for your feedback, I have a question, why add 1 to all matrix and then multiply by 127, I don't understand well? and how to use the result of 3 plans (RGB) to get one value of each pixels ( final result should be a matrix of 200*200).
Because the minimum is -1, so you need to add +1 and then the maximum value will be +2. If you the multiply 2 by 128 (my mistake in the early message) you will have 256. Then you can normalize. It is a suggestion. You can use the method you like. You must do this for each of the 3 matrix, one for each color. You can not do this in one step: you need to do this for each matrix.