Git Product home page Git Product logo

Comments (7)

JakubSochor avatar JakubSochor commented on July 17, 2024

Hi, orientation of what? Camera or vehicle?

from boxcars.

Zehaos avatar Zehaos commented on July 17, 2024

@JakubSochor, of the vehicle

from boxcars.

JakubSochor avatar JakubSochor commented on July 17, 2024

Yes, it is possible to compute the viewpoint vector to any point on the screen using following code.

def getFocal(vp1, vp2, pp):
    return math.sqrt(- np.dot(vp1[0:2]-pp[0:2], vp2[0:2]-pp[0:2]))

def getViewpoint(p, vp1, vp2, pp):
    try:
        focal = getFocal(vp1, vp2, pp)
    except ValueError:
        return None    
    vp1W = np.concatenate((vp1[0:2]-pp[0:2], [focal]))
    vp2W = np.concatenate((vp2[0:2]-pp[0:2], [focal]))
    if vp1[0] < vp2[0]:
        vp2W = -vp2W
    vp3W = np.cross(vp1W, vp2W)
    vp1W, vp2W, vp3W = tuple(map(lambda u: u/np.linalg.norm(u), [vp1W, vp2W, vp3W]))
    pW = np.concatenate((p[0:2]-pp[0:2], [focal]))
    pW = pW/np.linalg.norm(pW)
    viewPoint = -np.dot(np.array([vp1W, vp2W, vp3W]), pW)
    return viewPoint

To compute the viewpoint to the vehicle, you can use center of the 3D bounding box. The center can be obtained as intersection of diagonals of the 3D bounding box.

from boxcars.

Zehaos avatar Zehaos commented on July 17, 2024

@JakubSochor, It is seem that function below need a point from the original image.
def getViewpoint(p, vp1, vp2, pp):
The problem is that the given images only contains part(car region) of the original, and the 3DBB's coordinate is related to this region, such we can not calculate the center of the 3DBB on the original image.
Do I make myself clear?

from boxcars.

JakubSochor avatar JakubSochor commented on July 17, 2024

The 3DBB coordinates are in the original image space. To convert them to the cropped image space you need to subtract the 3DBB_offset. Therefore, you can just use the 3DBB in the original image space to compute the center of the vehicle.

from boxcars.

Zehaos avatar Zehaos commented on July 17, 2024

Got it, thank you very much : )

from boxcars.

hanlanqian avatar hanlanqian commented on July 17, 2024

@Zehaos Hi! The orientation you get is the center point of 3Dbox corresponding to the origin of the World Coordinate System, Right? But What should I do if I want to get the real front orientation of the vehicle? Can you please guide me on how to deal with it? Thanks~

from boxcars.

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.