openalpr react native
openalpr react native Number Plate Recognition Using openALPR API in react-native
openalpr react native
Number Plate Recognition Using openALPR API in react-native
For API key Login here first: http://openalpr.com/
License Plate Recognition in React Native
Follow the Below Code:
send Your image to openALPR API to get recognize the car number plate
const options = { quality: 0.5, base64: true };
const data = await this.camera.takePictureAsync(options); //take image from phone camera
console.log(data.uri);
var secret_key = "Your openALPR API KEY";
var url = "https://api.openalpr.com/v2/recognize_bytes?recognize_vehicle=1&country=in&secret_key="+secret_key;
var xhr = new XMLHttpRequest;
xhr.open("POST", url);
xhr.setRequestHeader( "Content-Type", "multipart/form-data");
// Send POST data and display response
xhr.send(data.base64); // Replace with base64 string of an actual image
xhr.onreadystatechange = async function() {
if (xhr.readyState == 4) {
console.log(xhr.responseText);
// let rec=xhr.responseText;
var obj = JSON.parse(xhr.responseText);
console.log(obj);
console.log(obj.results[0].candidates[0].plate);
alert(obj.results[0].candidates[0].plate); //show number plate in alert box
}
}
![]() |
openalpr react native |