I am able to capture 12MP video from an OAK-1 Light with auto settings but it appears that I am unable to change the ispframe at this resolution because the camera runs out of memory. Is there a way to change ispsettings at resolutions higher than 4K?

  • jakaskerl replied to this.
  • Ok - I got it to work but looks like a bug. I did have this:
    camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_4000X3000)
    but it threw the error above. I changed it to this:
    camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_12_MP)
    which throws a warning but works!
    [184430109118E1F400] [5.1] [0.950] [ColorCamera(0)] [warning] LCM48 doesn't support 12_MP (4056x3040), but THE_4000X3000, defaulting to it

    Exposure, ISO, contrast, sharpness, brightness…I think that's it.

    DanGoodrick
    I am having no issues on my end. Make sure you are running the latest version of deptha and that resolution is set to 13MP.

    EDIT: paste the error logs please?

    Thanks,
    Jaka

    Maybe you could post how you tested it? This is the script I used. It works when I remove the in node for the camera control (lines 35-37) but I just get auto settings.

    #!/usr/bin/env python3
    
    import depthai as dai
    import av
    from fractions import Fraction
    
    # Create pipeline
    pipeline = dai.Pipeline()
    # VideoEncoder H265/H265 limitation; max 250MP/sec, which is about 20FPS @ 12MP
    fps = 20
    
    # Define sources and output
    camRgb = pipeline.create(dai.node.ColorCamera)
    camRgb.setBoardSocket(dai.CameraBoardSocket.CAM_A)
    camRgb.setFps(fps)
    camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_12_MP) # (4056, 3040)
    imageManip = pipeline.create(dai.node.ImageManip)
    # YUV420 -> NV12 (required by VideoEncoder)
    imageManip.initialConfig.setFrameType(dai.RawImgFrame.Type.NV12)
    imageManip.initialConfig.setResize(4032, 3040)
    imageManip.setMaxOutputFrameSize(18495360)  # where does this value come from ???
    camRgb.isp.link(imageManip.inputImage)
    
    # Properties
    videoEnc = pipeline.create(dai.node.VideoEncoder)
    videoEnc.setDefaultProfilePreset(fps, dai.VideoEncoderProperties.Profile.H265_MAIN)
    imageManip.out.link(videoEnc.input)
    
    # Linking
    xout = pipeline.create(dai.node.XLinkOut)
    xout.setStreamName('bitstream')
    videoEnc.bitstream.link(xout.input)
    
    ## Fails with: "Out of memory while creating pool for 'bitstream' frames. Number of frames: 4 each with size: 18678784B"
    controlIn = pipeline.create(dai.node.XLinkIn)
    controlIn.setStreamName('control')
    controlIn.out.link(camRgb.inputControl)  # Link to camera control input
        
        
    # Connect to device and start pipeline
    with dai.Device(pipeline, dai.DeviceInfo("184430107195680F00"), maxUsbSpeed=dai.UsbSpeed.HIGH) as device, av.open('video.mp4', mode='w') as file:
    
        # Output queue will be used to get the encoded data from the output defined above
        q = device.getOutputQueue(name="bitstream", maxSize=30, blocking=True)
    
        codec = av.CodecContext.create('hevc', 'w')
        stream = file.add_stream('hevc')
        stream.width = 4032
        stream.height = 3040
        stream.time_base = Fraction(1, 1000 * 1000)
    
        start_ts = None
    
        print('Press CTRL+C to stop recording... Use VNC to view video.')
    
        while True:
            frame: dai.ImgFrame = q.get()  # Blocking call, will wait until a new data has arrived
    
            if start_ts is None:
                start_ts = frame.getTimestampDevice()
    
            packet = av.Packet(frame.getData())
    
            ts = int((frame.getTimestampDevice() - start_ts).total_seconds() * 1e6)  # To microsec
            packet.dts = ts + 1  # +1 to avoid zero dts
            packet.pts = ts + 1
            packet.stream = stream
            file.mux_one(packet)  # Mux the Packet into container

    With camera control, this is the log message:
    (venv) bwadmin@proactive-sandy:~/luxonis$ python 12mprecord.py

    Press CTRL+C to stop recording... Use VNC to view video.

    [184430107195680F00] [3.4] [1.371] [VideoEncoder(2)] [critical] Out of memory while creating pool for 'bitstream' frames. Number of frames: 4 each with size: 18678784B

    ^C

      (venv) bwadmin@proactive-sandy:~/luxonis$ pip show depthai

      Name: depthai

      Version: 2.28.0.0

      Summary: DepthAI Python Library

      Home-page: luxonis/depthai-python

      Author: Luxonis

      Author-email: support@luxonis.com

      License: MIT

      Location: /home/bwadmin/pdr/venv/lib/python3.10/site-packages

      Requires:

      Required-by: depthai-sdk

      (venv) bwadmin@proactive-sandy:~/luxonis$ pip install depthai --upgrade

      Requirement already satisfied: depthai in /home/bwadmin/pdr/venv/lib/python3.10/site-packages (2.28.0.0)

      DanGoodrick
      Try lowering the num of frames allocated to camera pool.

      camRgb.setNumFramesPool(2, 2, 0, 0, 0) 

      Default is

       /**
           * Pool sizes
           */
          int numFramesPoolRaw = 3;
          int numFramesPoolIsp = 3;
          int numFramesPoolVideo = 4;
          int numFramesPoolPreview = 4;
          int numFramesPoolStill = 4;

      Thanks,
      Jaka

      It still crashes but with a different error
      [2024-10-11 08:20:24.711] [depthai] [error] Device with id 184430107195680F00 has crashed. {...}- please report to developers.
      Crash dump

      Ok - I got it to work but looks like a bug. I did have this:
      camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_4000X3000)
      but it threw the error above. I changed it to this:
      camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_12_MP)
      which throws a warning but works!
      [184430109118E1F400] [5.1] [0.950] [ColorCamera(0)] [warning] LCM48 doesn't support 12_MP (4056x3040), but THE_4000X3000, defaulting to it