i want to check if target has the same array of template has.
for example,
#The array of template
[[[162 181 0]
[ 36 28 237]
[ 0 0 0]
[100 60 52]
[ 39 127 255]]
[[162 181 0]
[ 36 28 237]
[ 0 0 0]
[100 60 52]
[ 39 127 255]]
[[162 181 0]
[ 36 28 237]
[ 0 0 0]
[100 60 52]
[ 39 127 255]]]
#the array of target
[[[162 181 0]]
[[162 181 0]]
[[162 181 0]]]
so if target has the same array returns true
but if target has different value like below
[[[150 181 0]]
[[162 181 0]]
[[162 181 0]]]
it returns False. how would i be able to do so?
thinking of using numpy but i dont know how
CodePudding user response:
any(((template[:, i, :] == target).all() for i in range(template.shape[1])))
Maybe there is a more elegant way.