mrcal-cull-corners - Filters a corners.vnl on stdin to cut out some points


$ < corners.vnl mrcal-cull-corners --cull-left-of 1000 > corners.culled.vnl


This tool reads a set of corner detections on stdin, throws some of them out, and writes the result to stdout. This is useful for testing and evaluating the performance of the mrcal calibration tools.

The specific operation of this tool is defined on which --cull-... option is given. Exactly one is required:

--cull-left-of X: throw away all corner observations to the left of the given
  X coordinate

--cull-rad-off-center D: throw away all corner observations further than D
  away from the center. --imagersize or --where must be given also so that we
  know where the center is. If D < 0: we cull the points -D or closer to the
  corners: we use a radius of sqrt(width^2 + height^2)/2. - abs(D)

--cull-board-rowscols L,T,R,B

R=1; < $C vnl-filter --sub 'ii() { if(filename != prev(filename)) { i=0; return i; } return ++i; }' -p .,'i=ii()' | vnl-filter -p .,\!i,'i=int(i/14)',j='i % 14' | vnl-filter -p filename,x,y,level="(i<$R || i>=14-$R || j<$R || j>=14-$R) ? \"-\" : level" > /tmp/corners-board-edge-cut$R.vnl

--cull-random-observations-ratio R: throws away a ratio R object observations
  at random. To throw out half of all object observations, pass R = 0.5.
  --object-width-n and --object-height-n are then required to make the parsing

--cull-left-of X and --cull-rad-off-center throw out individual points. This is done by keeping the point in the output data stream, but setting its decimation level to '-'. The downstream tools then know to ignore those points

--cull-random-observations-ratio throws out whole object observations, not just individual points. These removed observations do not appear in the output data stream at all

This tool exists primarily for testing, and probably you don't want to use it. The filtering is crude, and the tool might report chessboard observations with very few remaining points. You PROBABLY want to post-process the output to keep only observations with enough points. For instance:

mrcal-cull-corners ... > culled-raw.vnl

vnl-join --vnl-sort - -j filename culled-raw.vnl \
   <(< culled-raw.vnl vnl-filter -p filename --has level |
                      vnl-uniq -c |
                      vnl-filter 'count > 20' -p filename ) \
> culled.vnl

options: -h, --help show this help message and exit --object-width-n OBJECT_WIDTH_N How many points the calibration board has per horizontal side. This is required if --cull-random- observation-ratio --object-height-n OBJECT_HEIGHT_N How many points the calibration board has per vertical side. If omitted, I assume a square object and use the same value as --object-width-n --imagersize IMAGERSIZE IMAGERSIZE Size of the imager. If --cull-rad-off-center is given: we require --imagersize or --where --cull-left-of CULL_LEFT_OF Throw out all observations with x < the given value. Exclusive with the other --cull-... options --cull-rad-off-center CULL_RAD_OFF_CENTER Throw out all observations with dist_from_center > the given value. Exclusive with the other --cull-... options. If --cull-rad-off-center is given: we require --imagersize or --where --cull-random-observations-ratio CULL_RANDOM_OBSERVATIONS_RATIO Throw out a random number of board observations. The ratio of observations is given as the argument. 1.0 = throw out ALL the observations; 0.0 = throw out NONE of the observations. Exclusive with the other --cull-... options --where WHERE WHERE Used with --cull-rad-off-center. Specifies the location of the "center" point. If omitted, we use the center of the imager. May NOT be given if --cull-rad- off-center < 0. If --cull-rad-off-center is given: we require --imagersize or --where --filename FILENAME Apply the filtering only to observations where the filename matches the given regex. May be given multiple times: filenames that match ANY of the given regexen are culled. If omitted, we cull ALL the observations. Exclusive with --cull-random- observations-ratio



Dima Kogan, <>


Copyright (c) 2017-2023 California Institute of Technology ("Caltech"). U.S. Government sponsorship acknowledged. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); You may obtain a copy of the License at