Is it accurate to calculate the focal length( with pixel unit) based on real focal length( with millimeter unit) and the sensor size - camera-calibration

I want to find the focal length of a camera. I have its physical sensor size and physical focal length. I know I can use a calibration pattern to estimate its focal length. I also can do this by: physical_focal_length / (sensor_size / resolution). I want to know which one is more accurate?
Thanks.
YL

You only talk about focal length. The camera matrix contains values for the optical center...
And there are lens distortion coefficients. You can rarely calculate those. You'd need to know a lot about the design of your lens.
Calibration can be better or worse than calculating from nominal/design values.
It's better if done right. It can easily be worse.
Nominal design values are a good default and starting state.
When actually building the camera and lens, there can be slight differences to the design parameters. That is why calibration is important.
Either way, you should check any solution. Given an object of known size (ruler) at a known distance (...), does it appear the size in pixels that you would calculate from the known size and distance? How closely?

Related

What's the point of sampling multiple rays per pixel

What is the purpose of multisampled pixels in raytracing? In my experience writing raytracers, there is never any noise, only slight aliasing at lower resolutions, but in most diagrams I see, in the single sampled pixels, there is a ton of noise and black spots. Is this issue noise on single pixels exclusive to global illumination/antialiasing? Or is there another benefit to using multiple samples per pixel?
First of al, images generated by a traditional ray tracers are always affected by noise. The noise mainly originates from calculating the indirect illimitation part of the render equation. Recall the general render equation is:
Here, the integral part correspond to the indirect illumination and is is solved using Importance sampling algorithm. Which requires us to sample multiple rays in random directions at an intersection point p. This can be done by:
At every intersection branch in several directions to solve the indirect illumination
Trace multiple rays per pixel and sample random directions at each intersection point p
A combination of both.
Now, solving aliasing is traditionally done by sampling random directions with a pixel. Note, that this is not the only way to solve this problem. You can also render a high resolution image and down-scale it afterwards.

how to calculate camera extrinsic parameters from three known dimensions in the target plane

My question is as follows.
A single camera (constant in both position and orientation) is applied to monitor the motion of a far-away planar target.
The intrinsic parameters including focal length, sensor resolution, principal point, are known. The lens distortion is not considered.
In the world system, three dimensions about the target (in a plane) are known.
I wonder whether it is enough to determine the camera extrinsic parameters. If it is, how to calculate it?
Many thanks.
I think you can first use corresponding points x(image points) and X(object points) to determine the projection matrix P:
x = PX
then run interpretation of P to derive interior and exterior matrix:
P = H1 [I|0] H2
where H1 is 3x3 interior matrix and H2 is 4x4 exterior matrix.
Since you already know interior parameters, I think you can use them to adjust H2 to get a proper result.
Anyway, this method is still lack of high accuracy and need further improvement.

Essential Matrix from 8 points algorithm

