Giter Site home page Giter Site logo

Comments (10)

daniyar-niantic avatar daniyar-niantic commented on June 2, 2024 3

Hello!

The intrinsics in kitti_dataset are normalized. So, you need to do
K[0,:] /= image_width
K[1,:] /= image_height

Make sure to use the image resolution of the original files that were used for calibration.

Regards,

Daniyar

from monodepth2.

bl0up avatar bl0up commented on June 2, 2024

Ok, thanks a lot.

Best regards,
Ambroise

from monodepth2.

ezorfa avatar ezorfa commented on June 2, 2024

@bl0up Could you please let me know the intrinsics value for the cityscapes dataset?

from monodepth2.

bl0up avatar bl0up commented on June 2, 2024

@ezorfa Sure, I used this matrix:

self.K = np.array([[2262.52 / 2048, 0, 0.5, 0],
                           [0, 1096.98 / 1024, 0.5, 0],
                           [0, 0, 1, 0],
                           [0, 0, 0, 1]], dtype=np.float32)

from monodepth2.

ezorfa avatar ezorfa commented on June 2, 2024

@bl0up Thankyou so much for quick reply! Appreciated.

from monodepth2.

mrharicot avatar mrharicot commented on June 2, 2024

@ezorfa @bl0up There is a mistake in your intrinsics matrix
In the very large majority of cases you should have fx = fy (unless you have an anamorphic lens)
Here is a single calibration from a cityscapes sequence:

{
    "extrinsic": {
        "baseline": 0.209313, 
        "pitch": 0.038, 
        "roll": 0.0, 
        "x": 1.7, 
        "y": 0.1, 
        "yaw": -0.0195, 
        "z": 1.22
    }, 
    "intrinsic": {
        "fx": 2262.52, 
        "fy": 2265.3017905988554, 
        "u0": 1096.98, 
        "v0": 513.137
    }
}

Thus the intrinsics matrix should be:

self.K = np.array([[2262 / 2048, 0, 0.5, 0],
                   [0, 2262 / 1024, 0.5, 0],
                   [0, 0, 1, 0],
                   [0, 0, 0, 1]], dtype=np.float32)

from monodepth2.

ezorfa avatar ezorfa commented on June 2, 2024

@bl0up @mrharicot Hmm.. I see the mistake. Thankyou!

from monodepth2.

ezorfa avatar ezorfa commented on June 2, 2024

@mrharicot @daniyar-niantic Please clarify this:
When I prepare the cityscapes data using https://github.com/anuragranj/cc/blob/afd407869b89d61ee6911b13659e8d1c39dc3634/data/prepare_train_data.py, then the images are cropped (to remove car logo) and the resultant shape would be 2048 X 768 .

Will the intrinsics remain the same value as :
self.K = np.array([[2262 / 2048, 0, 0.5, 0], [0, 2262 / 1024, 0.5, 0], [0, 0, 1, 0], [0, 0, 0, 1]], dtype=np.float32)
or should I divide by img_height = 768 instead?

from monodepth2.

ezorfa avatar ezorfa commented on June 2, 2024

@mrharicot In my understanding, for the resultant image size of (img_width=2048 , img_ht = 768) the intrinsics value should be:

self.K = np.array([[2262 / 2048, 0, 1096 / 2048, 0],
                   [0, 2262 / 768, 513 / 768, 0],
                   [0, 0, 1, 0],
                   [0, 0, 0, 1]], dtype=np.float32)

Could you please verify the u0 and v0 values?

Thankyou!

from monodepth2.

mrharicot avatar mrharicot commented on June 2, 2024

@ezorfa for simplicity we did set the principal point to the center of the image, which is slightly inaccurate but has little impact in practice and makes horizontal flipping easy as there is no need to change the intrinsics
if you crop the bottom part of the image, you will need to recompute the location of the principal point.
see here for more details https://github.com/BerkeleyAutomation/perception/blob/master/perception/camera_intrinsics.py#L184
if you also resize the image you will also need to scale the vertical focal length by the inverse ratio of heights

from monodepth2.

Related Issues (20)

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.