Last active
August 18, 2018 23:12
-
-
Save zsajjad/8965373be80c6331780ae5ed8e8eb445 to your computer and use it in GitHub Desktop.
Simple Method to capture image and provide it to RNTextDetector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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