How can I do summation pixel by pixel?
Show older comments
Below is my code
im = imread('test.png');
imshow(im);
[rows columns] = size(im);
numberOfPixels = rows*columns;
r_t = 0;
Red = im(:,:,1);
pixel = 0;
for i=1:rows
for j=1:columns
red = impixel(Red,i,j);
if red == 255
r_t = r_t + 0;
else
r_t = r_t + red;
end
end
end
when i type impixel(Red,1,1)
I think the answer should be just 255, but command window display 255 255 255
Accepted Answer
More Answers (0)
Categories
Find more on Video Formats and Interfaces in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!