diff --git a/lib/bndbox.dart b/lib/bndbox.dart index 2d01b27..0309463 100644 --- a/lib/bndbox.dart +++ b/lib/bndbox.dart @@ -43,6 +43,9 @@ class BndBox extends StatelessWidget { if (_y < difH / 2) h -= (difH / 2 - _y) * scaleH; } + // points are mirrored when using the front-camera, hence, change x-coords... + x = screenW - x; + return Positioned( left: math.max(0, x), top: math.max(0, y), @@ -137,7 +140,9 @@ class BndBox extends StatelessWidget { return Stack( children: model == mobilenet ? _renderStrings() - : model == posenet ? _renderKeypoints() : _renderBoxes(), + : model == posenet + ? _renderKeypoints() + : _renderBoxes(), ); } } diff --git a/lib/camera.dart b/lib/camera.dart index b0a1452..8c6ec58 100644 --- a/lib/camera.dart +++ b/lib/camera.dart @@ -30,7 +30,7 @@ class _CameraState extends State { print('No camera is found'); } else { controller = new CameraController( - widget.cameras[0], + widget.cameras[1], ResolutionPreset.high, ); controller.initialize().then((_) { @@ -69,6 +69,9 @@ class _CameraState extends State { imageHeight: img.height, imageWidth: img.width, numResults: 2, + rotation: -90, + threshold: 0.2, + nmsRadius: 10, ).then((recognitions) { int endTime = new DateTime.now().millisecondsSinceEpoch; print("Detection took ${endTime - startTime}");