Comments (4)
Managed to make it work in IOS. Installed it directly from github using npm install git+https://github.com/RobertSasak/react-native-openalpr/
Followed installation instructions but had to also add the framework AssetsLibrary.framework in xcode and finally used the example inside the folder Example (I put it in an App.js as a test).
Code:
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
StatusBar,
Button,
} from 'react-native';
import Camera from 'react-native-openalpr';
const styles = StyleSheet.create({
container: {
flex: 1,
},
textContainer: {
position: 'absolute',
top: 100,
right: 50,
bottom: 0,
},
text: {
textAlign: 'center',
fontSize: 20,
},
preview: {
flex: 1,
justifyContent: 'flex-end',
alignItems: 'center',
},
overlay: {
position: 'absolute',
padding: 16,
alignItems: 'center',
},
topOverlay: {
top: 0,
left: 0,
right: 0,
backgroundColor: 'rgba(0, 255, 0, 0.4)',
alignItems: 'center',
},
bottomOverlay: {
right: 0,
left: 0,
bottom: 0,
backgroundColor: 'rgba(255,0,0,0.4)',
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
}
});
export default class App extends React.Component {
constructor(props) {
super(props);
this.camera = null;
this.state = {
camera: {
aspect: Camera.constants.Aspect.fill,
},
plate: 'Scan a plate',
};
}
onPlateRecognized = ({ plate, confidence }) => {
if (confidence > 90) {
this.setState({
plate,
})
}
}
render() {
return (
<View style={styles.container}>
<StatusBar
animated
hidden
/>
<Camera
ref={(cam) => {
this.camera = cam;
}}
style={styles.preview}
aspect={this.state.camera.aspect}
captureQuality={Camera.constants.CaptureQuality.medium}
country="us"
onPlateRecognized={this.onPlateRecognized}
plateOutlineColor="#ff0000"
showPlateOutline
torchMode={Camera.constants.TorchMode.off}
touchToFocus
/>
<View style={[styles.overlay, styles.topOverlay]}>
</View>
<View style={[styles.overlay, styles.bottomOverlay]}>
</View>
<View style={styles.textContainer}>
<Text style={styles.text}>{this.state.plate}</Text>
</View>
</View>
);
}
}
To prevent the yellow box message regarding "requiresMainQueueSetup" in "ALPRCameraManager" I added in the file ALPRCameraManager.mm inside RNOpenAlpr.xcodeproj in Libraries the following:
+(BOOL) requiresMainQueueSetup{
return YES;
}
To be honest this is just a patch, maybe openalpr will fix it someday.
from react-native-openalpr.
Having the same issue here. Could you find a way to fix it?
from react-native-openalpr.
@andresrabinovich Do you mind to create a small PR regarding requiresMainQueueSetup ? I am sure it will take no more than few minutes.
from react-native-openalpr.
Closing this issue as master is published to NPM as 1.2.0.
from react-native-openalpr.
Related Issues (20)
- Doesit support UAE vehicle plate number? HOT 1
- _reactNativeOpenalpr.takePicture in android on press of take picture? HOT 5
- TypeError: null is not an object (evaluating 'ALPRCameraManager.Aspect') HOT 2
- Try yo test example error with npm start HOT 2
- app crashes on android device HOT 1
- fix libstdc not found without modifying podfile (eas) HOT 3
- not support for react native 0.64.0 HOT 3
- I met some Errors on Example Project HOT 8
- How do I use to detect license plate from static image? HOT 1
- react-native-camera is deprecated. HOT 1
- Configuration with name 'compile' not found. HOT 1
- Can I get result with dash? HOT 1
- ^ 'FlipperKit/FlipperClient.h' file not found HOT 1
- It can be used with expo-project? HOT 1
- React-native camera not working HOT 7
- Support scanning multiple countries at once
- Possible to return the country of the license plate recognised? HOT 1
- Not recognizing plates on IOS
- Project with path ':openalpr' could not be found in project ':react-native-openalpr'. HOT 1
- Cannot read property 'Aspect' of null HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-openalpr.