0

Is there an OpenCV function that can convert a 3 channel Mat to std::vector<Vec3b> (or std::vector<Scalar>)? Ie, convert an image just to an array of its colour pixels.

I'm not concerned about preserving/maintaining colour/pixel order. I want the colours over one dimension so I can find colour clusters (identify the most common HSV/colours in an image).

sazr
  • 24,984
  • 66
  • 194
  • 362
  • Look at http://stackoverflow.com/questions/1824787/opencv-multi-channel-element-access – Timur Kukharskiy Aug 29 '16 at 14:44
  • @TimurKukharskiy I guess you are saying iterate over each element in the `Mat` and build my vector that way? Yes I know how I could build it manually, I want to know if there is an existing OpenCV function that does this. – sazr Aug 29 '16 at 14:51
  • Possible duplicate of [Is there a formula to determine overall color given BGR values? (OpenCV and C++)](http://stackoverflow.com/questions/34734379/is-there-a-formula-to-determine-overall-color-given-bgr-values-opencv-and-c) – Miki Aug 29 '16 at 15:10

0 Answers0