Ask Your Question

How to have unique Matrix (Mat)?

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

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

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

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.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


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

Seen: 1,308 times

Last updated: Nov 05 '14