In „Multiple View Geometry in Computer Vision” R.Hartley,A.Zisserman in chapter 11 - about computation Fundamental Matrix one can read:
„11.7.3 The calibrated case
In the case of calibrated cameras normalized image coordinates may be used, and the essential matrix E computed instead of the fundamental matrix”
Does it mean – if I have proper Intrinsic Cameras matrices (does it mean calibrated in this case?) I can calculate Essential Matrix directly (using 8 points algorithm) omitting calculating Fundamental Matrix?
And I can get matrices R and T from calculated Essential Matrix to reconstruction 3D model?
Regards,
Artik
Short answer, yes. See also longer explanation on Wikipedia.
From your correspondences, using the 8point Alg you obtain the Fundamental Matrix F.
From the relation E=K'^T F K, assuming that you know both K' and K (in case that both the images were taken by the same camera, you have K'=K), you can compute E.
From E you get 4 possible camera couple (P_0,P_0') (P_1,P_1')....(P_3,P_3'). Only one of this couple satisfy the positive depth constraint (i.e. the 3D points lie in front of both the cameras).
That couple will be your cameras.
Hope this help!
So, In general, a calibrated camera in visual odometry refers to a camera for which the intrinsic matrix is known.
In the case of a stereo visual odometry system, I typically take it to mean that the intrinsic matrix is known for both cameras, however, some of my co-works mean it to mean that the Rotation and Translation between the two cameras are known.
In Practice, there is hardly any distinction between the two as you can estimate the intrinsic matrix of a camera using various functions in MatLab or OpenCV, and given the instinct matrix, you can determine the rotation and translation between the two cameras.
Furthermore, the derivation of the fundamental matrix relies upon the Essential matrix and the intrinsic matrix of two cameras (the intrinsic matrix can be the same in the case of monocular visual odometry). This means that it is often the case that the essential matrix is estimated and the fundamental matrix is not.
For an explanation on getting the rotation and translation from the essential matrix, I recommend first watching a youtube video on Single Value Decomposition (SVD) and then reading: https://www.researchgate.net/publication/220556161_Visual_Odometry_Tutorial.
Good Luck with Your Studies Young Scholar.

Finding 3D position of a camera used to take a 2D picture

Given a 3D scene and a 2D image of part of that scene, is it possible to find the position of the camera used to make the image?
I'm going to assume from your question that you have four points in the 2-D space whose locations you know in the 3-D space. (If your real problem is identifying those point, I haven't the foggiest idea where to begin.)
Your question is therefore, where can the camera be to have produced this mapping from model to image?
The camera is performing an affine transformation of the form M x + T = y, where x is a vector in 3-space representing the point in the model and y is the 2-space vector representing the point in the image. Given four values for x and y, it's a straightforward matrix-arithmetic problem to solve for M and T (probably best to get MATLAB to help you here.)
Now, how do you translate M and T to position, location, and focal length of the camera? There it gets a little hairy but this page should help you (just remember, you are doing everything backwards).
If you take a random sampling of camera parameters, rendering the scene with each set of parameters, you can take the best matches as a starting point. You can then perform a local optimization of the camera parameters to find those parameters which reproduce the 2D image the closest. It isn't fast, but theoretically you could come up with very good guesses given enough time.
You need more information, but not necessary much more information.
The simplest thing to do would be to find an object or distance in the scene you know the length of (e.g. draw a virtual line in the image, say what the distance is in whatever units you want). Then you also need to know the focal length (inversely proportional to field of view angle).
Given the angle of view, a line segment (or perhaps two) with known length, you can very closely approximate the exact location of the camera with a bit of trigonometry. e.g. for a rough distance estimate:
/ |
/ |
/_d_I-segment
\ |
\ |
\ |
distance "d", field of view angle "FoV"
picture.physicalsize/d == tan(FoV/2)
picture.physicalsize/segment.physicalsize == picture.pixelsize/segment.pixelsize
thus
d = segment.physicalsize*(picture.pixelsize/segment.pixelsize)/tan(FoV/2)
If you want even more precision, you may need more than one line segment and more careful math.
Yes, but it depends. If the camera does not distort the image too badly, the simple trigonometry by ninjagecko might work but again depends on your application. If you want to learn how to do this in a more cleaner way and more mathematical way, check this out http://www.ces.clemson.edu/~stb/projective/.

Poisson Disk distribution on hemisphere

I just implemented Poisson Disk generation in the plane with this simple algorithm:
http://people.cs.ubc.ca/~rbridson/docs/bridson-siggraph07-poissondisk.pdf
Now I would like to generate a Poisson Disk distribution on the surface of a hemisphere (or better, on a part of the spherical surface, given a certain angle)
can anyone tell me an algorithm to do that?
Thanks!
Thanks thouis for your answer! i already found a solution before, so i'll poste it here for those who are interested:
first i create enough poisson disc samples in the unitsquare (enough means more than n)
then i sort those samples by the smaller coordinate (for example, a point (10,9), the smaller coordinate is 9 - another point (8,50) the smaller coordinate is 8 - the order of the points would be (8,50),(10,9) )
then i take the first n samples in the sorted list. due to the sorting mode, those samples will again lie in a square area. I then scale up the coordinates such that they lie again in the unit square. Now i have exactly n poisson disc samples in the unit square.
then I use the plane to sphere mapping described in http://www.cs.rutgers.edu/~decarlo/readings/mcrt-sg03c.pdf page 23 to get uniformly distributed samples on the spheresegment of an arbitrary area angle
works well for me
I would look at:
"Fast Poisson-Disc Sample Generation in n-Dimensional Space by Subdivision Refinement" by Gamito and Maddock. This should be fairly easy to extend to the sphere using "Rendering and managing spherical data with sphere quadtrees" by Fekete.

Resources