Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Professional Camera Component for your FireMonkey Windows Applications

Intro

The FireMonkey Camera component, built by WINSOFT, allows you to configure all the available options of your Camera hardware. It includes Audio configurations, like Audio Compressor, available audio devices, and supports multiple video configurations.

Overview

This FireMonkey Camera component uses DirectShow 9 API. The Microsoft DirectShow application programming interface (API) is a media-streaming architecture for Microsoft Windows. 

The camera component is a commercial component that has a trial version with all features for evaluation. If and if you wish to distribute the Camera component as a part of your project, you should get a license.

Specifications

Installation

The installation of the FireMonkey camera component by WINSOFT is easy. Just download the installer and close the RAD Studio then install it. Or you can watch the installation video here.

Development

After installing the camera component, you will have the FCamera component in the IDE.

Just drag and drop the component and also TPanel or TPaintBox component for the Preview Control property of the FCamera component.

Now you are good to go.

Let’s investigate our demo project now.

I would recommend checking out the demo action video which shows how this component works

Here is the UI:

How do I get the available camera devices?

procedure ...;
begin
  ...
  var Devices: TFVideoCaptureDevices := FCamera.Devices;
  ...
  for var I: Integer := 0 to Length(Devices) - 1 do
      ComboBoxCamera.Items.Add(Devices[I].Name);
  ...
end;

How do I set formats?

 if ComboBoxFormat.Enabled then
  begin
    var Formats: TFCameraFormats := FCamera.SupportedFormats;
    for var I: Byte := 0 to Length(Formats) - 1 do
      if Formats[I].AvgTimePerFrame = 0 then
        ComboBoxFormat.Items.Add(IntToStr(Formats[I].Width) + 'x' + IntToStr(Formats[I].Height) + ' ' + IntToStr(Formats[I].BitsPerPixel) + 'bpp')
      else
        ComboBoxFormat.Items.Add(IntToStr(Formats[I].Width) + 'x' + IntToStr(Formats[I].Height) + ' ' + IntToStr(10000000 div Formats[I].AvgTimePerFrame) + 'Hz ' + IntToStr(Formats[I].BitsPerPixel) + 'bpp');
  end

How can I manipulate the other configurations like Zooming?

With the FCamera component, you should first check if that option is available for you then you can set the parameters.

For instance:

if FCamera.DeviceName <> '' then
begin
  if FCamera.ZoomSupported then
    SetTrackBar(LabelZoom, TrackBarZoom, CheckBoxZoom, FCamera.Zoom, FCamera.ZoomRange, FCamera.ZoomAuto);

  if FCamera.RollSupported then
    SetTrackBar(LabelRoll, TrackBarRoll, CheckBoxRoll, FCamera.Roll, FCamera.RollRange, FCamera.RollAuto);
  ...
end;

How do I save images?

There is a CurrentImageToFile function here is the use case:

procedure TFormMain.ButtonSaveCurrentImageClick(Sender: TObject);
begin
  FCamera.CurrentImageToFile('image_name.bmp');
end;

Be sure to check the whole demo project, and Happy Coding!

Like what you see? You can get the Camera for FireMonkey component, along with over 100 other fantastic WinSoft components, with our Enterprise Component Pack. For a limited time, when you purchase RAD Studio 10.4Enterprise or Architect Edition at special Upgrade Pricing, you will also get this package of third-party software worth over $13,000, including the full WinSoft Component Library, at NO EXTRA COST! Step up to RAD Studio 10.4 today!

Exit mobile version