I have the following Cython function
def detect(width, height, np.ndarray[np.uint8_t, ndim=1] frame):
cdef detection_payload* detection = scan_frame(width, height, frame)
return DetectionPayload()._setup(detection)
This is the signature of scan_frame
cdef extern from "tag36h11_detector/tag36h11_detector.h":
cdef struct detection_payload:
int size
apriltag_detection_t* detections
ctypedef detection_payload detection_payload_t
detection_payload* scan_frame(int width, int height, uint8_t* data)
This is how I'm trying to pass an array into detect
// test.py
from tag36h11_detector import detect
import numpy as np
a = np.array([1,2,3], dtype=np.uint8)
detect(4, 5, a)
This is the error I get...
Traceback (most recent call last): File "test.py", line 6, in detect(4, 5, a) File "tag36h11_detector.pyx", line 67, in tag36h11_detector.detect cdef detection_payload* detection = scan_frame(width, height, frame) TypeError: expected bytes, numpy.ndarray found