• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

delphi dxCameraControl控件(拍照)

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

 

 

拍照演示
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;
复制代码
拍照演示

 



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
初学Delphi嵌入汇编[1]-汇编语言与机器语言发布时间:2022-07-18
下一篇:
delphi向其他程序发送模拟按键发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap