Skip to content

Panoramic Camera model #6

Closed
Closed

Description

@daleydeng

I saw the colmap has a lot of camera models, is it easy to add new panoramic model? So the street view image could also be applied~

May be 3D bearing vector (unit vector) is more suitable compared with the 2D feature coordinate in this case.~

Activity

  1. ahojnnes commented on May 1, 2016

    @ahojnnes
    Contributor

    Hi @daleydeng,

    For now, it is not straightforward to add non-central camera models, which I assume would be the case for the type of data you mention. There is a chance that I'll release code for it at some point in the future, but it is not clear when.

    If this answers your question, I would close the issue for now. Otherwise, feel free to follow up.

    Cheers, Johannes

  2. daleydeng commented on May 1, 2016

    @daleydeng
    Author

    Thanks for reply. Camera rig would be non-central, but panorama is central. Different with conventional rectilinear camera model, there is no front or back (no cherilty check) in the panorama camera and the pixel based mapping function would be large distorted, Maybe bearing vector is better representation for this case.
    The reprojection error could be chord distance between two rays~

    image

    Check http://laurentkneip.github.io/opengv/page_how_to_use.html#sec_vocabulary for more details~

    PS: Bearing vector is general enough for all the calibrated central cameras including rectilinear one~

  3. ahojnnes commented on May 1, 2016

    @ahojnnes
    Contributor

    Hi,

    Thanks for the clarification. This makes sense and should be possible with some modification of the current implementation. XY image coordinates would then simply be your azimuth and elevation angles. One important thing that would have to be adapted are the carefully chosen pixel error thresholds. Let me know if you want to tackle this problem and you have questions. Happy to help.

    Best,
    Johannes

  4. daleydeng commented on May 1, 2016

    @daleydeng
    Author

    All right, I will contact you when I tackle this problem~~

  5. daleydeng commented on May 10, 2016

    @daleydeng
    Author

    I have added support for generic central camera (such as spherical camera) as
    https://github.com/daleydeng/colmap/tree/cvai, @ahojnnes could ref it when needed!

  6. ahojnnes commented on May 10, 2016

    @ahojnnes
    Contributor

    @daleydeng Hi, this looks great. Would you have a test dataset to share to test the functionality? Thanks!

  7. daleydeng commented on May 10, 2016

    @daleydeng
    Author

    @ahojnnes , Hi, I've added data in there, check it out~, but there is a little bug when running about 160 images, I'm figuring it out~

  8. ahojnnes commented on May 10, 2016

    @ahojnnes
    Contributor
  9. daleydeng commented on May 10, 2016

    @daleydeng
    Author

    Ok~

  10. daleydeng commented on May 10, 2016

    @daleydeng
    Author

    I think I saw the problem, refine_focal_length should be disabled in spherical case, change *refine_focal_length to false in proj.ini

  11. daleydeng commented on May 10, 2016

    @daleydeng
    Author

    @ahojnnes Check the new result, now we need a sphere entity in gl viewer for each spherical camera~

  12. ahojnnes commented on May 10, 2016

    @ahojnnes
    Contributor

    @daleydeng The results look much better now! Would you be willing to prepare a pull request against the current master branch? I am happy to incorporate your changes.

  13. ahojnnes commented on May 10, 2016

    @ahojnnes
    Contributor

    For my understanding, did you do normal feature extraction or how did you translate from x,y to spherical coordinates?

  14. daleydeng commented on May 10, 2016

    @daleydeng
    Author

    the Spherical camera itself defines how the world coordinate(Vector3d, u, v, w) to the image coordinate(Vector2d, x, y)

    Normalization has been done in camera itself by caluclating the panning and tilting angle from pixel

    There is no change in feature extraction, they are just orignal 2D feature image coordinates.

    template
    void SphericalCentralCameraModel::WorldToImage(const T* params, T u,
    T v, T w, T* x, T* y) {
    const T f = params[0];
    const T c1 = params[1];
    const T c2 = params[2];

    T l = ceres::sqrt(u * u + v * v + w * w);
    u = u/l, v = v/l, w = w/l;
    T p = ceres::atan2(u, w), t = -ceres::asin(v);

    _x = p_f+ c1;
    _y = -t_f + c2;
    }

    template
    void SphericalCentralCameraModel::ImageToWorld(const T* params, const T x,
    const T y, T* u, T* v, T *w) {
    const T f = params[0];
    const T c1 = params[1];
    const T c2 = params[2];

    auto p = (x - c1) / f, t = -(y - c2) / f;
    auto cos_t = ceres::cos(t);
    *u = cos_t * ceres::sin(p);
    *v = -ceres::sin(t);
    *w = cos_t * ceres::cos(p);
    }

    Focal length is the radius of camera sphere in pixel units.
    Principle point lies on the equator of the sphere.
    For equirectangular projection, each pixel represents same delta panning and tilting angle which is 1/focal, and the image width's angle is
    image width / focal = 2*pi

    Bassically:
    For P3P, EPNP, Triangulation, Essential Matrix, there exists general solution to deal with Vector3D world point, without regarding different types of world point [u/w, v/w, 1] or [u, v, w]
    For 7pt Fundamental, 8pt Fundamental, Homography matrix estimation, only 2D image point is supported.
    Sampson error need to adapted to Vector3D world point and Vector 2D image point for both Essential and Fundamental matrix estimation
    For pixel based reprojection error, no need to change.

    x, y axises in image plane are parallel to u, v axises in spherical coordinate system, v axis is downward
    In spherical coordinate system, pan angle pivot with v axis while tilt angle pivot with u axis.

    Maybe this helps
    http://mathworld.wolfram.com/CylindricalEquidistantProjection.html
    http://paulbourke.net/geometry/transformationprojection/

    PS: Maybe there is no need normalization in cost_function.h, I'll update it

  15. daleydeng commented on May 10, 2016

    @daleydeng
    Author

    @ahojnnes OK, let me cleanup my code for some name conventions and something for pull request, and after that, Cylindrical Camera could also be added~

    PS: How to deal with the data, upload somewhere?

  16. 13 remaining items

  17. ahojnnes commented on Aug 23, 2016

    @ahojnnes
    Contributor

    Hi Stephane,

    you would have to clone @daleydeng branch and compile it yourself. The rest should be equivalent to the standard procedure, see documentation/tutorial.

    Best,
    Johannes

  18. stephane-lb commented on Aug 24, 2016

    @stephane-lb

    Hi @ahojnnes ,

    I tried too do that :

    • I cloned @daleydeng repo
    • I switched to origin/cvai
    • I compiled
    • I executed the gui

    And now I don't know what I should select here :
    screen shot 2016-08-24 at 23 23 11

    If you could suggest something to me, it would be great.

    Thanks for your help,

    Stephane

  19. stephane-lb commented on Sep 2, 2016

    @stephane-lb

    Hi,

    I decide to go throw the command line tutorial and got an error too. I am really sorry, but I have to post here because issues are not opened in @daleydeng repo.

    So this is what I have done :

    ./src/exe/feature_extractor \
        --General.database_path /Users/Stephane-lb/Desktop/myDataset/database.db \
        --General.image_path /Users/Stephane-lb/Desktop/myDataset/images
    
    ./src/exe/exhaustive_matcher \
        --General.database_path /Users/Stephane-lb/Desktop/myDataset/database.db  
    

    And this is what I got :

    Matching block [1/1, 1/1] in 27.878s
    Elapsed time: 0.46 [minutes]
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const: conn 0x17f53 token 0x1ffffffffffe85
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: Backtrace (at 12467):
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  0   CoreGraphics                        0x00007fff8d41f709 CGSDisableUpdateToken + 210
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  1   AppKit                              0x00007fff9d8de420 ___disable_updates_sync_block_invoke_2 + 17
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  2   libdispatch.dylib                   0x00007fff9127e40b _dispatch_client_callout + 8
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  3   libdispatch.dylib                   0x00007fff9127f9f2 _dispatch_barrier_sync_f_invoke + 74
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  4   AppKit                              0x00007fff9d8de2ee NSCGSDisableUpdates + 213
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  5   AppKit                              0x00007fff9d8de124 NSCGSTransactionRunPreCommitActionsForOrder_ + 156
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  6   AppKit                              0x00007fff9d8de06b NSCGSTransactionRunPreCommitActions_ + 21
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  7   AppKit                              0x00007fff9e08cce4 -[_NSCGSTransaction synchronize] + 33
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  8   AppKit                              0x00007fff9e08cf59 NSCGSTransactionSynchronize + 76
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  9   AppKit                              0x00007fff9de77fc5 -[NSSurface syncSurfaceWantsExtendedDynamicRange] + 150
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  10  AppKit                              0x00007fff9d9b02cd -[NSSurface _createSurface] + 677
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  11  AppKit                              0x00007fff9d9afc28 -[NSSurface setFrame:] + 785
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  12  AppKit                              0x00007fff9de780cb __38-[NSSurface syncToViewUnconditionally]_block_invoke + 154
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  13  AppKit                              0x00007fff9d8cd325 NSPerformVisuallyAtomicChange + 147
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  14  AppKit                              0x00007fff9d9af54c -[NSSurface syncToViewUnconditionally] + 100
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  15  AppKit                              0x00007fff9de78164 __37-[NSSurface orderSurface:relativeTo:]_block_invoke + 44
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  16  AppKit                              0x00007fff9d8cd325 NSPerformVisuallyAtomicChange + 147
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  17  AppKit                              0x00007fff9d9af41f -[NSSurface orderSurface:relativeTo:] + 160
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  18  AppKit                              0x00007fff9daa2e56 NSOpenGLContextAttachOnScreenViewSurface + 183
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  19  AppKit                              0x00007fff9ddcf6c7 __27-[NSOpenGLContext setView:]_block_invoke + 192
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  20  AppKit                              0x00007fff9d8cd325 NSPerformVisuallyAtomicChange + 147
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  21  AppKit                              0x00007fff9da8fc0d -[NSOpenGLContext setView:] + 119
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  22  libqcocoa.dylib                     0x0000000105b2af47 -[QNSView setQCocoaGLContext:] + 55
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  23  libqcocoa.dylib                     0x0000000105b63c1d _ZN15QCocoaGLContext11makeCurrentEP16QPlatformSurface + 45
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  24  QtGui                               0x00000001020cbb12 _ZN14QOpenGLContext11makeCurrentEP8QSurface + 162
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  25  exhaustive_matcher                  0x0000000100a77da7 _ZN6colmap14FeatureMatcherC2ERKNS0_7OptionsERKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE + 551
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  26  exhaustive_matcher                  0x0000000100a7b5a5 _ZN6colmap24ExhaustiveFeatureMatcherC1ERKNS_14FeatureMatcher7OptionsERKNS0_17ExhaustiveOptionsERKNSt3__112basic_stringIcNS8_11char_traitsIcEENS8_9allocatorIcEEEE + 21
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  27  exhaustive_matcher                  0x0000000100a5e451 main + 513
    Sep  2 16:15:34  exhaustive_matcher[31914] <Warning>: void CGSUpdateManager::log() const:  28  libdyld.dylib                       0x00007fff9abe35ad start + 1
    

    What did I make wrong ?

    Cheers,
    Stéphane

  20. ahojnnes commented on Sep 2, 2016

    @ahojnnes
    Contributor

    Nothing. This should be ignored and is caused by Qt and not by COLMAP. As long as COLMAP exits without an error, everything should be fine. Let me know if that answers your question.

  21. stephane-lb commented on Sep 2, 2016

    @stephane-lb

    @ahojnnes : Thank you ! So in that case that should means that I missed a step to make clomp working with my Ricoh Dataset or that my dataset is not good enough. I will generate a new one tomorrow!

  22. daleydeng commented on Sep 5, 2016

    @daleydeng
    Author

    @stephane-lb, you could check the differences with the orignal branch, the ray based modifications are there, you could also check them~. And I'm busy too and havent update for a while~~

  23. yuyou commented on Sep 29, 2017

    @yuyou

    Hi

    I tried to check @daleydeng's branch (cvai) and see if it works with the latest master branch. One important unit test (TestRefineEssentialMatrix) failed with following big value difference.

    7/43 Testing: base/essential_matrix_utils_test
    7/43 Test: base/essential_matrix_utils_test
    Command: "/home/colmap.pano/build/src/base/essential_matrix_utils_test"
    Directory: /home/colmap.pano/build/src/base
    "base/essential_matrix_utils_test" start time: Sep 29 12:26 UTC
    Output:
    ----------------------------------------------------------
    Running 6 test cases...
    /home/colmap.pano/src/base/essential_matrix_test.cc(179):
    error in "TestRefineEssentialMatrix": check (E - E_refined).norm() <= (E - E_pertubated).norm() failed [2.8186349886258166 > 0.039204384018772402]
    

    Does anyone have the same problem? The test environment is:

    • Ubuntu 16.04
    • Three GeForce GTX 1080 Nvidia cards with CUDA 8.0 (driver 384.69)
  24. franmts commented on Oct 24, 2017

    @franmts

    Hi all,
    Can anyone please confirm if the current cvai branch is funcional with equirectangulars? Having some trouble to get Spherical Camera model type to appear on GUI.
    Thank you

  25. ahojnnes commented on Oct 24, 2017

    @ahojnnes
    Contributor

    @franmts I have not tried it but if the camera model does not appear in the GUI, it is probably not defined here: https://github.com/colmap/colmap/blob/master/src/base/camera_models.h#L103

  26. yuyou commented on Oct 24, 2017

    @yuyou

    @franmts I have no problem to get the new camera model in GUI. I can confirm that both GUI and command line modes work with the new camera mode. But as said, the reconstruction result is not plausible. The unit test failed on "essential_matrix_test".

  27. ahojnnes commented on Oct 24, 2017

    @ahojnnes
    Contributor

    @yuyou The TestRefineEssentialMatrix should not have an impact on the reconstruction, you can ignore it.

  28. franmts commented on Oct 26, 2017

    @franmts

    @yuyou and @daleydeng , do you have windows binaries for this branch? Would be great if you could share that here or on [email protected] to try it out. I'm looking to benchmark this against pix4d and agisoft. Counting on ceres solver to see great alignment on various image resolutions.

  29. ryanismert commented on May 10, 2018

    @ryanismert

    @franmts Did you have any luck testing this?

  30. franmts commented on May 10, 2018

    @franmts

    Yes, I tested @ryanismert. Compiled after much effort, but I guess I was missing computer horse power to run it, even for smaller dimensions. Software constantly crashed and couldn't proceed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions