0

So if you take a pinhole camera and make it as the origin of our plane(3D) and a pixel from the image plane and connect the two with a straight line it should make a vector, which has direction and a length. Think of this as the path followed by the light reflected from an object into the camera lens. And i want to calculate this. I think we have to use the cameras intrinsic properties for this.

Below is a statement that made me think about it all.

In a pinhole camera model, each pixel defines a direction vector in 3D space, specifically the vector from the projection center through the pixel's position on the image plane.

Below is an image better explaining this. I want to calculate the three red lines, and known parameters would be, i guess, the camera position(origin) and the image pixel value, and the intrinsic camera parameters.

  • 1
    Where oh where did you get that image? – OnBreak. Dec 20 '19 at 8:46
  • See this. If you know the focal length and the pixel position from the center (pixel coordinates factored by sensor pixel density), you know the angle of the view ray. – xenoid Dec 20 '19 at 9:25
  • 5
    I'm voting to close this question as off-topic because it is a math/engineering question. – xenoid Dec 20 '19 at 9:26
  • @Hueco i googled ray tracing and in the images tab....i found it after a couple scrolls. I had seen a similar image thought i could find it but this worked too... upload.wikimedia.org/wikipedia/commons/thumb/8/83/… – rockangator Dec 20 '19 at 10:39
  • 1
    @Hueco The OPs image seems to be representation of a 3D image render. You have the 3D scene objects in front of the plane. The camera object represents the location, aspect ratio and field of view of the observer and the image represents the plane (monitor screen) onto where the 2D image of the 3D scene is projected. The use of "camera" in this case is a standard in 3D graphics. – Peter M Dec 20 '19 at 15:06
2

As pointed out in the comments, your illustration shows the image in the wrong place. The image is formed behind the lens. Moreover, the image is doubly inverted with regard to the actual object:

Object imaged by pinhole

If you put the pinhole at the origin (0, 0, 0), things are quite simple: no calculations are necessary, just a reflection about the origin. Suppose the film/sensor plane is a distance f away from the pinhole. A point (x, y) in the plane then corresponds to the vector (x, y, –f). Invert this and you get (–x, –y, f) pointing in the direction of the object. Multiply by the distance to the object, and I think you have the vector you were asking about.

| improve this answer | |
  • 2
    If the OPs illustration is of a 3D render (which it seems to be) then the image is shown in the correct location. – Peter M Dec 20 '19 at 15:08
  • @PeterM i dont quit get what you mean but link might help get a better idea. – rockangator Dec 20 '19 at 17:53
  • @Kahovius i have the same basics in mind...but since i have the point (x,y) in pixels from the image and the real object is f meters away, how am i to deal with this. btw f here is unknown. – rockangator Dec 20 '19 at 17:53
  • 1
    @rockangator Your original illustration portrays how a 3D scene (EG from a game engine) is rendered onto a 2D plane (EG a monitor). In the 3D rendering world a "camera" is the term used to describe the orientation and location of the person viewing the scene (EG the "center of projection" as per that link) – Peter M Dec 20 '19 at 18:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.