使用Delphi程序更改网络摄像头视频的分辨率

发布于 2025-01-01 10:38:45 字数 436 浏览 1 评论 0原文

如何将 VFrames 中网络摄像头的默认大小 (640x360) 更改为新默认值 (160x120)。

我正在使用此组件发现于 此页面

How do I change the size of the webcam from (640x360) as default in VFrames into a (160x120) as the new default.

I'm using this component found on this page.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

-黛色若梦 2025-01-08 10:38:45

VFrames中有一个预定义的方法,

var
  cam:TVideoImage;
  camlist:TStringList;
  reslist:TStringList;
  vp:TVideoProperty;
begin

   camlist := TStringList.Create ;
   reslist :=TStringList.Create;

   cam := TVideoImage.Create;
   cam.GetListOfDevices(camlist);

   cam.SetDisplayCanvas(PaintBox1.Canvas);

   cam.VideoStart(camlist.Strings[0])    ;

   // important 

   cam.GetListOfSupportedVideoSizes(reslist);
   ListBox1.Items := reslist;
   cam.SetResolutionByIndex(0);

   //specify your resolution by index using listbox index
   //this will not only lists resolutions but also other features available , so be careful when selecting the index
end;

确保在视频开始播放后执行GetListOfSupportedVideoSizesSetResolutionByIndex

There is a predefined method in VFrames

var
  cam:TVideoImage;
  camlist:TStringList;
  reslist:TStringList;
  vp:TVideoProperty;
begin

   camlist := TStringList.Create ;
   reslist :=TStringList.Create;

   cam := TVideoImage.Create;
   cam.GetListOfDevices(camlist);

   cam.SetDisplayCanvas(PaintBox1.Canvas);

   cam.VideoStart(camlist.Strings[0])    ;

   // important 

   cam.GetListOfSupportedVideoSizes(reslist);
   ListBox1.Items := reslist;
   cam.SetResolutionByIndex(0);

   //specify your resolution by index using listbox index
   //this will not only lists resolutions but also other features available , so be careful when selecting the index
end;

make sure that GetListOfSupportedVideoSizes and SetResolutionByIndex are executed after the video has started to play

穿透光 2025-01-08 10:38:45

在这个答案中我使用位图图像。

这会比前面的稍微慢一些(但很难注意到)

我们将在每个计时器滴答声上获取图像(例如间隔= 100),将其分配给我们的图像框,然后修改我们的大小,无论是什么默认分辨率是它将获得默认大小的图像(例如:640 * 480),并且在图像框中我们将更改大小。

uses
  ....
  VFrames;

var
 ....
  cam:TVideoImage;

implementation

 procedure TForm6.FormCreate(Sender: TObject);
 begin
  cam := TVideoImage.Create;

  image1.stretch := true ;
  image1.height := 120 ;
  image1.width := 160 ;

end;

 procedure TForm6.Timer1Timer(Sender: TObject);
 begin
   cam.GetBitmap(Image1.Picture.Bitmap);
 end;

 procedure TForm6.Button1Click(Sender: TObject);
 var
   camlist:TStringList;
 begin

   camlist := TStringList.Create ;

   cam := TVideoImage.Create;
   cam.GetListOfDevices(camlist);

   cam.VideoStart(camlist.Strings[0])    ;

end;

in this answer i am using bitmap image.

this will be slightly slower than the previous (but hard to notice)

We are going to get the image on every timer tick (eg interval = 100), assign it to our image box then going to modify our size , no matter what is the default resolution is it will get the default size image(eg: 640 * 480) and in the image box we are going to change the size.

uses
  ....
  VFrames;

var
 ....
  cam:TVideoImage;

implementation

 procedure TForm6.FormCreate(Sender: TObject);
 begin
  cam := TVideoImage.Create;

  image1.stretch := true ;
  image1.height := 120 ;
  image1.width := 160 ;

end;

 procedure TForm6.Timer1Timer(Sender: TObject);
 begin
   cam.GetBitmap(Image1.Picture.Bitmap);
 end;

 procedure TForm6.Button1Click(Sender: TObject);
 var
   camlist:TStringList;
 begin

   camlist := TStringList.Create ;

   cam := TVideoImage.Create;
   cam.GetListOfDevices(camlist);

   cam.VideoStart(camlist.Strings[0])    ;

end;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文