-
-
Notifications
You must be signed in to change notification settings - Fork 56.3k
add tool for selecting best calibration images across multiple cameras #27686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 5.x
Are you sure you want to change the base?
Conversation
IMHO:
|
try: | ||
from PIL import Image, ImageOps | ||
_PIL_OK = True | ||
except ImportError: | ||
_PIL_OK = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pillow dependency is definitely redundant. OpenCV cv::imwrite supports exif orientation by default.
if fix_orientation and _PIL_OK: | ||
with Image.open(path) as im: | ||
im = ImageOps.exif_transpose(im) | ||
im = im.convert("L") | ||
if max_size and max_size > 0: | ||
w, h = im.size | ||
scale = float(max_size) / max(w, h) | ||
if scale < 1.0: | ||
im = im.resize((int(w * scale), int(h * scale)), Image.LANCZOS) | ||
return np.array(im, dtype=np.uint8) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose to drop Pillow related branches. OpenCV is always there.
if s <= 0.0: | ||
return (0.4, 0.3, 0.2, 0.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you use such constants? It looks wired.
return True, pts.reshape(-1, 1, 2), pts.shape[0] | ||
|
||
def detect_pattern( | ||
gray: np.ndarray, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
findCirclesGrid takes colors into account. I would say that the function should get original image and convert it to gray on demand.
ap.add_argument("--square", type=float, default=0.0, help="Square size (meters) for Charuco/GridBoard") | ||
ap.add_argument("--marker", type=float, default=0.0, help="Marker size (meters) for Charuco/GridBoard") | ||
ap.add_argument("--separation", type=float, default=0.0, help="Marker separation (meters) for GridBoard") | ||
ap.add_argument("--gridboard", type=str, help="GridBoard WxH (e.g., 7x5). Only used for --pattern aruco") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose to replace aruco to aruco_grid in --pattern
, use --rows and --cols for it and remove --gridboard option.
ap.add_argument("--out", required=True, help="Output directory for YAMLs") | ||
ap.add_argument( | ||
"--pattern", | ||
choices=["chessboard", "charuco", "aruco", "circulargrid"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use circles
and acircles
in other tools and examples.
"--yaml-legacy", | ||
action="store_true", | ||
help="Prepend %%YAML:1.0 for legacy consumers", | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say it should be default behaviour without option. It works with both Python and OpenCV own FileStoreage class.
ap.add_argument("--rows", type=int, required=True, help="Pattern rows (inner corners or circle rows)") | ||
ap.add_argument("--cols", type=int, required=True, help="Pattern cols (inner corners or circle cols)") | ||
ap.add_argument("--aruco-dict", default="DICT_5X5_1000", help="Aruco dictionary name for aruco/charuco") | ||
ap.add_argument("--circular-type", choices=["symmetric", "asymmetric"], default="symmetric", help="Circle grid type when using circulargrid pattern") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use circles
and acircles
board names in other samples. Extra parameters are not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will work on these aspects.
Yes, the current logic is per-camera. With |
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.