I am trying to find uniques tuples within a numpy array but am unable to. Based on other SO answer I tried np.unique while setting the value for the axis, but it's not providing me what I'm looking for. Here's an example:
I have the following array
b = np.array([[[255, 0, 0], [255, 0, 0]], [[255, 0, 0], [0, 0, 0]]])
I am looking for a way to tell me that it has two tuples in it: (255, 0, 0) and (0, 0, 0). Here are the results from using np.unique:
np.unique(b, axis=0)
array([[[255, 0, 0],
[ 0, 0, 0]],
[[255, 0, 0],
[255, 0, 0]]])
np.unique(b, axis=1)
array([[[255, 0, 0],
[255, 0, 0]],
[[ 0, 0, 0],
[255, 0, 0]]])
np.unique(b, axis=2)
array([[[ 0, 255],
[ 0, 255]],
[[ 0, 255],
[ 0, 0]]])
How do I get it to return [255, 0, 0], [0, 0, 0]?