Grayscale Picture Linearizing with for loop doesnt work

3 ビュー (過去 30 日間)
Oliver Stilz
Oliver Stilz 2016 年 5 月 4 日
コメント済み: Oliver Stilz 2016 年 5 月 4 日
[m,n] = size(grey);
y = 2;
pens= zeroes(m,n);
for i = 1:m
for j = 1:n
pens(i,j) = floor(255*(power(grey(i,j)/255, y)));
end
end
imshow(pens);
For that grey is a grayscale picture (M x N matrix with gray values) this should be a perfectly working code. but it doesnt and i dont get why. If i try numbers between 0 and 255 for "grey(i,j)" as a single command i get the right values, but if i use it in the loop, i only get 0 or 255 as return in pens... does anyone know where the problem here lays?

採用された回答

Walter Roberson
Walter Roberson 2016 年 5 月 4 日
編集済み: Walter Roberson 2016 年 5 月 4 日
pens(i,j) = floor(255*(power(double(grey(i,j))/255, y)));
and at the end,
imshow(uint8(pens));

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by