-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
barcodeScan mask flipped view #2886
Comments
I don't really understand the question here, this might be better off asked on the community discord. |
@Win546 inverted value of x and y on IOS right ? |
yes, from what i understood, the x and y on ios are tilted, i think for the orientation of the camera (on android after the scaling the point are where they should be ),so when i scale with the camera resolution dosen't work as aspected. |
I'm also can reproduce this bug(Iphone 6S iOS 15.8.2) |
I am not sure if I understood the question right but comments are right. x and y values are inverted on ios. I updated to @4.3.2 few weeks ago and the problem still persist. Also width and height might be inverted too. On the other hand there is no problem on android. |
yes, exactly what you said! |
I just inverted x, y and width, height values for ios as workaround and it's working fine. For android I just use values as it is. I was using the values to calculate if scanned barcode inside the rectangle or not. |
VisionCamera exposes |
Always open to PRs of course. |
Question
Hi good morning,
So i've implemented a code that should scan the camera and take for valid only the code that are inside a mask, at the center of the screen, but the position are not visually where they should be, iv0e use some sort of view upon the camera to check if the point fall within this mask region, but for some reason the the point are flipped,( maybe the orientation) i don't know, any way i've tried to scale down the position based on screen width and height / camera height and width, ( but opposite because of the tilted, like this {height:width, width: height}) on android works pretty well, but on ios seem to be flipped in another way, obviously not the correct one ahahah
i don't know if can be the framework that we're using to build the app, draftbit, works good, but flipped
if you can help me ii'd very helpful, thanks in advanced
What I tried
const onCodeScanned = (codes,frame) => {
// Scaling factors
const scaleX = screenWidth / (cameraResolution.width+(Platform.OS === 'ios' ? 50: 40));
const scaleY = screenHeight / (cameraResolution.height+(Platform.OS === 'ios' ? 180: 170));
setCoordinates(absCoords);
// rest of the code //
return (
<View style={{ flex: 1}}>
<Camera
{...props}
zoom={device?.neutralZoom ?? 1}
device={device}
isActive={true}
codeScanner={codeScanner}
onCameraReady={onCameraReady}
style={(StyleSheet.absoluteFill), { flex: 1 }}
resizeMode={'cover'}
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
backgroundColor: '#000',
},
pointDebug: {
position: 'absolute',
width: 4,
height: 4,
borderRadius: 5,
backgroundColor: 'yellow',
},
pointDebugCorner1: {
position: 'absolute',
width: 10,
height: 10,
borderRadius: 5,
backgroundColor: 'red',
},
pointDebugCorner2: {
position: 'absolute',
width: 10,
height: 10,
borderRadius: 5,
backgroundColor: 'blue',
},
pointDebugCorner3: {
position: 'absolute',
width: 10,
height: 10,
borderRadius: 5,
backgroundColor: 'green',
},
pointDebugCorner4: {
position: 'absolute',
width: 10,
height: 10,
borderRadius: 5,
backgroundColor: 'orange',
},
});
VisionCamera Version
4
Additional information
The text was updated successfully, but these errors were encountered: