MATLAB: After division i am getting 1 as the answer

image analysisImage Processing Toolbox

editor:
f1=input('Enter a image name:','s');
a1=imread(f1);
c1=rgb2gray(imresize(a1,[3,9]))';
N=[208 16 235 255 44 229 236 34 247;...
245 21 213 254 55 252 215 51 249;...
248 22 225 252 30 240 242 27 244]';
N=N/256
c2=c1/256
Command window: Enter a image name:51.jpg
N =
0.8125 0.9570 0.9688
0.0625 0.0820 0.0859
0.9180 0.8320 0.8789
0.9961 0.9922 0.9844
0.1719 0.2148 0.1172
0.8945 0.9844 0.9375
0.9219 0.8398 0.9453
0.1328 0.1992 0.1055
0.9648 0.9727 0.9531
c2 =
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
>>

Best Answer

Cast c1 to double so that you're not doing an integer divide, but doing a floating point divide instead:
c2 = double(c1) / 256;