1 | initial version |
I've never heard of an OpenCV function but the matrix has a member-array called data in which the pixel values are stored. So you could use stl-functions (std::sort and std::unique) on a copy of this array.
http://en.cppreference.com/w/cpp/algorithm/unique