Lazarus中文社区

 找回密码
 立即注册(注册审核可向QQ群索取)

QQ登录

只需一步,快速开始

Lazarus IDE and 组件 下载地址版权申明
查看: 2922|回复: 0

给大家介绍一个debian下摄像头拍照的用法,感觉LINUX操作系统太方便了

[复制链接]

该用户从未签到

发表于 2013-3-28 08:02:43 | 显示全部楼层 |阅读模式
现安装fswebcam:
然后在程序中直接调用fswebcam -d /dev/video0 -r 640x480 -D 1 --rotate 90 ~/cap.jpg
就可以得到照片了。
var
  VProcess: TProcess;
begin
  if Edit2.Text<>'' then
    begin
      Edit2.Text:=Format('%.10d',[strtoint(edit2.text)]);
      VProcess := TProcess.Create(nil);
      try
       VProcess.CommandLine := 'sh -c "fswebcam -d /dev/video0 -D 1 --rotate 90 /windows/document/mmgl/'+Edit2.Text+'.jpg"';
       VProcess.Options := [poWaitOnExit, poUsePipes];
       VProcess.Execute;
       if FileExists('/windows/document/mmgl/'+Edit2.Text+'.jpg') then
         begin
           Image1.Picture.LoadFromFile('/windows/document/mmgl/'+Edit2.Text+'.jpg');
           ImagePath:='/windows/document/mmgl/'+Edit2.Text+'.jpg'
         end
       else showmessage( '摄像头未打开!'+#13+'请检查摄像头!' );
       finally
         VProcess.Free;
       end;
    end
  else
    begin
      Edit2.SetFocus;
      showmessage( '拍照前请输入客户编号!'+#13+'客户编号不能为空!' );
    end;
回复

使用道具 举报

*滑块验证:

本版积分规则

QQ|手机版|小黑屋|Lazarus中国|Lazarus中文社区 ( 鄂ICP备16006501号-1 )

GMT+8, 2025-5-2 21:43 , Processed in 0.029169 second(s), 11 queries , Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表