react-native-opencv3-tests icon indicating copy to clipboard operation
react-native-opencv3-tests copied to clipboard

Pausing Recognition and Displaying Alert Mesage

Open iuri opened this issue 3 years ago • 1 comments

Hello there, How would we pause openCV engine on real time, show an Alert message within a button whether to "Exit" or "scan" to keep scanning faces? As the screenshot attached shows

Best wishes, I

IMG_1462 WhatsApp Image 2021-12-29 at 12 29 49

iuri avatar Jan 17 '22 19:01 iuri

Hi there, Searching for ideas within node-modules/react-native-opencv3, I found within the IOS library file /ios/CvCamera.mm, a chunk of code, which calls [videoCamera stop].

file /ios/CvCamera.mm '''' - (void)bridgeDidBackground:(NSNotification *)notification { [videoCamera stop]; } ''''

That, made me wonder if and how I could use the same directives to stop/start Camera, while displaying Alert message, and: i. if the user chooses Exit, it would leave the Screen and the whole process stops ii. else if the user selects "Scan", then another command is executed (i.e. [videoCamera start]) and the mechanism continues to scan Faces again. Then, Alert.alert() would not show in the screen repeated infinetly .

Some sort of code as in the example below: '''' +++ (void)CameraStop:(NSNotification *)notification { [videoCamera stop]; } +++ (void)CameraStart:(NSNotification *)notification { [videoCamera start]; } ''''

... CvCamera.CameraStop(); Alert.alert( 'Check!', 'Face successfully scanned!', [{ text: 'Exit', onPress: () => { this.props.navigation.navigate('Home'); }, style: 'cancel' }, { text: 'Scan', onPress: () => { CvCamera.CameraStop(); } },],{cancelable: false } );

...

iuri avatar Jan 20 '22 17:01 iuri