Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Cross-Platform-Entwicklung (https://www.delphipraxis.net/91-cross-platform-entwicklung/)
-   -   Delphi ACamera - winsoft (https://www.delphipraxis.net/195515-acamera-winsoft.html)

danten 6. Mär 2018 17:06

ACamera - winsoft
 
Hello,
are you using an Android Camera component from Winsoft?
I need to advise how to use AutoFocus mode when shooting.

When I click the button to automatically focus the camera on the media and focus it, it saves the photo in the ACamera.TakePicture procedure.

It will surely be set in onAutoFocusMove.

Thanks for the help.

arnof 6. Mär 2018 18:51

AW: ACamera - winsoft
 
Hi i use TACammera in my app:

https://play.google.com/store/apps/d...re.produktscan

onAutofocus don't fire while my testings with nexus 5

The Autofocus works i take pictures while using the gyrosensor. if the phone stop moving i start scanning the pictures

danten 6. Mär 2018 19:11

AW: ACamera - winsoft
 
Thank you,
please write your code.
I use object photography, I do not use QRcode scanning.
I use:
Delphi-Quellcode:
procedure TFormMain.ButtonTakePictureClick(Sender: TObject);
begin
  ACamera.FocusMode := foAuto;
  ACamera.TakePicture;
end;

procedure TFormMain.ACameraPictureTaken(Sender: TObject; Data: TArray<System.Byte>);
begin
  TFile.WriteAllBytes(TPath.Combine(dirImages, edName.Text + '.jpg'), Data);
end;

arnof 6. Mär 2018 20:54

AW: ACamera - winsoft
 
in ScanBitmap is the live Picture:



Delphi-Quellcode:
procedure TFM_Scann.ACameraDataReady(Sender: TObject; var ReleaseData: Boolean);
begin


 if (Processing = 0) and (barcodescanning=0) then
  begin
    Inc(Processing);
    try
     ACamera.DataToRgba(@RgbaData[0], ACamera.PreviewRotation, ACamera.PreviewHorizMirror);
     ....


    if (ACamera.PreviewRotation = ro0) or (ACamera.PreviewRotation = ro180) then
     ACamera.UpdateBitmap(ScanBitmap, @RgbaData[0], RgbaDataWidth, RgbaDataHeight)
    else
     ACamera.UpdateBitmap(ScanBitmap, @RgbaData[0], RgbaDataHeight, RgbaDataWidth);

     ....

   finally
    Dec(Processing);
   end;


end;

arnof 6. Mär 2018 21:48

AW: ACamera - winsoft
 
Zitat:

Zitat von danten (Beitrag 1395367)
Thank you,
please write your code.
I use object photography, I do not use QRcode scanning.
I use:
Delphi-Quellcode:
procedure TFormMain.ButtonTakePictureClick(Sender: TObject);
begin
  ACamera.FocusMode := foAuto;
  ACamera.TakePicture;
end;

procedure TFormMain.ACameraPictureTaken(Sender: TObject; Data: TArray<System.Byte>);
begin
  TFile.WriteAllBytes(TPath.Combine(dirImages, edName.Text + '.jpg'), Data);
end;

Set

ACamera.FocusMode := foAuto;

before you take the picture (not a line before) .... the phone need a while to set the focus

danten 6. Mär 2018 22:14

AW: ACamera - winsoft
 
Ok, I got it solved.

Delphi-Quellcode:

procedure TFormMain.ButtonTakePictureClick(Sender: TObject);
begin
  ACamera.FocusMode := foAuto;
  ACamera.AutoFocus; // call onAutoFocus
end;

procedure TFormMain.ACameraAutoFocus(Sender: TObject; Success: Boolean);
begin
  if success = True then // when it is focused then Take Picture
  begin
    ACamera.TakePicture;
  end;
end;

procedure TFormMain.ACameraPictureTaken(Sender: TObject; Data: TArray<System.Byte>);
begin
  TFile.WriteAllBytes(TPath.Combine(dirImages, edName.Text + '.jpg'), Data);
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 04:44 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz