Skip to content
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.

Add skip processing on android for fast picture saving #1428

Merged
merged 2 commits into from
Apr 3, 2018
Merged

Add skip processing on android for fast picture saving #1428

merged 2 commits into from
Apr 3, 2018

Conversation

ospfranco
Copy link

I'm trying to solve the slow picture taking problem on android, the problem is the decoding/enconding everytime a image is taken, I solved it by skipping processing all together and directly saving the pic to the file system, this makes it really fast.

However one problem remains, orientation, I've been trying to get around it in several ways, but if you want to keep it fast, the only way seems to be by setting the view orientation before taking the photo, this causes two consequences:

  1. we need to detect orientation before the photo is taken (I need help here, not an android developer)*
  2. if you rotate the preview View, then x and y axis are inverted and it is really weird to use
  • one other problem I had was that our app is locked to portrait mode, so I read somewhere we need to use accelerator information and not the usual config change workflow.

I need some help getting the last stretch done. @sibelius @jgfidelis

@sibelius
Copy link
Collaborator

sibelius commented Apr 3, 2018

How fast is this?

@ospfranco
Copy link
Author

ospfranco commented Apr 3, 2018

Decoding, processing and re-coding takes ~2-3 seconds on a moto g5 running android 7, just saving the image goes down to ~20-60ms in my tests

@jgfidelis
Copy link
Collaborator

This looks ok, just add the option to the doc as android only, please.

About the problem, I cannot help you right now, but if any other dev can, it would be of great value.

Sorry to ask, but what is in fact the orientation problem?

@ospfranco
Copy link
Author

rotating the image to correct device orientation, since I'm saving the byte array straight to memory, decoding/encoding is not possible, so this needs to be done on the preview (before the takePicture call)

@ospfranco ospfranco merged commit 88f3109 into react-native-camera:master Apr 3, 2018
@ospfranco
Copy link
Author

merged into master, the rotation problem can be fixed later.

Fconstant pushed a commit that referenced this pull request Apr 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants