How to convert NDArray to Integer?


#1

print(cx)
[9.709639]

print(type(cx))
<class ‘mxnet.ndarray.ndarray.NDArray’>

I want to convert <class ‘mxnet.ndarray.ndarray.NDArray’> to Integer <class ‘int’>
I tried cx.astype(int) already but it didn’t work.

The Anaconda Prompt shows
cv2.circle(frame,(cx,cy), 5, (0,0,255), -1)
TypeError: an integer is required (got type NDArray)

Thanks


#2

@emesssii use int(cx.asscalar())