Rotate camera by 90 DEGREES
erik
Hi Erik,
What do you mean when you say that? Do I post those things here in the forum post? Or do I submit something like a git issue?
Ah ok thanks. I tried to keep it minimal with the images above but maybe that was too much? Basically I fed the camera.isp output through two image crops to see if it would work and I got an error. Both image crops worked independently but it feeding through both nodes gave me an error.
what should the general approach be? This is the camera source flow through two nodes. The crop node works fine but I am not seeing the face recognition working when I add the rotation:
# Define source and output
camRgb = pipeline.create(dai.node.ColorCamera)
xoutVideo = pipeline.create(dai.node.XLinkOut)
xoutVideo.setStreamName("video")
# Properties
camRgb.setBoardSocket(dai.CameraBoardSocket.RGB)
camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
camRgb.setVideoSize(1920, 1080)
camRgb.setPreviewSize(300, 300)
xoutVideo.input.setBlocking(False)
xoutVideo.input.setQueueSize(1)
# Create MobileNet detection network
mobilenet = pipeline.create(dai.node.MobileNetDetectionNetwork)
mobilenet.setBlobPath(
blobconverter.from_zoo(name="face-detection-retail-0004", shaves=3)
)
mobilenet.setConfidenceThreshold(0.7)
crop_manip = pipeline.createImageManip()
rgbRr = dai.RotatedRect()
rgbRr.center.x, rgbRr.center.y = camRgb.getPreviewWidth() // 2, camRgb.getPreviewHeight() // 2
rgbRr.size.width, rgbRr.size.height = camRgb.getPreviewHeight(), camRgb.getPreviewWidth()
rgbRr.angle = 90
crop_manip.initialConfig.setCropRotatedRect(rgbRr, False)
camRgb.isp.link(crop_manip.inputImage)
crop_manip2 = pipeline.create(dai.node.ImageManip)
crop_manip2.initialConfig.setResize(300, 300)
crop_manip2.initialConfig.setFrameType(dai.ImgFrame.Type.BGR888p)
crop_manip.out.link(crop_manip2.inputImage)
crop_manip2.out.link(mobilenet.input)
I didnt quite follow. We rotated the camera so the faces coming in would be rotated 90 going into the NN so we are trying to rotate in software before the NN so that they are upright. Did I miss understand you?
I even tried it with a rotation of zero degrees to see if the facial recognition was working and it was not working.
You probably dont have time to try it yourself but if you had any guidance on the approach that would help a lot. Hoping to get this done before production next week. Thanks again
I actually got the rotated face detection working with the gen2_face detection examples so I'm trying to dissect that to make this work.
How does the "while True:" work with the script nodes? It seems like it would get stuck in there without a break..?
Ok thanks for the reply. I was not able to get the rotation working for the facial recognition. I am trying to train a model for rotated faces atm.