Effacer les filtres
Effacer les filtres

How can I set the camera 'BacklightCompensation' property to numeric values?

10 vues (au cours des 30 derniers jours)
I am using an E-Video DC-350 webcam with the Image Acquisition Toolbox through the WINVIDEO adaptor. After creating a VIDEOINPUT object 'vid', I explore the video source object properties as follows:
src = getselectedsource(vid);
get(src)
General Settings:
Parent = [1x1 videoinput]
Selected = on
SourceName = input1
Tag =
Type = videosource
UserData = []
Device Specific Properties:
BacklightCompensation = on
Brightness = 255
BrightnessMode = auto
Contrast = 127
Exposure = 511
ExposureMode = auto
Focus = 58
FrameRate = 15.1500
Gamma = 0
Iris = 4
Saturation = 108
Sharpness = 127
WhiteBalance = 100
WhiteBalanceMode = auto
I get further information about the BacklightCompensation property as follows.
propinfo(src, 'BacklightCompensation')
ans =
Type: 'string'
Constraint: 'enum'
ConstraintValue: {'on' 'off'}
DefaultValue: 'on'
ReadOnly: 'whileRunning'
DeviceSpecific: 1
Therefore, within MATLAB this property can only be 'on' or 'off'. However, in the camera vendor's application or other applications (eg. Adobe Photoshop) that can import from a Twain driver this same property can be set to a numeric value. Unfortunately, when I set the property to either the 'on' or 'off' setting in MATLAB, this results in the property being set to zero (visible in the vendor's application) and the camera exposure is so low that it is essentially unusable except in very bright environments. It appears that when MATLAB creates the VIDEOINPUT object for this device, it does not interpret the allowed values for the BacklightCompensation property correctly. I need to be able to set numeric values for this property.

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 7 Mai 2020
Modifié(e) : MathWorks Support Team le 7 Mai 2020
The Image Acquisition Toolbox uses Microsoft's DirectX technology for image and video capture through the toolbox's WINVIDEO adaptor. This technology defines BacklightCompensation as a boolean valued property, which is why MATLAB is limited to using 'on' or 'off' values for this property.
However, applications that use the TWAIN interface for image or video acquisition may be able to set numerical values for BacklightCompensation within a valid range.
As a workaround, you may write your own interface to set the property to a numeric value over the TWAIN interface before acquiring video using the Image Acquisition Toolbox. Such an interface with TWAIN drivers can be achieved using Generic DLL, MEX or a COM interface.
Depending on what camera you are using, you may also be able to use the webcam interface. Webcam uses the Media Foundation library from windows, which does allow you to set the BacklightCompensation property to numeric values.
Note that the <https://www.mathworks.com/matlabcentral/fileexchange/45182-matlab-support-package-for-usb-webcams MATLAB Support Package for USB >Webcams is designed to always return an RGB image. As of R2020a, conversion of returned colorspace is not available for webcam as it is in videoinput.

Plus de réponses (0)

Produits


Version

R2008a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by