pixel by pixel squaring of image?
7 次查看(过去 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 个评论
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()
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!