Skip to content

Instantly share code, notes, and snippets.

@zsajjad
Last active August 18, 2018 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zsajjad/8965373be80c6331780ae5ed8e8eb445 to your computer and use it in GitHub Desktop.
Save zsajjad/8965373be80c6331780ae5ed8e8eb445 to your computer and use it in GitHub Desktop.
Simple Method to capture image and provide it to RNTextDetector
/**
* processImage
*
* Responsible for getting image from react native camera and
* starting image processing.
*
* @param {string} uri Path for the image to be processed
* @param {object} imageProperties Other properties of image to be processed
* @memberof App
* @author Zain Sajjad
*/
processImage = async (uri, imageProperties) => {
const visionResp = await RNTextDetector.detectFromUri(uri);
if (!(visionResp && visionResp.length > 0)) {
throw "UNMATCHED";
}
this.setState({
visionResp: this.mapVisionRespToScreen(visionResp, imageProperties)
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment