Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Android camera quality


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 7 - Last Post: Jul 30, 2016 2:15 AM Last Post By: Markus Humm
khafan 2016

Posts: 1
Registered: 8/17/16
Android camera quality  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 26, 2016 10:46 PM
Hi

I have working on getting picture from camera in Android but looks like that the Tcameracomponent only return the video quality bitmaps not photo quality. that means in my device which is enable to capture 16 m pictures 5312*2988, the Tcameracomponent just return the max quality of 1920*1080. Also i did try the "AccessCameraApp" sample in Delphi sample projects folder which use the native Android Camera app directly but just return the low quality 640*420 bitmap! i really need to take a high quality picture. is there any way to do so ?
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: Android camera quality  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 27, 2016 12:17 AM   in response to: khafan 2016 in response to: khafan 2016
khafan 2016 wrote:

Also i did try the "AccessCameraApp" sample in Delphi sample projects folder which use the native Android Camera app
directly but just return the low quality 640*420 bitmap! i really need to take a high quality pict ure. is there any
way to do so ?

The sample app doesn't access the camera direct; it uses Embarcadero's Android library to access the camera, and
possibly suffers from the same problem as the FMX code, which is that it assumes the supported sizes come out in the
order of lowest quality first, to largest last. It does not check the actual values for each supported size:

function TAndroidVideoCaptureDevice.DoGetAvailableCaptureSettings: TArray<TVideoCaptureSetting>;
var
  Params: JCamera_Parameters;
  Size: JCamera_Size;
  SizeList, FramerateList: JList;
  I, J: Integer;
  List: TList<TVideoCaptureSetting>;
  Setting: TVideoCaptureSetting;
begin
  SetLength(Result, 0);
  Params := Camera.getParameters;
  if Params <> nil then
  begin
    List := TList<TVideoCaptureSetting>.Create;
    try
      SizeList := Params.getSupportedPreviewSizes;
      FramerateList := Params.getSupportedPreviewFrameRates;
      for I := 0 to SizeList.size - 1 do // <====== Starts from the last in the list, and loops to the first. Sizes are
not sorted in order
// Snip
 
procedure TAndroidVideoCaptureDevice.DoSetQuality(const Value: TVideoCaptureQuality);
var
  Params: JCamera_Parameters;
  SettingsList: TArray<TVideoCaptureSetting>;
  Priority: TVideoCaptureSettingPriority;
begin
  if Value <> TVideoCaptureQuality.CaptureSettings then
  begin
    Priority := CaptureSettingPriority;
    try
      CaptureSettingPriority := TVideoCaptureSettingPriority.Resolution;
      SettingsList := AvailableCaptureSettings;
    finally
      CaptureSettingPriority := Priority;
    end;
 
    if Length(SettingsList) > 0 then
    begin
      case Value of
        TVideoCaptureQuality.PhotoQuality: CaptureSetting := SettingsList[0]; // <======= Assumes the first in the list
is photo quality, which it might not be
// snip


The best way out of it would be to patch the TAndroidVideoCaptureDevice.DoGetAvailableCaptureSettings method in
FMX.Media.Android to make sure the size settings are in the correct order (perhaps by using Sort on the List). Either
that, or write code yourself to use the JCamera and JCamera_Parameters classes.

You should also be aware that Camera (the native class for JCamera) has been deprecated in API 21 of Android in favour
of Camera2, though Camera should still work (for now).

--
Dave Nottage [TeamB]
Hints, tips and tricks at: http://www.delphiworlds.com/blog
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Android camera quality  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 27, 2016 8:27 AM   in response to: Dave Nottage in response to: Dave Nottage
Am 27.07.2016 um 09:17 schrieb Dave Nottage (TeamB):
khafan 2016 wrote:

Also i did try the "AccessCameraApp" sample in Delphi sample projects folder which use the native Android Camera app
directly but just return the low quality 640*420 bitmap! i really need to take a high quality pict ure. is there any
way to do so ?

The sample app doesn't access the camera direct; it uses Embarcadero's Android library to access the camera, and
possibly suffers from the same problem as the FMX code, which is that it assumes the supported sizes come out in the
order of lowest quality first, to largest last. It does not check the actual values for each supported size:

[snip source code]

Hello Dave,

is this issue already reported in QP? if not would you be so kind to
report it and tell us the number so we can vote for it and follow it?

Greetings

Markus
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: Android camera quality  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 27, 2016 1:58 PM   in response to: Markus Humm in response to: Markus Humm
Markus Humm wrote:

is this issue already reported in QP? if not would you be so kind to
report it and tell us the number so we can vote for it and follow it?

No idea whether or not it is reported. I am waiting til I can verify (my Android device went missing some time ago)
before I do so.

--
Dave Nottage [TeamB]
Hints, tips and tricks at: http://www.delphiworlds.com/blog
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Android camera quality  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 28, 2016 8:34 AM   in response to: Dave Nottage in response to: Dave Nottage
Am 27.07.2016 um 22:58 schrieb Dave Nottage (TeamB):
Markus Humm wrote:

is this issue already reported in QP? if not would you be so kind to
report it and tell us the number so we can vote for it and follow it?

No idea whether or not it is reported. I am waiting til I can verify (my Android device went missing some time ago)
before I do so.

Hello,

how can your Android device go missing? ;-)
If it's a phone with a SIM card in you might be able to locate it by
calling it, unless the battery has run out. ;-)

Btw. if it went missing isnide your house you'll surely find it again
sooner or later.

Greetings

Markus
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: Android camera quality  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 29, 2016 2:15 PM   in response to: Markus Humm in response to: Markus Humm
Markus Humm wrote:

how can your Android device go missing? ;-)

It's possible it was stolen.

If it's a phone with a SIM card in you might be able to locate it by
calling it, unless the battery has run out. ;-)

It doesn't have a SIM; it was mostly being used for testing

Btw. if it went missing isnide your house you'll surely find it again
sooner or later.

Yeah, well it's a bit later, and it hasn't turned up ;-)

--
Dave Nottage [TeamB]
Hints, tips and tricks at: http://www.delphiworlds.com/blog
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Android camera quality  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 30, 2016 2:15 AM   in response to: Dave Nottage in response to: Dave Nottage
Am 29.07.2016 um 23:15 schrieb Dave Nottage (TeamB):
Markus Humm wrote:

how can your Android device go missing? ;-)

It's possible it was stolen.

Oh dear. You've had a break in?


If it's a phone with a SIM card in you might be able to locate it by
calling it, unless the battery has run out. ;-)

It doesn't have a SIM; it was mostly being used for testing

Understood. I hope it wasn't too expensive. To be honest: simple devices
for testing can be bought for < 100 USD.


Btw. if it went missing isnide your house you'll surely find it again
sooner or later.

Yeah, well it's a bit later, and it hasn't turned up ;-)

Maybe going the route with providing some demo app and let somebody try
it out on his device and then create the report might be the way to go?

Greetings

Markus
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Android camera quality  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 29, 2016 8:04 AM   in response to: Dave Nottage in response to: Dave Nottage
Am 27.07.2016 um 22:58 schrieb Dave Nottage (TeamB):
Markus Humm wrote:

is this issue already reported in QP? if not would you be so kind to
report it and tell us the number so we can vote for it and follow it?

No idea whether or not it is reported. I am waiting til I can verify (my Android device went missing some time ago)
before I do so.

Hello,

if you provide a sample program demonstrating the issue
somebody having an Android available might test it and then file the bug
report.

Greetings

Markus
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02