Question

When we read color image information we will get data in rows x cols x 3(RGB color)

I want to extract the min value from separate color

Originally I could do

R = I(:,:,1);
G = I(:,:,2);
B = I(:,:,3);

to extract separate data color and normally find min by

Rmin = min(R(:));

and so on...

but Is there any proper solution to use min?

I tried

min(I(:,:,1:3));

but it didn't right (dimension answer was 1xcolx3 : It should be 1x3)

Was it helpful?

Solution

My guess is you have to use the nested min. For example use the following command

min(min(I, [], 1), [], 2)

This should give the result you want.

OTHER TIPS

Try this:

min(min(min(I,3)))

or for a cleaner output:

squeeze(min(min(min(I,3))))

There is probably a nicer way, without nesting the min function.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top