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

The front camera returns null metadata🐛 #1081

Closed
3 of 4 tasks
ghost opened this issue Jun 6, 2022 · 5 comments · Fixed by #1466
Closed
3 of 4 tasks

The front camera returns null metadata🐛 #1081

ghost opened this issue Jun 6, 2022 · 5 comments · Fixed by #1466
Labels
🐛 bug Something isn't working

Comments

@ghost
Copy link

ghost commented Jun 6, 2022

What were you trying to do?

ANDROID

I was trying to take a picture with the method takePhoto() and with the front facing camera and it returns this metadata:

{
   "Orientation":0,
   "{Exif}":{
      "ApertureValue":0,
      "BrightnessValue":0,
      "ColorSpace":1,
      "DateTimeDigitized":null,
      "DateTimeOriginal":null,
      "ExifVersion":null,
      "ExposureBiasValue":0,
      "ExposureMode":0,
      "ExposureProgram":0,
      "ExposureTime":0,
      "FNumber":0,
      "Flash":1,
      "FocalLenIn35mmFilm":0,
      "FocalLength":0,
      "ISOSpeedRatings":[
         
      ],
      "LensMake":null,
      "LensModel":null,
      "LensSpecification":[
         
      ],
      "MeteringMode":0,
      "OffsetTime":null,
      "OffsetTimeDigitized":null,
      "OffsetTimeOriginal":null,
      "PixelXDimension":0,
      "PixelYDimension":0,
      "SceneType":1,
      "SensingMethod":1,
      "ShutterSpeedValue":0,
      "SubjectArea":[
         
      ],
      "SubsecTimeDigitized":null,
      "SubsecTimeOriginal":null,
      "WhiteBalance":0
   },
   "{TIFF}":{
      "DateTime":null,
      "Make":null,
      "Model":null,
      "ResolutionUnit":0,
      "Software":null,
      "XResolution":0,
      "YResolution":0
   }
}

I need the FocalLength and the FocalLenIn35mmFilm but it is impossible to get it.
The back camera metadata works perfectly btw.

Reproduceable Code

const photo = await cameraRef.current.takePhoto({});

console.log(photo.metadata);

What happened instead?

It returned this null metadata:

{
   "Orientation":0,
   "{Exif}":{
      "ApertureValue":0,
      "BrightnessValue":0,
      "ColorSpace":1,
      "DateTimeDigitized":null,
      "DateTimeOriginal":null,
      "ExifVersion":null,
      "ExposureBiasValue":0,
      "ExposureMode":0,
      "ExposureProgram":0,
      "ExposureTime":0,
      "FNumber":0,
      "Flash":1,
      "FocalLenIn35mmFilm":0,
      "FocalLength":0,
      "ISOSpeedRatings":[
         
      ],
      "LensMake":null,
      "LensModel":null,
      "LensSpecification":[
         
      ],
      "MeteringMode":0,
      "OffsetTime":null,
      "OffsetTimeDigitized":null,
      "OffsetTimeOriginal":null,
      "PixelXDimension":0,
      "PixelYDimension":0,
      "SceneType":1,
      "SensingMethod":1,
      "ShutterSpeedValue":0,
      "SubjectArea":[
         
      ],
      "SubsecTimeDigitized":null,
      "SubsecTimeOriginal":null,
      "WhiteBalance":0
   },
   "{TIFF}":{
      "DateTime":null,
      "Make":null,
      "Model":null,
      "ResolutionUnit":0,
      "Software":null,
      "XResolution":0,
      "YResolution":0
   }
}

Relevant log output

{
   "Orientation":0,
   "{Exif}":{
      "ApertureValue":0,
      "BrightnessValue":0,
      "ColorSpace":1,
      "DateTimeDigitized":null,
      "DateTimeOriginal":null,
      "ExifVersion":null,
      "ExposureBiasValue":0,
      "ExposureMode":0,
      "ExposureProgram":0,
      "ExposureTime":0,
      "FNumber":0,
      "Flash":1,
      "FocalLenIn35mmFilm":0,
      "FocalLength":0,
      "ISOSpeedRatings":[
         
      ],
      "LensMake":null,
      "LensModel":null,
      "LensSpecification":[
         
      ],
      "MeteringMode":0,
      "OffsetTime":null,
      "OffsetTimeDigitized":null,
      "OffsetTimeOriginal":null,
      "PixelXDimension":0,
      "PixelYDimension":0,
      "SceneType":1,
      "SensingMethod":1,
      "ShutterSpeedValue":0,
      "SubjectArea":[
         
      ],
      "SubsecTimeDigitized":null,
      "SubsecTimeOriginal":null,
      "WhiteBalance":0
   },
   "{TIFF}":{
      "DateTime":null,
      "Make":null,
      "Model":null,
      "ResolutionUnit":0,
      "Software":null,
      "XResolution":0,
      "YResolution":0
   }
}

Device

OnePlus 8T (Android 12)

VisionCamera Version

2.13.3

Additional information

@ghost ghost added the 🐛 bug Something isn't working label Jun 6, 2022
@mrousavy
Copy link
Owner

Huh this is really weird, apparently the native camera library cannot get that value, hence it's default value of 0.

exifMap.putInt("FocalLenIn35mmFilm", this.getAttributeInt(ExifInterface.TAG_FOCAL_LENGTH_IN_35MM_FILM, 0))

I don't think I'm doing anything wrong here, might be an issue with CameraX?

@aguedob
Copy link

aguedob commented Aug 3, 2022

Same issue here using a couple of Samsung devices: frontal camera returns null Exif data and Orientation is always 0

@ksegla
Copy link

ksegla commented Sep 22, 2022

I have the same issue. Samsung devices too.

@AjeetSingh2016
Copy link

Did anyone find out the solution

@mrousavy
Copy link
Owner

Hey! I've rewritten the entire Android codebase of VisionCamera from CameraX to Camera2 in the efforts of ✨ VisionCamera V3.

I just now completed the Camera2 rewrite and I believe the core structure is running, but there might be some edge cases to iron out. Can you try and test the PR #1674 for me to see if you can still reproduce this issue here?

Here's an instruction on how you can test that: #1674 (comment)

If the issue cannot be reproduced with that version/PR anymore, then hoorayy, I fixed it! 🎉
Otherwise please let me know and I'll keep this issue open to keep track of it.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants