Manual controls on a camera
To keep code complexity low, but offer easier navigation between the different controls, the sample uses partial classes to separate the code that handles specific controls into their own files. Each file is named according to the control they cover, in the format of: MainPage. CameraStarterKit CameraResolution. MediaCapture namespace Windows. MediaCaptureInitializationSettings constructor Windows. VideoDeviceId property Windows.
Set slider control's value to the current value of the ExposureCompensationControl after unregistering the ValueChanged event handler so that the event is not triggered when the value is set. The FlashControl allows you to enable or disable the flash or to enable automatic flash, where the system dynamically determines whether to use the flash.
This control also allows you to enable automatic red eye reduction on devices that support it. These settings all apply to capturing photos. The TorchControl is a separate control for turning the torch on or off for video capture.
This example uses a set of radio buttons to allow the user to switch between on, off, and auto flash settings. A checkbox is also provided to allow toggling of red eye reduction and the video torch. Check to see if the current capture device supports the FlashControl by checking the Supported property. If the FlashControl is supported, automatic red eye reduction may or may not be supported, so check the RedEyeReductionSupported property before enabling the UI. Because the TorchControl is separate from the flash control, you must also check its Supported property before using it.
In the Checked event handler for each of the flash radio buttons, enable or disable the appropriate corresponding flash setting. Note that to set the flash to always be used, you must set the Enabled property to true and the Auto property to false. In the handler for the red eye reduction checkbox, set the RedEyeReduction property to the appropriate value.
Finally, in the handler for the video torch checkbox, set the Enabled property to the appropriate value. On some devices the torch will not emit light, even if TorchControl. Enabled is set to true, unless the device has a preview stream running and is actively capturing video. The recommended order of operations is to turn on the video preview, turn on the torch by setting Enabled to true, and then initiate video capture.
On some devices the torch will light up after the preview is started. On other devices, the torch may not light up until video capture is started. Three different commonly used methods for adjusting the focus of the camera are supported by the FocusControl object, continuous autofocus, tap to focus, and manual focus.
A camera app may support all three of these methods, but for readability, this article discusses each technique separately. This section also discusses how to enable the focus assist light. Enabling continuous autofocus instructs the camera to adjust the focus dynamically to try to keep the subject of the photo or video in focus. This example uses a radio button to toggle continuous autofocus on and off. Check to see if the current capture device supports the FocusControl by checking the Supported property.
Next, determine if continuous autofocus is supported by checking the SupportedFocusModes list to see if it contains the value FocusMode. Continuous , and if so, show the continuous autofocus radio button. In the Checked event handler for the continuous autofocus radio button, use the VideoDeviceController.
FocusControl property to get an instance of the control. Call UnlockAsync to unlock the control in case your app has previously called LockAsync to enable one of the other focus modes.
Create a new FocusSettings object and set the Mode property to Continuous. Set the AutoFocusRange property to a value appropriate for your app scenario or selected by the user from your UI. Pass your FocusSettings object into the Configure method, and then call FocusAsync to initiate continuous autofocus. Autofocus mode is only supported while the preview stream is running.
Check to make sure that the preview stream is running before turning on continuous autofocus. The tap-to-focus technique uses the FocusControl and the RegionsOfInterestControl to specify a subregion of the capture frame where the capture device should focus.
The region of focus is determined by the user tapping on the screen displaying the preview stream. The RegionsOfInterestControl must be supported, and must support at least one region, in order to use this technique. Check the AutoFocusSupported and MaxRegions properties to determine whether to show or hide the radio button for tap-to-focus.
In the Checked event handler for the tap-to-focus radio button, use the VideoDeviceController. Call LockAsync to lock the control in case your app has previously called UnlockAsync to enable continuous autofocus, and then wait for the user to tap the screen to change the focus.
This example focuses on a region when the user taps the screen, and then removes the focus from that region when the user taps again, like a toggle. Use a boolean variable to track the current toggled state. The next step is to listen for the event when the user taps the screen by handling the Tapped event of the CaptureElement that is currently displaying the capture preview stream.
If the camera isn't currently previewing, or if tap-to-focus mode is disabled, return from the handler without doing anything. Get the position of the user's tap from the event args passed into the handler.
This example also uses this opportunity to pick the size of the region that will be focused upon. Pass the tap position and the region size into the TapToFocus helper method that is defined in the next section. This is done in the TapUnfocus helper method shown below. The next task in this helper method is to determine the rectangle within the preview stream that will be assigned to the focus control.
This requires two steps. I had some problems with it previously, but they have all since been addressed. Works very well. Privacy practices may vary, for example, based on the features you use or your age. Learn More. With Family Sharing set up, up to six family members can use this app. Mac App Store Preview. Description Produce the best-quality image your 3rd party webcam can achieve. May 7, Version 2. Ratings and Reviews. This tutorial gives you an overview of what the controls do and where you might use them, but like any other skill the best way to get better is through experience.
Try to take every photo with some manual adjustments, and experiment with the various controls. What do the manual controls actually do? There are 4 manual controls: 1.
0コメント