pixel by pixel squaring of image?
1 回表示 (過去 30 日間)
古いコメントを表示
If I have an image of size M by N then how can I do the square of each pixel individually?
0 件のコメント
回答 (1 件)
Sabarinathan Vadivelu
2016 年 8 月 12 日
outImage = zeros(size(inputImage));
for i = 1 : size(inputImage, 1)
for j = 1 : size(inputImage, 2)
outImage(i, j) = inputImage(i,j)^2;
end
end
4 件のコメント
maaham banu
2019 年 11 月 22 日
hi, why doesnt this algorithm work for a gray image? I am getting only 255
Image Analyst
2019 年 11 月 22 日
Because if the value goes above 255, it clips to 255. You'll have to use uint16 or double. And don't use a for loop like this answer did. Use dot caret instead:
outImage = double(inputImage) .^ 2; % or uint16()
参考
カテゴリ
Help Center および File Exchange で Entering Commands についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!