Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. how to controll the focus of the camera with the uvc protocal
Forum Updated to NodeBB v4.3 + New Features

how to controll the focus of the camera with the uvc protocal

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 243 Views
  • 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.
  • nicker playerN Offline
    nicker playerN Offline
    nicker player
    wrote on last edited by
    #1

    I wrote a program that which used the camera example offered by the qt .but I found the pro could not control the focus of the camera,not the zoom in or zoom out function.so is there any way to solve this problem?
    does the uvc protocal support the camera focus controller?

    jsulmJ 1 Reply Last reply
    0
    • nicker playerN nicker player

      I wrote a program that which used the camera example offered by the qt .but I found the pro could not control the focus of the camera,not the zoom in or zoom out function.so is there any way to solve this problem?
      does the uvc protocal support the camera focus controller?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @nicker-player If you want to get meaningful help you will have to provide more information:

      • What camera is that?
      • On which platform
      • Post the code showing how you're trying to control focuszoom

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      nicker playerN 1 Reply Last reply
      0
      • jsulmJ jsulm

        @nicker-player If you want to get meaningful help you will have to provide more information:

        • What camera is that?
        • On which platform
        • Post the code showing how you're trying to control focuszoom
        nicker playerN Offline
        nicker playerN Offline
        nicker player
        wrote on last edited by
        #3

        @jsulm
        the camera is the common one .I just want to know if the qt camera could support the focus controller of the camera.heres the python code i found that the uvc could support the focus controller.I think maybe thereis some way to control the camera focus the qt

        import cv2
        import uvc

        def do_nothing(x):
        pass
        dev = uvc.device_list()[0]
        cap = uvc.Capture(dev['uid'])
        cap.controls[2].value = 0 # close auto focus
        cv2.namedWindow('img', cv2.WINDOW_NORMAL)
        cv2.createTrackbar('focus', 'img', 0, 127, do_nothing)

        while True:
        focus_val = cv2.getTrackbarPos('focus', 'img')
        cap.controls[3].value = focus_val
        img = cap.get_frame_robust().bgr
        cv2.imshow('img', img)
        key = cv2.waitKey(1)
        if key == 27:
        break

        cv2.destoryAllWindow()
        cap.close()

        jsulmJ 1 Reply Last reply
        0
        • nicker playerN nicker player

          @jsulm
          the camera is the common one .I just want to know if the qt camera could support the focus controller of the camera.heres the python code i found that the uvc could support the focus controller.I think maybe thereis some way to control the camera focus the qt

          import cv2
          import uvc

          def do_nothing(x):
          pass
          dev = uvc.device_list()[0]
          cap = uvc.Capture(dev['uid'])
          cap.controls[2].value = 0 # close auto focus
          cv2.namedWindow('img', cv2.WINDOW_NORMAL)
          cv2.createTrackbar('focus', 'img', 0, 127, do_nothing)

          while True:
          focus_val = cv2.getTrackbarPos('focus', 'img')
          cap.controls[3].value = focus_val
          img = cap.get_frame_robust().bgr
          cv2.imshow('img', img)
          key = cv2.waitKey(1)
          if key == 27:
          break

          cv2.destoryAllWindow()
          cap.close()

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @nicker-player said in how to controll the focus of the camera with the uvc protocal:

          the camera is the common one .I just want to know if the qt camera could support the focus controller of the camera

          So, you don't want to tell us what camera it is, you don't want to show us how you're trying to control it in your Qt app (could be that you're doing something wrong), you don't want to tell us on what platform you are, but you want us to tell you whether it can be supported by Qt? Good luck...

          P.S.: if you post code, please make it readable...

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved