Code Monkey home page Code Monkey logo

Comments (5)

sampepose avatar sampepose commented on June 3, 2024

This is how I've been doing this:

Assume your data contains an image with width W, height H, focal lengths fx, fy.
Demon assumptions: width 256, height 192, (normalized) focal lengths 0.89115971, 1.18821287.

We can find the crop dimensions H' x W' from the relationship between focal length and image dimensions:
(0.89115971)(256) = (fx)(W')
(1.18821287)(192) = (fy)(H')

Make sure you normalize your fx, fy values (e.g., fx_norm = fx / W).

You can then resize this cropped image to the required 192 x 256 dimensions.

Best,
Sam

from demon.

harishannavajjala avatar harishannavajjala commented on June 3, 2024

@rnunziata @sampepose I have a question. After getting the crop dimension H' and W', I am wondering from which side of the original image should I crop this new one. And what if the object that I want to calculate distance to is lost after cropping?
Thanks.

from demon.

sampepose avatar sampepose commented on June 3, 2024

You can crop anywhere in the image (center crop, random crop, whatever). Crop so the object is still in the image.

from demon.

harishannavajjala avatar harishannavajjala commented on June 3, 2024

Thanks !!

from demon.

benjaminum avatar benjaminum commented on June 3, 2024

The normalized intrinsic parameters we trained DeMoN on are

K = (0.89115971  0           0.5)
    (0           1.18821287  0.5)
    (0           0           1  )

To adjust the focal length of your image, you scale the image such that the normalized focal lengths for the x and y dimension match (0.8911 and 1.1882). This is what @sampepose described in the second comment.

The principal point is exactly in the image center (0.5, 0.5). This means you should crop with this point as the center.

I hope this helps.

from demon.

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.