How to find maximum value among R,G,B channels in the same indices?

3 views (last 30 days)
I want to find the maximum of R,G,B in the same indices But it shows some error with max function.Please help me out

Accepted Answer

ES
ES on 3 Aug 2017
A = imread('thank-you.jpg');
[iRows, iColumns, ~] = size(A);
for iLoop1=1:iRows
for iLoop2=1:iColumns
B(iLoop1, iLoop2) = max(A(iLoop1, iLoop2, :));
end
end

More Answers (1)

ES
ES on 3 Aug 2017
I dont know any direct way, but you can run a loop on the length and breadth of the image matrix to find the max of R, G, B at each pixel.
  2 Comments
lakshmi prabha
lakshmi prabha on 3 Aug 2017
l=size(A); for i=1:l(1) for j=1:l(2) a=A(i,j,1); b=A(i,j,2); c=A(i,j,3); C1=max(max(a,b),c); end end This is the code I used But it didn't work.Can you rectify it

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!