Code Monkey home page Code Monkey logo

caliscope's People

Contributors

calcoloergosum avatar dependabot[bot] avatar mprib avatar rgov avatar rohanbhattacharyya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

caliscope's Issues

Triangulate PointData

Rather than frame by frame, take the comprehensive point data used for the bundle adjustment and triangulate it using various methods. Point agreement/charuco corner relative position can then be assessed.

Stereocalibration dialogue

Stereocalibration currently just opens an OpenCV window of paired views that
drop off when a sufficient number of points have been captured. This needs
to be integrated into the standard GUI, and perhaps additional feedback
provided. This feedback might include a calculation of the redundency in the
stereo connections. Perhaps creation of an acceptable anchor camera and a list
of all the represented camera pairs.

Revise Stereocalibration interface to provide better input for Bundle Adjustment

A decent array initialization can be achieved using stereopairs that only have 20 or so grids between them. This does not, however, appear adequete for a good bundle adjustment calibration (from the perspective of accurate registering of distances).

I believe that a good path for the process is this:

  • collect at least 100 grids per stereopair (or whatever the ceiling will be)
  • display a pair-grid that has counts or colors to indicate how many each pair has
  • when the ceiling is reached, move that pairs display to the bottom
  • allow auto-termination if all ceilings reached, alternatively
  • user can attempt to proceed with calibration data as is
  • upon terminating,
    • determine camera intrinsics based on a subset of the collected images
    • stereocalibraition for all pairs using the first 20 (or whatever) grids to initialize the camera array
  • bundle adjustment will proceed with the full set of data
    • all frames during recording session will be saved for processing

From there it's a whole new set of issues. But just to thnk through them..

  • results of calibration will be presented (histograms and scatter plots)

  • perhaps play back the post bundle adjusted data in the 3d viewer? (this would be an undertaking all its own...)

  • allow acceptance of the calibration

  • move on to set the origin (or alternatively use the last frame of the calibration to set the origin?)

I'm going to start creating project items as this is becoming a bit big...

Streamline calculation of charuco corner distances

The implementation of this in the current Jupyter notebook is a travesty. I think it's right, but it is slow...

This may become the basis for testing bundle adjusting on the basis of matching charuco corner distances if it ends up running quickly enough...

Standardize names for stereocalibration output

Stereocalibration parameters are not named in a standard way. Example, it could
be stereo_0_2_RMSE on one run and stereo_2_0_RMSE on the next one. This creates
duplicated records with out of synch data. Stick to a convention of always
putting the smaller number first.

Implement opencv triangulation code

I may mock this up in a jupyter notebook reading in saved out paired_point data to make sure that I get the details of the input transformations correct. From there I can test out the performance of the triangulation code as well as whether or not it resolves the mirroring that I'm seeing in my current projected points.

Undistort points prior to triangulation

Original triangulation code was based on the excellent tutorial here:

https://temugeb.github.io/opencv/python/2021/02/02/stereo-camera-calibration-and-triangulation.html

but that does not take distortion into account.

Undistorting all pixels in each frame prior to point identification is one option, though this has considerable processing overhead. Another option is to only undistort points, but it appears that there are problems with the native opencv function to for this:

https://answers.opencv.org/question/230847/undistort-and-undistortpoints-are-inconsistent/

but that this can be resolved with a function described here:

https://yangyushi.github.io/code/2020/03/04/opencv-undistort.html

use least_squares output as input for filtering the point data

Refactor within PointData and bundle_adjust_test.

provide point data with least squares output and a threshold value to subset the values (from _full variables)

Additional refactor to make the PointData object as the primary input of an optimize method. A side effect of this is that it will set the least_sq_result variable within the PointData. I'm not super happy about that...but it's starting to feel like the simplest and most straightforward way to manage things while looping through this code over and over again.

Create test session folder

create a single folder to hold session configs used for testing... a related issue to the "use tests" issue

gitignore is too thin

Need to also ignore the hidden files (i.e. ".*"). In general, clean up what gets saved.

remove dependency on imutils

Only 8 dependencies in the entire project at the moment and this is one of them. It's only used in one line of code and I believe cv2 has similar functionality.

Create diagnostic summaries of camera configs

Should include

  • the reprojection error
  • the agreement between triangulated point distances and actual charcoal distances...
  • the "spread" of a simple 3d point triangulation

A good idea for a figure (from the Anipose paper):
image

Histograms of length variation and RMSE of reproj may also be way to display this. Show both before and after Bundle Adjustment. Also show how the basic parameters changed from before to after Bundle Adjustment.

Refactor `frame_bundle` out of the code

This is confusing language given that it has no relationship with "bundle adjustment." In general, that "bundle" of data may more accurately be described as a "packet" that is passed into the thread queue. This packet could be a dataclass like has been done with most recent additions to the code base where data is passed from one thread to another.

Iterate bundle adjustment over subset of points

After an initial round of bundle adjustment, remove from the 2_d points the image points that have the worst reprojection error, then bundle adjust again. This is an implementation of a basic idea within anipose.

After that, I would be interested in re-running bundle adjustment on the complete dataset, but the parameters to optimize would be the camera intrinsics and distortion. Going iteratively back and forth in this three step process seems like it might help square away the outliers due to initially mis-estimated camera intrinsics:

  1. Optimize 6dof based on full data set
  2. Optimize 6dof after removing outliers with high reprojection error
  3. Optimize Intrinsics (camera matrix and distortion) on complete dataset

repeat the above and see if results improve....

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.