R
RobertH

  • Oct 20, 2024
  • Joined Jan 30, 2024
  • 0 best answers
  • Hi @jakaskerl

    After applying cv2.cvtColor() the color is correct. If we'd like to convert color in OAK VPU internally (supposed to get a higher frame rate on host side, right?), is there any alternate for this target? Any sample code for sharing? Thanks in advance.

    BR, Robert Huang

  • Hi @jakaskerl
    Yes, the sample code used NV12 frame type (listed complete code as below where the modifications are ones starting with Robert modification). Following your instruction by running cam_test.py, i snapshot these different outputs compared to real environment (iPhone 12 Pro Max rear camera) as comparison snapshot link. Could you please help give more clues? Thanks in advance.

    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_B) # (Robert modification) changed to CAM_B
        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_800_P) # (Robert modification) THE_1080_P changed to THE_800_P
    
        # Create an UVC (USB Video Class) output node
        uvc = pipeline.createUVC()
        cam_rgb.video.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(1280, 800) # (Robert modification) (1920, 1080) changed to (1280, 800)
        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
  • Hi... I tried out the instruction (link as https://docs.luxonis.com/projects/api/en/latest/samples/UVC/uvc_rgb/#) by using my OAK-D SR camera with slightly modification (CameraBoardSocket.CAM_A changed to CAM_B and resolution changed to THE_800_P or (1280, 800) where my hardware configuration is raspberry pi 5 + ubuntu Desktop 24.04 LTS. Then used test code to display frames output from UVC camera and it can be shown correctly. But the color is weird (seems one color missed). Already tried to set up color order as BGR (comply with openCV format) but it still kept weird. Any insights or assistance on this would be greatly appreciated.

    Thanks in advance,

    Robert Huang

  • Thanks for reply. Since I'm not familiar with docker operation, I'd take the option of relevant branch.

    Before starting my trial on rae, i typed 2 commands (follow up Installation section on luxonis/depthai-pythontree/rvc3_develop and their replies as below) on my host PC (Windows 10) and used Depthai Viewer to check my another OAK-D-SR camera, which is working(image from right/left camera and point cloud are shown) well with "Luxonis Device" shown on Device Manager.

    C:\Users\Pega_User>python -m pip install -U pip
    Requirement already satisfied: pip in d:\python\python312\lib\site-packages (24.0)
    C:\Users\Pega_User>python -m pip install --extra-index-url https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/ depthai
    Looking in indexes: https://pypi.org/simple, https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/
    Collecting depthai
    Using cached depthai-2.25.0.0-cp312-cp312-win_amd64.whl.metadata (9.0 kB)
    Using cached depthai-2.25.0.0-cp312-cp312-win_amd64.whl (10.6 MB)
    Installing collected packages: depthai
    Successfully installed depthai-2.25.0.0

    Then I plugged in my new rae(no firmware updated after shipping), power it on(Register at robohub.luxonis.com text shown on screen of rae). But no new device is discovered under Device Manager (resulting in not working in Depthai Viewer for sure). Is it correct that I need to update firmware before next step? Is there any document we can reference? Please hlep. Thanks.

    • Hi, there are some cameras in rae and one though that can i treat these camera as regular OAK camera production line when i use USB cable to connect to my host and use depthai API or SDK to control them? Thanks in advance.

    • Hi, I bought a rae recently after checking kickstarter description where the most interesting to me is that you can use mobile APP to remote access and full control your rae (as robot vaccue), that's why i bought rae. Does rae come with firmware for this case? And how do i download mobile APP? Thanks in advance.

    • Hi jakaskerl ,

      Thanks for comments. It’s a typo and I mean DepthAI Demo has not supported OAK-D SR camera.

      From depth_preview_sr.py source code, no explicit CAM* terms are specified. Wonder if I have more than OAK camera connected to PC simultaneously, how I specify which one I want to control? Any query function to know what camera(s) connected to PC? Thanks again for your patience for my trivial questions.

      • Hi Jaka,

        Updated. I have tried another sample of depthai-python\examples\ColorCamera\rgb_preview.py and it still failed as below snapshot for your reference.

      • Hi jakaskerl

        Thanks for your feedback. I tried to use hello_world.py as my first tutorial sample code but it failed with following error shown "[19443010C19E782700] [1.1] [1.253] [ColorCamera(0)] [error] Camera not detected on socket: 0" with my camera of OAK-D SR model. It's known that DepthAI Viewer doesn't support OAK-D SR camera. Here is question that does every code under sample, experiments and tutorial support OAK-D SR camera? Or anything I need to be aware of?

        Thanks,

        RobertH

        • Hi Luxonis Support Team,

          I'm a new comer for Luxonis and DepthAI family. Would you please help check my understanding listed as below is correct or not? Also some questions need your answers. Thanks in advance.

          Currently I successfully have installed depthai-viewer (by typing command of python -m pip install depthai-viewer) on Windows 10 (depthai-viewer is installed on D:\Python\Python311\Lib\site-packages\depthai_viewer folder). It was observed that after invoking D:\Python\Python311\Scripts\depthai-viewer.exe at the first time, the GUI would install dependency (running D:\Python\Python311\Lib\site-packages\depthai_viewer\install_requirements.py) on virtual environment path (D:\Python\Python311\Lib\site-packages\depthai_viewer\venv-0.1.6\Lib\site-packages). Then after plugging my OAK-D SR camera on USB port, it would show up the 3 panels results, which looks everything is fine.

          (Question 1) If I don't want to double-click invoke D:\Python\Python311\Scripts\depthai-viewer.exe dirtectly and use prompt to invoke it instead, what commands do I type in prompt command environment?

          (Question 2) Depthai Viewer is to use SDK or API (or both) and to use Rust(listed in GitHub) or Python language to implement this application?

          (Question 3) I would like to trace the source code of depthai-viewer porject (what functions in SDK or API are used one by one) for my application of depth information extraction from 2D camera frame. Do you think depthai-viewer is a good starting-point project or any other project you suggest? My preferenced programming language is Python.

          • jakaskerl , Hi jakaskerl, recently I bough a OAK-D SR camera as well and also wondered when this depthai-viewer sdk will be rolled out. Any update for it?

            Thanks in advance.