-
Notifications
You must be signed in to change notification settings - Fork 40
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
WIP: Update/proclivity #56
WIP: Update/proclivity #56
Conversation
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.
In general, this looks okay but I would like to improve this function by documenting it thoroughly (with comments/assumptions/requirements and variable naming, etc.) as well implementing some best-practices. We also need a unit test to prove that it works correctly. Ideally this would have a case with perfect data where the check succeeds and a few cases with bad data to prove that it fails (i.e. noisy data, bad correspondences, individual outliers). Per @drchrislewis this functionality has existed but not really been thoroughly tested
double max_residual; //this can be omitted if residuals are compared internally | ||
}; | ||
|
||
bool checkObservationProclivity(const ProclivityParams& params); |
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.
Need more documentation about the purpose of this function and the assumptions made
double max_residual; //this can be omitted if residuals are compared internally | ||
}; | ||
|
||
bool checkObservationProclivity(const ProclivityParams& params); |
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.
Just in general, let's use the term homography instead of proclivity to refer to this check, which is more accurate according to @drchrislewis
Eigen::MatrixXd Alpha(8,1); //Homography matrix components | ||
Eigen::MatrixXd A(18,8); | ||
Eigen::MatrixXd B(1,18); //U,V coordinates of points | ||
|
||
// determine rows and cols of target | ||
int rows = params.target.rows; | ||
int cols = params.target.cols; | ||
|
||
//we want *9* points, spiraling in clockwise: UL, UR, LL, LR, UL +1, UR -1. etc. | ||
std::vector<int> selected_point_index{0, rows-1, rows*cols -1, rows*cols - cols-1, | ||
1, rows-2, rows*cols -2, rows*cols - cols-2, | ||
rows*cols/2}; |
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.
The row size of matrix A
is related to the number of points you choose (i.e. 2*n
). I would parameterize the number of points used in the calculation for clarity and in case we need to change it. I would also only use the minimum number of points to construct A
so we can check use A
to check more of the remaining points that weren't involved in its creation.
We should also check that the target has more points than the minimum required (4) by some constant factor (i.e. 2, so 8 points minimum). Otherwise throw an exception because this check is not valuable.
Please document that we are using corner points of the target in order to create the largest possible plane for our assumed rectangular planar target
|
||
// build matrix of type Ax=b where A x is the unknown elements of the proclivity matrix "alpha" | ||
int row = 0; | ||
for(int i=0; i<(int) selected_point_index.size(); i++){ |
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.
Prefer size_t
for iterators instead of casting
bool checkObservationProclivity(const rct_image_tools::ProclivityParams& params) | ||
{ | ||
|
||
Eigen::MatrixXd Alpha(8,1); //Homography matrix components |
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.
More documentation on the math that these objects will be used for
row++; | ||
} | ||
//solve with Eigen | ||
//beware gcc's -ffast-math, hurts accuracy of JacobiSvd |
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.
?
double EU = Ui - UV(0); | ||
double EV = Vi - UV(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.
Make this an Eigen vector with a more descriptive name, i.e. homograpy_error
// check the proclivity of every observation | ||
bool rtn = true; | ||
double ave_error = 0.0; | ||
std::vector<double> errorU, errorV; |
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.
Make this a single vector of Eigen 2D vectors
struct ProclivityParams | ||
{ | ||
rct_optimizations::CameraIntrinsics intr; | ||
rct_image_tools::ModifiedCircleGridTarget target; | ||
rct_optimizations::Observation2D3D ob; //learn to use templates, and then do this right | ||
double max_residual; //this can be omitted if residuals are compared internally | ||
}; |
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.
Probably don't need a separate struct for inputs to the homography checking function, especially if you think we should have a default max_residual
// construct the Proclivity matrix from Alpha | ||
Eigen::Matrix3d P; | ||
P << Alpha; | ||
P(2,2) = 1.0; |
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.
Please document that here we are rearranging the elements of the homography matrix Alpha
(which is a vector) into a 3x3 matrix, where the (2, 2) element is 1.
563d723
to
306ba7a
Compare
…ented, and some improved methods
…ther documentation
…NaN returns or 60 deg oritentation shits
Sensor Noise Qualification Updates
…rtially implemented
306ba7a
to
ec79db6
Compare
Closing; this PR was replaced by #66 |
A function for detecting if target points have been misordered. A pixel threshold can be provided, or outliers can be detected internally by comparing maximum values to interquartile range. Built atop #52