Skip to content

Calibration Update: handling a subset of polygons, new args, dataset handling, and more.#7

Merged
itsderek23 merged 7 commits intomasterfrom
calib_single_image
Feb 3, 2020
Merged

Calibration Update: handling a subset of polygons, new args, dataset handling, and more.#7
itsderek23 merged 7 commits intomasterfrom
calib_single_image

Conversation

@itsderek23
Copy link
Copy Markdown

@itsderek23 itsderek23 commented Feb 2, 2020

Adds a number of modifications to the calibration flow:

  • Renamed script from calibration_pipeline.py to just calibrate.py
  • Introduced a number of arguments to execute portions of the pipeline and only for specified polygon positions
  • Doesn't throw an error if the datasets/ dir already exists
  • Defaults to 1 image per polygon position (vs. 5) so total default images = 13 vs. 65 for a faster flow.
  • Adds more incremental logging messages

Usage:

$ python3 calibrate.py --help
usage: calibrate.py [-h] [-p [POLYGONS [POLYGONS ...]]] [-c COUNT]
                    [-s SQUARE_SIZE_CM] [-i IMAGE_OP] [-m [MODE [MODE ...]]]

optional arguments:
  -h, --help            show this help message and exit
  -p [POLYGONS [POLYGONS ...]], --polygons [POLYGONS [POLYGONS ...]]
                        Space-separated list of polygons (ex: 0 5 7) to
                        restrict image capture. Default is all polygons.
  -c COUNT, --count COUNT
                        Number of images per polygon to capture. Default is 1.
  -s SQUARE_SIZE_CM, --square_size_cm SQUARE_SIZE_CM
                        Square size of calibration pattern used in
                        centimeters. Default is 2.5.
  -i IMAGE_OP, --image_op IMAGE_OP
                        Whether existing images should be modified or all
                        images should be deleted before running image capture.
                        The default is 'modify'. Change to 'delete' to delete
                        all image files.
  -m [MODE [MODE ...]], --mode [MODE [MODE ...]]
                        Space-separated list of calibration options to run. By
                        default, executes the full 'capture process' pipeline.
                        To execute a single step, enter just that step (ex:
                        'process').

    Captures and processes images for disparity depth calibration, generating a `dephtai.calib` file
    that should be loaded when initializing depthai. By default, captures one image across 13 polygon positions.

    Image capture requires the use of a printed 7x9 OpenCV checkerboard applied to a flat surface (ex: sturdy cardboard).
    When taking photos, ensure the checkerboard fits within both the left and right image displays. The board does not need
    to fit within each drawn red polygon shape, but it should mimic the display of the polygon.

    If the checkerboard does not fit within a captured image, the calibration will generate an error message with instructions
    on re-running calibration for polygons w/o valid checkerboard captures.

    The script requires a RMS error < 1.0 to generate a calibration file. If RMS exceeds this threshold, an error is displayed.

    Example usage:

    Run calibration with a checkerboard square size of 2.35 cm:
    python calibrate.py -s 2.35

    Run calibration for only the first and 3rd polygon positions:
    python calibrate.py -p 0 2

    Only run image processing (not image capture) w/ a 2.35 cm square size. Requires a set of polygon images:
    python calibrate.py -s 2.35 -m process

    Delete all existing images before starting image capture:
    python calibrate.py -i delete

    Capture 3 images per polygon:
    python calibrate.py -c 3

Known issues

/cc @Luxonis-Brandon @Luxonis-Brian

* Renamed script from calibration_pipeline.py to just calibrate.py
* Introduced a number of arguments to execute portiions of the pipeline and only for specified polygon positions
* Doesn't throw an error if the datasets/ dir already exists
* Defaults to 1 image per polygon position (vs. 5) so total default images = 13 vs. 65 for a faster flow.
* Adds more incremental logging messages
@itsderek23 itsderek23 changed the title [WIP] Calib single image [WIP] Calibration Update: handling a subset of polygons, new args, dataset handling, and more. Feb 2, 2020
The video stream image is to large to display both left/right on my external monitor. It's not possible to allow window resize w/o Qt. Reduce size by 1.5x before displaying.
Copy link
Copy Markdown

@Luxonis-Brandon Luxonis-Brandon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet, thanks! Will be nice even for Brian’s and my effort doing calibration.

@itsderek23
Copy link
Copy Markdown
Author

Updated image capture display displays progress:

image

@itsderek23 itsderek23 changed the title [WIP] Calibration Update: handling a subset of polygons, new args, dataset handling, and more. Calibration Update: handling a subset of polygons, new args, dataset handling, and more. Feb 3, 2020
@itsderek23
Copy link
Copy Markdown
Author

Occasionally the pipeline will not initialize

I haven't been able to reproduce this for a while. Workaround: click the restart button on the board.

@itsderek23
Copy link
Copy Markdown
Author

@Luxonis-Brandon @Luxonis-Brian - this is ready for you to try. Let me know if I should merge this into master or if you'd rather experiment with this branch first.

@Luxonis-Brandon
Copy link
Copy Markdown

Thanks. I’d say merge to master. And @Luxonis-Brian has the boards/computers now but I could come over and try with him.

@Luxonis-Brian - want to give it a shot when you have a second?

@itsderek23 itsderek23 merged commit 035644d into master Feb 3, 2020
@itsderek23
Copy link
Copy Markdown
Author

Merged!

To run calibration:

python3 calibrate.py

To see usage info:

python3 calibrate.py --help

@itsderek23
Copy link
Copy Markdown
Author

For me, cv2 imshow displays for the video stream won't both fit on my large external monitor and can't be resized.

I added code to reduce the size by 1.5x, but the frame rate was too slow on the Pi, so I reverted this in 95a8854.

@itsderek23 itsderek23 deleted the calib_single_image branch February 6, 2020 22:30
Coffee-Boyy pushed a commit to Coffee-Boyy/depthai that referenced this pull request May 12, 2020
SzabolcsGergely pushed a commit that referenced this pull request Oct 30, 2020
Calibration Update: handling a subset of polygons, new args, dataset handling, and more.
jdavidberger pushed a commit to constructiverealities/depthai that referenced this pull request May 26, 2022
Calibration fix when EEPROM is not programmed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants