title: Why DSHOW can control white balance but OpenCV cannot?
body: <p>I'm working on a Windows standalone app which require to take pictures that will be then be edited.</p>
  <p>For both capturing and editing, I am using OpenCV.</p>
  <p>To keep a consistent behaviour in my editing process, I would like to disable Auto Exposure and Auto White Balance.</p>
  <p>I managed to control exposure with OpenCV, but not White Balance. Although, when I'm using the DSHOW panel, I can change White Balance.</p>
  <p><a href="https://i.stack.imgur.com/ZEbHz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZEbHz.png" alt="DSHOW with OpenCV" /></a></p>
  <p>To open the DSHOW panel, I use the following:</p>
  <pre class="lang-py prettyprint-override"><code>cam.set(cv2.CAP_PROP_SETTINGS, 1)
  </code></pre>
  <p>From OpenCV, I can read the White Balance value setting, but I can't edit it (<code>set(...)</code> returns <code>False</code> when I try to do it). And I can't even read the Auto White Balance setting.</p>
  <pre><code>Auto WB  -1.0
  XI Auto WB  -1.0
  XI Manual WB  -1.0
  WB Temp  -1.0
  WB Blue U  5415.0
  WB Red V  -1.0
  </code></pre>
  <p>According to what I read online, we cannot rely too much on this API as most cameras don't follow the specs.</p>
  <p>I'm wondering what the DSHOW panels does that OpenCV can't ?</p>
  <p>Here is the full script:</p>
  <pre class="lang-py prettyprint-override"><code>import cv2
  
  # I choose DSHOW backend to be able to open
  # the dshow settings window
  cam = cv2.VideoCapture(0, cv2.CAP_DSHOW)
  
  cv2.namedWindow(&quot;test&quot;)
  
  img_counter = 0
  
  while True:
      ret, frame = cam.read()
      if not ret:
          print(&quot;failed to grab frame&quot;)
          break
      cv2.imshow(&quot;test&quot;, frame)
  
      k = cv2.waitKey(1)
  
      # Quit
      if k == ord('q') or k == ord('Q'):
          print(&quot;Closing...&quot;)
          break
      # Open DShow control panel.
      elif k == ord('p') or k == ord('P'):
          print(&quot;Opening director show panel control...&quot;)
          print(cam.set(cv2.CAP_PROP_SETTINGS, 1))
      # Toggle white balance
      elif k == ord('t') or k == ord('T'):
          print(&quot;Change white balance value. Trying different things...&quot;)
          print(cam.set(cv2.CAP_PROP_AUTO_WB, 1))
          print(cam.set(cv2.CAP_PROP_AUTO_WB, 0))
          print(cam.set(cv2.CAP_PROP_AUTO_WB, True))
          print(cam.set(cv2.CAP_PROP_AUTO_WB, False))
          print(cam.set(cv2.CAP_PROP_XI_MANUAL_WB, 1))
          print(cam.set(cv2.CAP_PROP_XI_MANUAL_WB, 0))
          print(cam.set(cv2.CAP_PROP_XI_AUTO_WB, 1))
          print(cam.set(cv2.CAP_PROP_XI_AUTO_WB, 0))
      # Show white balance
      elif k == ord('w') or k == ord('W'):
          print(&quot;White balance settings :&quot;)
          print(&quot;Auto WB &quot;, cam.get(cv2.CAP_PROP_AUTO_WB))
          print(&quot;XI Auto WB &quot;, cam.get(cv2.CAP_PROP_XI_AUTO_WB))
          print(&quot;XI Manual WB &quot;, cam.get(cv2.CAP_PROP_XI_MANUAL_WB))
          print(&quot;WB Temp &quot;, cam.get(cv2.CAP_PROP_WB_TEMPERATURE))
          print(&quot;WB Blue U &quot;, cam.get(cv2.CAP_PROP_WHITE_BALANCE_BLUE_U))
          print(&quot;WB Red V &quot;, cam.get(cv2.CAP_PROP_WHITE_BALANCE_RED_V))
  
  cam.release()
  
  cv2.destroyAllWindows()
  </code></pre>