am15h / object_detection_flutter

Truly realtime object-detection in flutter
188 stars 113 forks source link

Uninitialized CameraController, startImageStream was called on uninitialized CameraController #2

Closed rakhimian closed 4 years ago

rakhimian commented 4 years ago

Hi @am15h Thanks for your job! I was able to test your app and find out some error - Uninitialized CameraController. Can you explain to me what is wrong? Thanks!

am15h commented 4 years ago

Hi @RakhimyanTim, Sorry I missed this. Can you elaborate a little more? Are you using the exact same code from this repository or any modifications have been made?

rakhimian commented 4 years ago

I'm using the same code from your repository.. without any modifications..

sahalshajim commented 4 years ago

Screen Shot 2020-10-03 at 8 58 34 PM I was able to solve this issue by initializing camera before calling main function like this : Check Screen Shot ///////////////////////////////////////////////// List cameras; Future main() async { WidgetsFlutterBinding.ensureInitialized(); try { cameras = await availableCameras(); } on CameraException catch (e) { print('Error: $e.code\nError Message: $e.message'); } runApp(new MyApp()); } //////////////////////////////////////////////// Pass the cameras list to Home View and then to Camera View and use it there instead of the initializing cameras in Camera View Page which causes the error

rakhimian commented 4 years ago

Thanks! It's working now

bqubique commented 2 years ago

For anyone still dealing with an issue like this one, checking whether the CameraController was initialised helped me 🙃.

if(cameraController.value.isInitialized){
    //do stuff with cameraController here
}

P.S. My issue was not related to this package, but rather it was related to processing camera stream for pose detection.