주요 콘텐츠

이 페이지는 기계 번역을 사용하여 번역되었습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.

장치 및 비디오 소스 액세스

이 예제에서는 비디오 장치에 액세스하여 연결하는 방법을 보여줍니다.

이미지 수집 장치 접근

비디오 입력 객체는 MATLAB®와 이미지 수집 장치 간의 연결을 나타냅니다. 비디오 입력 객체를 생성하려면 VIDEOINPUT 함수를 사용하고 객체가 어떤 장치에 연결될지 지정합니다.

% Access an image acquisition device.
vidobj = videoinput('dt', 1, 'RS170')
Summary of Video Input Object Using 'Dt313xK'.

   Acquisition Source(s):  VID0, VID1, and VID2 are available.

  Acquisition Parameters:  'VID0' is the current selected source.
                           10 frames per trigger using the selected source.
                           'RS170' video data to be logged upon START.
                           Grabbing first of every 1 frame(s).
                           Log data to 'memory' on trigger.

      Trigger Parameters:  1 'immediate' trigger(s) on START.

                  Status:  Waiting for START.
                           0 frames acquired since starting.
                           0 frames available for GETDATA.

장치의 비디오 소스 객체 식별

비디오 소스 객체는 단일 엔터티로 처리되는 하나 이상의 물리적 데이터 소스 모음을 나타냅니다. 예를 들어, 하나의 비디오 소스 객체는 RGB 소스의 세 가지 물리적 연결(빨강, 녹색, 파랑)을 나타낼 수 있습니다.

비디오 입력 객체의 Source 속성은 장치에서 사용할 수 있는 비디오 소스 객체의 배열을 제공합니다.

% Access the device's video sources that can be used for acquisition.
sources = vidobj.Source
   Display Summary for Video Source Object Array:

      Index:   SourceName:   Selected:
      1        'VID0'        'on'     
      2        'VID1'        'off'    
      3        'VID2'        'off'  
whos sources
  Name          Size                   Bytes  Class

  sources       1x3                      872  videosource object

Grand total is 47 elements using 872 bytes	

수집을 위한 비디오 소스 객체 선택

이름을 지정하여 비디오 소스 객체를 선택하여 수집할 수 있습니다.

vidobj.SelectedSourceName = 'VID2'

% Notice that the corresponding video source has been selected.
sources
   Display Summary for Video Source Object Array:

      Index:   SourceName:   Selected:
      1        'VID0'        'off'    
      2        'VID1'        'off'    
      3        'VID2'        'on'

현재 선택된 비디오 소스 객체를 얻으려면 GETSELECTEDSOURCE 함수를 사용합니다.

selectedsrc = getselectedsource(vidobj)
   Display Summary for Video Source Object:

      Index:   SourceName:   Selected:
      1        'VID2'        'on'  

비디오 소스 객체의 속성에 액세스하기

각 비디오 소스 객체는 일반 속성과 장치별 속성 목록을 제공합니다.

% List the video source object's properties and their current values.
get(selectedsrc)
  General Settings:
    Parent = [1x1 videoinput]
    Selected = on
    SourceName = VID2
    Tag = 
    Type = videosource
    UserData = []

  Device Specific Properties:
    FirstActiveLine = 21
    FirstActivePixel = 140
    FrameType = interlacedEvenFieldFirst
    StrobeOutput = off
    StrobeOutputDuration = 3.3ms
    StrobeOutputPolarity = activeHigh
    StrobeOutputType = afterFrame
    SyncInput = composite
    TriggerTimeout = 0

참고: 각 비디오 소스 객체는 고유한 속성 구성을 유지합니다. 선택한 비디오 소스를 수정하는 것은 새로운 비디오 소스 구성을 선택하는 것과 같습니다.

% Once the video input object is no longer needed, delete
% it and clear it from the workspace.
delete(vidobj)
clear vidobj