Ask Your Question
0

How to have unique Matrix (Mat)?

asked 2014-11-05 01:06:34 -0600

Hi I have a Mat matrix and I want to make it unique. for example: Mat k=(Mat_<int>(5,1)<<3 5 4 4 3);

k=[3,5,4,4,3]; I want this : [3,5,4]; non-repetitive elements. Is there any defined functions in opencv?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-11-05 01:37:22 -0600

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

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-11-05 01:06:34 -0600

Seen: 1,876 times

Last updated: Nov 05 '14