How to find avergae of thresholded elements only from a matrix?

3 次查看(过去 30 天)
I am trying to calculate average RGB of images with a uniform background. So I want to remove the background from the calculation. How do I select only elements belows above/below certain value (say <250) and calculate average of those only.

采纳的回答

KSSV
KSSV 2019-8-20
Let A be your matrix......say you want values below a threshold val.
idx = A<val ;
themean = mean(A(idx)) ;

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by