hjam40 / Camera.MAUI

A CameraView Control for preview, take photos and control the camera options
MIT License
455 stars 72 forks source link

Poor resolution #164

Open Slordo opened 3 months ago

Slordo commented 3 months ago

I'm trying to get images to the highest resolution. In this way:

var result = await cameraView.StartCameraAsync(cameraView.Camera.AvailableResolutions.OrderByDescending
(size => size.Width * size.Height).FirstOrDefault());
if (result != CameraResult.Success)
{
      ResultLabel.Text = "Error starting camera";
      return;
}
cameraView.ForceAutoFocus();
Stream stream = cameraView.SnapShotStream;

My phone (Samsung S23) can take photo 4080x3060, but I take stream 1650x1050. When I change the dimension of cameraview in my xaml file, the stream changes resolution. Actually I have this xaml:

<Grid>
<cv:CameraView 
x:Name="cameraView" 
HeightRequest="550" 
WidthRequest="350" 
HorizontalOptions="FillAndExpand" 
VerticalOptions="FillAndExpand" 
CamerasLoaded="cameraView_CamerasLoaded" />
</Grid>

Where do I make the mistake? Thanks.

Slordo commented 3 months ago

Today I realized something. The actual resolution is the (cv:CameraView) resolution multiplied by 3. 1650x1050 = (550x350) * 3 Anyone have an idea? Thanks.