delphi dxCameraControl控件(拍照)

2022-12-14 09:36:02 作者:admin

本文整理自网络,侵删。

 拍照演示DevExpressVCL 组件之一
TdxCameraControl ObjectHierarchy   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.DeviceIndexTdxCustomCameraControl
通过索引指定当前控件的摄像头处于激活;
Syntax
property DeviceIndex: Integer; Description
控件是通过在设备管理器中注册的摄像机列表(也称为网络摄像机或成像设备)中的索引来识别的。默认情况下,控件被设置为访问列表中的第一个相机。如果注册了多个摄像机,可以使用DeviceIndex属性选择所需的摄像机。
终端用户可以使用控件的设置弹出菜单中的设备子菜单在相机之间切换。
TdxCustomCameraControl.StateTdxCustomCameraControl
Indicates the camera control's current state.Syntax
 
type  TdxCameraControlState = (ccsInactive, ccsInitializing, ccsRunning, ccsPaused, ccsNoDevice, ccsDeviceIsBusy);property State: TdxCameraControlState; 
Description
Values include:
 
ValueDescriptionccsInactive摄像机控制处于非活动状态。该状态对应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;复制代码拍照演示
来源:https://www.cnblogs.com/win32pro/p/5267247.html

相关阅读 >>

Delphi获取宽带ip

Delphi cardpanel1 简单的切换

idhttp访问网页出现socket error #10054错误

Delphi 字符串处理单元

Delphi xe5 unicodestring的由来

Delphi版文件夹加密软件源代码

Delphi incyear、incmonth、incweek、incday、inchour、incminute、incsecond、incmillisecond �c 增时

Delphi调用命令行命令并获取返回信息

Delphi sysutils.comparetext的注释

Delphi格式化函数format、formatdatetime和formatfloat

更多相关阅读请进入《Delphi》频道 >>



在线咨询 拨打电话