Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Camera]: Proposal to expose Intrinsic parameters like Focal Length and Principal Points in Flutter #78617

Open
smoothumut opened this issue Mar 19, 2021 · 5 comments
Labels
new feature p: camera p: first party P5 passed first triage plugin proposal

Comments

@smoothumut
Copy link

@smoothumut smoothumut commented Mar 19, 2021

We are going to develop a mobile app that is going to take photos. But the app is supposed to get camera's intrinsic parameters like focal length and principal points in order to help us to calibrate and process the images we take. If it is already available, I will be really appreciated if you point it out, But if not available, it would be great to have that info in order to go deep in photography with flutter for our case and other use cases.

@iapicca
Copy link
Contributor

@iapicca iapicca commented Mar 20, 2021

@smoothumut
some info are already available (see example)

  double _minAvailableExposureOffset = 0.0;
  double _maxAvailableExposureOffset = 0.0;
  double _currentExposureOffset = 0.0;
// 
  double _minAvailableZoom = 1.0;
  double _maxAvailableZoom = 1.0;
  double _currentScale = 1.0;

but it would be nice if more of the api would be exposed

@darshankawar darshankawar added the in triage label Mar 22, 2021
@darshankawar darshankawar changed the title Camera Intrinsic parameters in Flutter [Camera]: Proposal to expose Intrinsic parameters like Focal Length and Principal Points in Flutter Mar 22, 2021
@darshankawar
Copy link
Member

@darshankawar darshankawar commented Mar 22, 2021

Related to #31225

@darshankawar darshankawar added p: camera p: first party plugin proposal new feature passed first triage and removed in triage labels Mar 22, 2021
@cyanglaz cyanglaz added the P4 label Apr 1, 2021
@dgmouris
Copy link

@dgmouris dgmouris commented Apr 7, 2021

I would love to see a simple way to get focal distance and sensor height as well.

Thanks folks for your hard work on this package:)

@etozzato
Copy link

@etozzato etozzato commented Oct 8, 2021

Yesterday I started messing with the camera and camera_platform_interface plugin and exposing lensAperture was a breeze (low hanging fruit!) - we are also looking at exposing a few new parameters and the depth map;

We'll probably create a new plugin that extends the existing, since the first concern is to maintain compatibility with the core plugins!

Ping me if you want to join forces!

@etozzato
Copy link

@etozzato etozzato commented Dec 16, 2021

I have been pinged about the previous comment! Depth is done.
I've made enormous progress on the iOS front, almost nothing on the android side :(
This could be useful snippet - it assumes that depth capture is supported and enabled and that we have the color capture in scope as uiimage

  AVDepthData *depthData = [photo depthData];
  if (depthData != nil) {
    @try {
      // intrinsicMatrix
      AVCameraCalibrationData *calibrationData = [depthData cameraCalibrationData];
      CGFloat pixelSize = [calibrationData pixelSize];
      matrix_float3x3 intrinsicMatrix = [calibrationData intrinsicMatrix];
      CGSize referenceDimensions = [calibrationData intrinsicMatrixReferenceDimensions];
      CGFloat photoWidth = uiimage.size.width;
      CGFloat photoHeight = uiimage.size.height;
      CGFloat ratio = referenceDimensions.height / photoWidth;

      CGFloat fx = intrinsicMatrix.columns[1][1] / ratio;
      CGFloat fy = intrinsicMatrix.columns[0][0] / ratio;
      CGFloat cx = photoWidth - intrinsicMatrix.columns[2][1] / ratio;
      CGFloat cy = intrinsicMatrix.columns[2][0] / ratio;

It has been a painful but fun trial & error adventure, I hope we'll be able to release the final work as a camera++ plugin early next year!

@stuartmorgan stuartmorgan added P5 and removed P4 labels Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature p: camera p: first party P5 passed first triage plugin proposal
Projects
None yet
Development

No branches or pull requests

7 participants