• delphi dxCameraControl控件(拍照)


    拍照演示
    DevExpressVCL 组件之一
     
    TdxCameraControl Object
    Hierarchy   Properties   Methods   Events
     
    一个摄像头控件
    Unit dxCameraControl
     
    Syntax
     
    TdxCameraControl = class(TdxCustomCameraControl)
     
    Descrition
     
    该控件允许您捕捉视频或图像从内置/连接的网络摄像头或设备、前后摄像头。也可以访问指定的摄像头,并可以预览;
     
    该控件实现与摄像机相关联的基本功能。它使用允许您执行以下操作:
     
     
     
    可以指定图像/视频捕获的摄像机,并获取其名称:(DeviceIndex和DeviceName)。
     
    可以控制摄像机的视频:活动、暂停、播放和停止 (Active, Pause, Play, Stop).
     
    会列出来支持的摄像机分辨率,用户可以选择一个分辨率或者分辨率索引用于输出:(Resolutions 和ResolutionIndex).
     
    可以缩放渲染图像(FitMode)。
     
    捕获截屏当前渲染的图像并访问它:(Capture 和 CapturedBitmap).
     
    获取控件的当前状态,以及状态更改事件(state和OnStateChanged)。
     
    启用设置按钮,提供用户对弹出菜单的访问,您也可以以编程方式调用该菜单(ShowSettingsButton和ShowSettingsToolbar)。
     
    TdxCameraControl Properties(属性)
    TdxCameraControl   Legend
     
    Derived from TdxCustomCameraControl      
     
    Active      激活控件
     
    BorderStyle      控件的边框风格
     
    CapturedBitmap      捕捉的图像
     
    DeviceIndex      摄像头设备索引
     
    DeviceName      当前摄像头的名字
     
    FitMode      填充模式
     
    ResolutionCount      返回当前访问的摄像机支持的分辨率数目
     
    ResolutionIndex      返回当前分辨率的索引
     
    Resolutions      分辨率
     
    State      控件当前的状态
     
    ShowSettingsButton  是否显示设置按钮
     
    TdxCameraControl Methods(方法)
    TdxCameraControl   Legend
     
    Derived from TdxCustomCameraControl      
     
    Capture      从当前摄像头捕获一张图片
     
    Pause      使当前摄像头处于暂停状态
     
    Play         使当前摄像头处于预览输出状态
     
    ShowSettingsToolbar      调用设置弹出菜单。
     
    Stop  停止渲染从摄像头获得的输出帧,使摄像头处于不激活的状态。
     
     
    TdxCustomCameraControl Events(事件)
    TdxCustomCameraControl   Legend
     
    In TdxCustomCameraControl      
     
    OnStateChanged  控件状态发生变化时 
     
    TdxCustomCameraControl.DeviceIndex
    TdxCustomCameraControl
     
    通过索引指定当前控件的摄像头处于激活;
     
    Syntax
     
    property DeviceIndex: Integer;
     
    Description
     
    控件是通过在设备管理器中注册的摄像机列表(也称为网络摄像机或成像设备)中的索引来识别的。默认情况下,控件被设置为访问列表中的第一个相机。如果注册了多个摄像机,可以使用DeviceIndex属性选择所需的摄像机。
     
    终端用户可以使用控件的设置弹出菜单中的设备子菜单在相机之间切换。
     
    TdxCustomCameraControl.State
    TdxCustomCameraControl
     
    Indicates the camera control‘s current state.Syntax
     
     
     
    type  TdxCameraControlState = (ccsInactive, ccsInitializing, ccsRunning, ccsPaused, ccsNoDevice, ccsDeviceIsBusy);property State: TdxCameraControlState;
     
     
    Description
     
    Values include:
     
     
     
    ValueDescription
    ccsInactive摄像机控制处于非活动状态。该状态对应sdxCameraInactive。除此之外,所有其他状态都与摄像机控制有关。
    ccsInitializing摄像机控件正在初始化以捕获或呈现摄像机输出。此状态对应于sdxCameraInitializing。
    ccsRunning控件在其表面呈现摄像机的输出。(预览) 
    ccsPaused摄像头处于暂停状态
    ccsNoDevice相机控件无法找到所选相机或当前已关闭。此状态对应sdxcameranotdetection。
    ccsDeviceIsBusy设备处于锁定状态。    
     
    这是个只读属性。
     
     
    Active:True
     
    DeviceIndex:设备号,默认为0
     
    其他方法
     
    procedure Capture; //捕获
    procedure Pause; //暂停
    procedure Play; //播放
    procedure Stop; //停止
    property State: TdxCameraControlState read FState; //设备状态
    设计界面
    技术图片
    代码
     
    复制代码
    //拍照并在cxImage中显示
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      dxCameraControl1.Capture;
      cxImage1.Picture.Assign(dxCameraControl1.CapturedBitmap);
    end;
    //保存图片
    procedure TForm1.Button3Click(Sender: TObject);
    begin
      if SavePictureDialog1.Execute then
      begin
        cxImage1.Picture.SaveToFile(SavePictureDialog1.FileName);
      end;
    end;
    复制代码
    拍照演示
    技术图片

    好的代码像粥一样,都是用时间熬出来的
  • 相关阅读:
    hdu 2444 交叉染色判断二分图+二分最大匹配
    uva 交叉染色法10004
    poj 3177&&3352 求边双联通分量,先求桥,然后求分量( 临界表代码)
    poj 3177&&poj 3352加边构双联通(有重边)用tarjan 模板求的
    poj 3006水题打素数表
    POJ 3352 无向图边双连通分量,缩点,无重边
    hdu 1430 魔板 康托展开 + 很好的映射
    D. Artsem and Saunders 数学题
    vijos P1412多人背包 DP的前k优解
    1475 建设国家 DP
  • 原文地址:https://www.cnblogs.com/jijm123/p/14256970.html
Copyright © 2020-2023  润新知