Trouble with HQ camera module and the runner.classifier()

in the linux python sdk example at:

at some point runner.classifier is being used (the following line of code):

for res, img in runner.classifier(videoCaptureDeviceId):

I have a imx477 HQ camera module (with the flat cable) for a raspberry pi 4.
The camera doesn’t show up in any of the ports, so i can’t use the port number as ‘videoCaptrueDeviceId’. Does anyone know how to make this camera show up in the ports? I read that the camera is automatically enabled, and it is also recommended to use picamera2 with this module. I can confirm that the camera works and is recognized by raspberry pi, because if i run rpicam-hello in bash, i can see that it’s recognized. The problem is, i’m not able to use runner.classifier with picamera2. I’m hoping that there is another way of using runner.classifier() or that there is a way to make this camera show up in raspi-config.

Also, I’m trying to show bounding boxes, are there perhaps some other examles that use different runner functions (compatible with picamera2) that show bounding boxes?

Hi @djolodjolo,

If you cannot get the camera to show up as a device ID (that you can just pass to runner.classify()), I recommend first figuring out how to capture an image from it into a basic 2D array in Python. For example: IMX477 Example Python code with changing exposure for UVC board Linux Ubuntu - 12mp-imx477-hq-cameras - Arducam Camera Support Forum

Then, use from edge_impulse_linux.image import ImageImpulseRunner to extract features and run inference:

# imread returns images in BGR format, so we need to convert to RGB
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

# get_features_from_image also takes a crop direction arguments in case you don't have square images
features, cropped = runner.get_features_from_image(img)

res = runner.classify(features)

Here is a full example of using an image (rather than a camera device ID): linux-sdk-python/examples/image/ at master · edgeimpulse/linux-sdk-python · GitHub