Reputation: 5
Is there any easy way of finding the median value of a RGB image in OpenCV using C?
In MATLAB we can just extract the arrays corresponding to the three channels and compute median values for each of the arrays by median(median(array))
. Finally, the median value of these three medians (for three channels) can be calculated for the final median value.
Upvotes: 0
Views: 12321
Reputation: 1519
You can convert the matrix to a histogram via the calcHist
function (once for each channel), then calculate the median for a given channel by using the function available here.
Note: I have not tested that linked code, but it should at least give you an idea of how to get started.
Upvotes: 3