last day (15 days later) » 

9:52 PM
1
Q: How to use camera parameters to calculate world distance in cm between pixels?

Ender AyhanI calibrated my camera using, separately, ROS, OpenCv and Matlab. People say that I need extrinsic parameters to calculate real distance between pixels in cm from the image. ROS does not provide extrinsic parameters explicitly, it provides a (4,3) projection matrix which is the output of multipl...

 
I mean centimeter (cm) by saying real distance. I don't calculate depth since people say that I just need intrinsic and extrinsic parameters. @MadPhysicist
@unlut Appearently, depth information is easier for me. To specify pixel distances, do I need to calculate depth information just for one time ? I mean, for example, If I take an image of a small object with known size and calculate the distance between pixels, can I use this information for another images ?
@Micka Do you mean that I have to determine the position of the object for every image ? (in my case , it is real-time application)
My camera is, for now, static. I captured lots of calibration images from a fixed altitude. After calculations, I will mount it on a drone. I think you understood me better than anyone.
 
How accurately will your drone be able to measure its distance above the surface you're imaging? (You will have to account for tilt as well, I suppose -- say, if it's windy, or the drone (I assume quadcopter) is moving, it won't be looking straight down)...
 
it is pretty accurate, nearly (+ or - 0,0025m) since I am using lidar. Also using pixhawk cube which has barometer. Drone will fly in indoor environment, so no wind. Yes it is quadcopter and the camera is downward facing. @DanMašek
I also want to say that I will collect continues images during flight but I will process only one image to get pixel coordinates after image stitching operation with collected images. So, can I assume my altitude (distance to object) and calculate distance between pixels to convert pixel arrays to 3D coordinates ?
 
Then you should be able to get a pretty good estimate. Calibrate it at a known height on some known-sized object. Then there should be a linear relationship between the real distance and the spacing of two adjacent pixels. This assumes your drone can keep the camera looking straight down, onto a level surface..
 
@DanMašek Briefly, I should do camera calibration (chessboard method) at the altitude that the drone will reach, right ? Because I did calibration at a lower height (1.45 meters).
 
9:52 PM
As far as I understand it, it doesn't matter at what distance you do the calibration... in fact you should move the chessboard around in the 3D space (tilting and moving forward/back) to get a good measure. What it does is determine the distortion caused by the optics, so that you can undistort the input and get a uniform (linear) image to make measurements on (or stack). The characteristics of the optics will stay the same no matter how far from the imaged surface you are (assuming it's fixed, not some mechanized auto-focus). -- It might be close if anything is adjusted, but best if static.
 
then I already did it as I mentioned in my post. I am looking an answer for the next step. Is just distance(depth) enough to calculate spacing of pixels ? If so, is there any tutorial because I could not find ? thank you
 
Do a simple experiment -- take an object of known dimensions, and image it from two known heights. Make it large, so that you minimize the error caused by pixel size (quantization) -- make it span most of the image at the lower altitude. Having made that measurement, you can calculate pixel/mm (or whatever unit you care for) along each axis, at two know altitudes. Knowing the relationship is linear, you can calculate a formula to give you pixel size at given altitude. | Once you figure that out, test the algorithm on objects of known size, and see how close it gets.
 
hey
 
firstly, thank you for your consideration
 
9:53 PM
thanks, no problem :)
 
I will not take your time much :)
your last comment is really answer
but I have some confusion to get rid of.
 
sure, go on
 
As you said, I will take two images of a known-size object from different altitudes
for example a square box
after that, I will detect its corner points (this will be challenging since the environment is non-uniform)
 
ideally a flat thing, if you have stuff that goes above the ground plane, then things will move around if the drone moves
if the environment is not flat, then things get a lot more difficult
 
what about chessboard like ine the calibration. because I already know its square size
but how can I calculate the number of pixels between two squares ?
 
9:57 PM
sure, you could use the chessboard, but the thing is.. it's fairly trivial when you're looking straight down at a flat surface
 
hmm, so what do you recommend me to use for measurement ?
 
IIRC there's a feature in OpenCV that gives you coordinates of each corner it finds
so, what's the scenario?
what's the drone flying over?
 
a maze
 
ok
what are the features of the maze?
what are the possible things we can encounter there? the better you can limit the scenario, the better
 
also there is a aruco marker on a ground vehicle which is near the maze
maze size is 10 m x 10 m x 40 cm
 
10:01 PM
40 cm walls, right?
 
yes, the height is 40 cm
but width of the wall is 5 cm
If you give me your email, I can send you my prototype maze. (If you wish)
 
do you use Skype?
 
yes, but not downloaded since I cannot use my camera of laptop because of some reason. But I can download it into my phone right now
 
you can add me on Skype, see my profile for username
 
excellent :)
 
10:04 PM
and send me stuff through that
 
okay, now I will do it after downloading
 
cool -- yeah, no need for camera or even voice, never felt much need for that, even though I've worked for Skype for quite a while :D
 
I thought that you wanted to video chat :D
sorry, my bad
I wrote, did you get ?
 
yah
 

last day (15 days later) »