omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    face_detector.py strange behavior

    Pythonista
    4
    24
    8819
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • pavlinb
      pavlinb last edited by

      It seems that setMinFrameDuration is in camera.captureOutput object ('AVCaptureVideoDataOutput').

      But there is also setActiveVideoMinFrameDuration in camera.captureDevice ('AVCaptureDevice').

      I couldn't make them working too both.

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        try this.
        https://gist.github.com/424d4fe1a3c0b1ae3fd705d72f665c1e

        increase FRAME_PROC_INTERVAL until you stop seeing FrameLate constantly. or set to 1 to go as fast as possible. you will probably see FrameLate, but if you start seeing OutOfBuffers or something like that, it means you are doing some processing and forgetting to release the capture buffer.

        there are many hoops to jump through to get the actual min frame interval set, i think i have all the steps correct, though am on an older device. see if it works for you. I have a DESIRED_FPS that you can change to see if you can get <30 fps..

        does this one hang? if so, what message do you get on the first frame when it comes back?

        pavlinb 1 Reply Last reply Reply Quote 0
        • pavlinb
          pavlinb last edited by

          This one works: link

          from ctypes import *
          from objc_util import *
          
          class CMTime(Structure):
            _fields_ = [('value', c_int64), ('timescale', c_int32), ('flags', c_uint32), ('epoch', c_int64)]
          
          AVCaptureDevice = ObjCClass('AVCaptureDevice')
          
          _device = AVCaptureDevice.defaultDeviceWithDeviceType_mediaType_position_(
            'AVCaptureDeviceTypeBuiltInWideAngleCamera', 'vide', 1)
          
          dur = _device.activeVideoMinFrameDuration(restype=CMTime, argtypes=[])
          dur.value *= 3
          _device.lockForConfiguration_(None)
          _device.setActiveVideoMinFrameDuration_(dur, restype=None, argtypes=[CMTime])
          _device.unlockForConfiguration()
          
          1 Reply Last reply Reply Quote 0
          • pavlinb
            pavlinb @JonB last edited by

            @JonB 350 passes and still works. I'll play with parameters to see how it will go.

            Thanks.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors