이 페이지는 기계 번역을 사용하여 번역되었습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.
속성 작업
이 예제에서는 비디오 수집 속성에 액세스하고 구성하는 방법을 보여줍니다.
속성 접근
객체의 속성과 현재 값의 전체 목록에 액세스하려면 객체와 함께 get 함수를 사용합니다.
% Create a video input object. vidobj = videoinput('dcam', 1); % List the video input object's properties and their current values. get(vidobj)
General Settings:
DeviceID = 1
DiskLogger = []
DiskLoggerFrameCount = 0
EventLog = [1x0 struct]
FrameGrabInterval = 1
FramesAcquired = 0
FramesAvailable = 0
FramesPerTrigger = 10
Logging = off
LoggingMode = memory
Name = RGB24_640x480-dcam-1
NumberOfBands = 3
Previewing = off
ReturnedColorSpace = rgb
ROIPosition = [0 0 640 480]
Running = off
Tag =
Timeout = 10
Type = videoinput
UserData = []
VideoFormat = RGB24_640x480
VideoResolution = [640 480]
Callback Function Settings:
ErrorFcn = @imaqcallback
FramesAcquiredFcn = []
FramesAcquiredFcnCount = 0
StartFcn = []
StopFcn = []
TimerFcn = []
TimerPeriod = 1
TriggerFcn = []
Trigger Settings:
InitialTriggerTime = []
TriggerCondition = none
TriggerFrameDelay = 0
TriggerRepeat = 0
TriggersExecuted = 0
TriggerSource = none
TriggerType = immediate
Acquisition Sources:
SelectedSourceName = input1
Source = [1x1 videosource]
% Access the currently selected video source object src = getselectedsource(vidobj); % List the video source object's properties and their current values. get(src)
General Settings:
Parent = [1x1 videoinput]
Selected = on
SourceName = input1
Tag =
Type = videosource
Device Specific Properties:
AutoExposure = 511
AutoExposureMode = auto
Brightness = 304
BrightnessMode = auto
FrameRate = 15
Gain = 87
Gamma = 1
Saturation = 90
Sharpness = 80
Shutter = 6
WhiteBalance = [95 87]
WhiteBalanceMode = auto
특정 속성 값에 액세스하려면 객체와 속성 이름에 점 표기법을 사용합니다.
framesPerTriggerValue = vidobj.FramesPerTrigger;
framesPerTriggerValue =
10
brightnessValue = src.Brightness;
brightnessValue = 304
속성 구성
열거형 속성에는 가능한 값의 정의된 집합이 있습니다. 속성의 열거된 값을 나열하려면 객체와 속성 이름과 함께 set 함수를 사용합니다. 속성의 디폴트 값은 중괄호 안에 나열되어 있습니다.
set(vidobj, 'LoggingMode')
[ {memory} | disk | disk&memory ]
객체의 구성 가능한 속성의 전체 목록에 액세스하려면 객체와 함께 set 함수를 사용합니다.
% List the video input object's configurable properties.
set(vidobj)
General Settings:
DiskLogger
FrameGrabInterval
FramesPerTrigger
LoggingMode: [ {memory} | disk | disk&memory ]
Name
ReturnedColorSpace: [ {rgb} | grayscale | YCbCr ]
ROIPosition
Tag
Timeout
UserData
Callback Function Settings:
ErrorFcn: string -or- function handle -or- cell array
FramesAcquiredFcn: string -or- function handle -or- cell array
FramesAcquiredFcnCount
StartFcn: string -or- function handle -or- cell array
StopFcn: string -or- function handle -or- cell array
TimerFcn: string -or- function handle -or- cell array
TimerPeriod
TriggerFcn: string -or- function handle -or- cell array
Trigger Settings:
TriggerFrameDelay
TriggerRepeat
Acquisition Sources:
SelectedSourceName: [ {input1} ]
% List the video source object's configurable properties.
set(src)
General Settings:
Tag
Device Specific Properties:
AutoExposure
AutoExposureMode: [ {auto} | manual ]
Brightness
BrightnessMode: [ {auto} | manual ]
FrameRate: [ {15} | 7.5 | 3.75 ]
Gain
Gamma
Saturation
Sharpness
Shutter
WhiteBalance
WhiteBalanceMode: [ {auto} | manual ]
객체의 속성 값을 구성하려면 객체, 속성 이름, 속성 값에 점 표기법을 사용합니다.
vidobj.TriggerRepeat = 2; src.Saturation = 100;
속성 도움말 및 정보 얻기
속성에 대한 설명을 얻으려면 객체와 속성 이름과 함께 imaqhelp 함수를 사용합니다. imaqhelp는 함수 도움말에도 사용할 수 있습니다.
imaqhelp(vidobj, 'LoggingMode')
LOGGINGMODE [ {memory} | disk | disk&memory ] (Read-only: whileRunning)
LoggingMode specifies the destination for acquired data.
LoggingMode can be set to disk, memory,or disk&Memory.
If LoggingMode is set to disk, then acquired data is streamed to a disk file
as specified by the DiskLogger property.
If LoggingMode is set to memory, acquired data is stored in a memory buffer.
If LoggingMode is set to disk&Memory, then acquired data is stored in memory
and is streamed to a disk file as specified by the DiskLogger property.
When logging to memory, you must extract the data in a timely manner with the
GETDATA function. If the data is not extracted in a timely manner, memory
resources may be used up.
The value of LoggingMode cannot be modified while the object is running.
See also DiskLogger, IMAQDEVICE/GETDATA.
속성의 특성에 대한 정보를 얻으려면 객체와 속성 이름과 함께 propinfo 함수를 사용합니다.
propinfo(vidobj, 'LoggingMode')
ans =
Type: 'string'
Constraint: 'enum'
ConstraintValue: {'memory' 'disk' 'disk&memory'}
DefaultValue: 'memory'
ReadOnly: 'whileRunning'
DeviceSpecific: 0
더 이상 이미지 수집 객체가 필요하지 않으면 메모리에서 제거하고 관련 변수의 MATLAB® 작업 공간을 지웁니다.
delete(vidobj);
clear vidobj