EasternEdgeRobotics / Software_2017

The control software for 2017
MIT License
3 stars 0 forks source link

Initial camera calibration and distance calculation tool #299

Closed cal-pratt closed 7 years ago

cal-pratt commented 7 years ago

This is the initial work on the camera calibration and distance calculation tool described in #297 . This is a huge amount of code, so I thought that I'd start a PR for the current work completed.

Basic idea for the system:

The major additions to the codebase are the new GalleryView and GalleryViewController objects. This will enable us to load an image folder in a JavaFX view and display it to the user. The view contains two Subjects which will let the user refresh the folder and subscribe to selected images. In the CameraCalibrationView selecting an image will open a fullscreen view of that image. In the DistanceCalculatorView the idea is that the user will open plotter tool to create the ground plane triangle.

image

I wanted the view to grab the folder locations from the config, so I decided to create a new annotation for injecting objects in the viewloader. The new @Configurable("lookup") annotation will automatically grab a config from the Config object and inject it into a ViewController. Here is an example from CameraCalibrationViewController:

    @Inject
    public CameraCalibrationViewController(
        final CameraCalibrationView view,
        final GalleryView cameraACalibration,
        final GalleryView cameraBCalibration,
        final VideoDecoder videoDecoder,
        @Configurable("cameraCalibration")final CameraCalibrationConfig config
    ) {

This camera calibration config is also passed to the CameraCalibration object which handles the magic opencv code. I tried to add a lot of documentation to this section seeing as the JavaCV docs are not the greatest.