Hi, the issue I have is that I want to use my OAK-D Camera as a webcam but with a vertical output. I have this pipeline

    pipeline = dai.Pipeline()

    cam_rgb = pipeline.createColorCamera()

    cam_rgb.initialControl.setSharpness(settings['sharpness'])
    cam_rgb.initialControl.setLumaDenoise(settings['lumadenoise'])
    cam_rgb.initialControl.setChromaDenoise(settings['chromadenoise'])
    cam_rgb.initialControl.setManualFocus(settings['manualfocus'])
    cam_rgb.initialControl.setSaturation(settings['saturation'])
    cam_rgb.initialControl.setManualExposure(settings['exposure'], settings['iso'])
    cam_rgb.initialControl.setManualWhiteBalance(settings['whitebalance'])

    cam_rgb.setBoardSocket(dai.CameraBoardSocket.CAM_A)
    cam_rgb.setInterleaved(False)
    cam_rgb.setFps(30.0)
    cam_rgb.setResolution(resolution)
    cam_rgb.setVideoSize(settings['windowwidth'], settings['windowheight'])
    cam_rgb.setImageOrientation(orientation)
   
    uvc = pipeline.createUVC()
    cam_rgb.video.link(uvc.input)

    config = dai.Device.Config()
    config.board.uvc = dai.BoardConfig.UVC(settings['windowwidth'], settings['windowheight'])
    config.board.uvc.frameType = dai.ImgFrame.Type.NV12
    pipeline.setBoardConfig(config.board)

    return pipeline

Here if I set the video size (or even preview size) and the Board Config with a width of 1920 and height of 1080 and a THE*_1080_P* resolution, it actually works. The problem is that I want to have a 1080x1920 video size (vertical output), when I make this change there's no traceback error, it actually works and even Luxonis UVC Camera appears, but it disappears immediately and it basically keeps on the while loop,(something that do NOT occurs when I set the 1920x1080 size).

Some other alternative that I found is that, if I set THE*_4_K* resolution and then I set the board config and the video size with a 1080x1920 I actually got the vertical output but cropped, which is not what I want.

And finally, if I just set the resolution of 1080p and set the Board Config with 1080x1920 instead of 1920x1080, I actually got the vertical output that I'm looking for but got this weird thing:

I also need to say that I had tried using ImageManip method to obtain the vertical output that I want, but when I make this the camera also generates the Luxonis UVC Camera module but the camera never open the image actually.

I will be grateful with any kind of recommendation and help.

    4 days later

    Hi @Leckrosh
    Looks like there is a problem with the interleaved frames.. Will check today.

    Thanks,
    Jaka

    Leckrosh

    this one works for me

    #!/usr/bin/env python3
    
    import time
    import argparse
    
    parser = argparse.ArgumentParser()
    parser.add_argument('-fb', '--flash-bootloader', default=False, action="store_true")
    parser.add_argument('-f',  '--flash-app',        default=False, action="store_true")
    parser.add_argument('-l',  '--load-and-exit',    default=False, action="store_true")
    args = parser.parse_args()
    
    if args.load_and_exit:
        import os
        # Disabling device watchdog, so it doesn't need the host to ping periodically.
        # Note: this is done before importing `depthai`
        os.environ["DEPTHAI_WATCHDOG"] = "0"
    
    import depthai as dai
    
    def getPipeline():
        enable_4k = False  # Will downscale 4K -> 1080p
    
        pipeline = dai.Pipeline()
    
        # Define a source - color camera
        cam_rgb = pipeline.createColorCamera()
        cam_rgb.setBoardSocket(dai.CameraBoardSocket.CAM_A)
        cam_rgb.setInterleaved(False)
        
        #cam_rgb.initialControl.setManualFocus(130)
    
        if enable_4k:
            cam_rgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_4_K)
            cam_rgb.setIspScale(1, 2)
        else:
            cam_rgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
    
        # Create an UVC (USB Video Class) output node
        uvc = pipeline.createUVC()
        #cam_rgb.video.link(uvc.input)
    
        manip = pipeline.createImageManip()
        manip.initialConfig.setRotationDegrees(90)
        manip.setMaxOutputFrameSize(3110400)
    
        cam_rgb.video.link(manip.inputImage)
        manip.out.link(uvc.input)
    
    
        # Note: if the pipeline is sent later to device (using startPipeline()),
        # it is important to pass the device config separately when creating the device
        config = dai.Device.Config()
        # config.board.uvc = dai.BoardConfig.UVC()  # enable default 1920x1080 NV12
        config.board.uvc = dai.BoardConfig.UVC(1920, 1080)
        config.board.uvc.frameType = dai.ImgFrame.Type.NV12
        # config.board.uvc.cameraName = "My Custom Cam"
        pipeline.setBoardConfig(config.board)
    
        return pipeline
    
    # Will flash the bootloader if no pipeline is provided as argument
    def flash(pipeline=None):
        (f, bl) = dai.DeviceBootloader.getFirstAvailableDevice()
        bootloader = dai.DeviceBootloader(bl, True)
    
        # Create a progress callback lambda
        progress = lambda p : print(f'Flashing progress: {p*100:.1f}%')
    
        startTime = time.monotonic()
        if pipeline is None:
            print("Flashing bootloader...")
            bootloader.flashBootloader(progress)
        else:
            print("Flashing application pipeline...")
            bootloader.flash(progress, pipeline)
    
        elapsedTime = round(time.monotonic() - startTime, 2)
        print("Done in", elapsedTime, "seconds")
    
    if args.flash_bootloader or args.flash_app:
        if args.flash_bootloader: flash()
        if args.flash_app: flash(getPipeline())
        print("Flashing successful. Please power-cycle the device")
        quit()
    
    if args.load_and_exit:
        device = dai.Device(getPipeline())
        print("\nDevice started. Attempting to force-terminate this process...")
        print("Open an UVC viewer to check the camera stream.")
        print("To reconnect with depthai, a device power-cycle may be required in some cases")
        # We do not want the device to be closed, so terminate the process uncleanly.
        # (TODO add depthai API to be able to cleanly exit without closing device)
        import signal
        os.kill(os.getpid(), signal.SIGTERM)
    
    # Standard UVC load with depthai
    with dai.Device(getPipeline()) as device:
        print("\nDevice started, please keep this process running")
        print("and open an UVC viewer to check the camera stream.")
        print("\nTo close: Ctrl+C")
    
        # Doing nothing here, just keeping the host feeding the watchdog
        while True:
            try:
                time.sleep(0.1)
            except KeyboardInterrupt:
                break

    Thanks,
    Jaka