# How to guide a camera through a circular tube?

Let's say I have a 6-DOF flying camera and I want to make it move through a circular tube autonomously and let's suppose that the camera and the system that makes it fly are considered to be just a point in space. Which feature of the image I get from the camera can I use to move the camera appropriately, that is to get in one end of the tube and get out from the other?

For example, I thought I could use edge detection. As the camera moves forward through the tube, due to the fact that its far plane is not infinitely away, there is a dark circle forming where the camera sees nothing surrounded by the walls of the tube. I think that "preserving" this circle might be the way to go (for example if it becomes an ellipse I have to move the camera accordingly for it to become a circle again), but what are the features that will help me "preserve" the circle?

I would like to use image-based visual servoing to do that. However, what troubles me is the following. In most visual-servoing applications I have seen, the control objective is to make some features "look" in a certain way from the camera point of view. For example, we have the projections of 4 points and we want the camera to move accordingly so that the projections' coordinates have some specific values. But the features are actually the same.

In my case I thought that for example I could say that I want the projections of the 4 "edge points" of the circle/ellipse to take specific values so that they define a circle centered at the fov of the camera. But if the camera moves to achive this setup of features, then the 4 new "edge points" will correspond to the projections of 4 different real points of the pipe and the theory collapses. Am I right to think that? Any way to get past it?

Any oher ideas or relevant literature?

If you cannot sense your closeness to the wall of the cylinder, then the image itself will have to guide you.

When the end of the cylinder is completely within the field of view of the camera, I think your approach is good. When the circle becomes an ellipse that means the focal plane of the camera is skewed relative to the end of the pipe, and you will need to correct the UAV's orientation. You will also need to ensure the center of the circle, or centroid of the ellipse, is centered in the camera's image space. When it is not centered, you will need to compensate the UAV's position.

Be prepared for the circle to become an ellipse with ANY orientation in the camera's image. That is, it won't always have the long axis of the ellipse aligned with one of your camera axes.

Finally, what will you do when you are so close to the end of the pipe that the circle is larger than your camera's field of view? That is where your approach breaks down. Is it possible to use a second, reward-pointing camera to keep you going straighr?

EDIT

Based on your comment, be careful about the object you are looking for obscuring some of the circle/ellipse at the end of the pipe. You might end up having to modify your vision processing algorithm to allow for blockage of part of the pipe end. In that case, you need at least five points on the ellipse, to determine the coefficients of the ellipse. If the object is small and the diameter of the pipe is large, this should not be a problem. But we don't know from the question.

• I assume that the uav will locate an object inside the pipe and will stop there, so I don't have to face the problem you mention last yet. I also added some more details in my initial post... Please check it out! – Controller Feb 29 '16 at 14:58
• Edited based on your comment. – SteveO Feb 29 '16 at 15:05

The visual servoing will probably be sufficient for keeping the open end of the tube in view -- keeping the proper orientation of the vehicle with respect to the tube. The goal will be to keep the center of the detected circle in the center of the camera's view.

However, this technique will not be sufficient to tell you how far you are from the edges of the tube. In theory, yes -- but in practice you won't have enough precision to detect the slightly misshapen circle before you crash into the side wall.

Simple horizontal range finding might be the best (safest and most accurate) way to maintain your distance from the walls.

• How am I supposed to prevent the detected circle from becoming an ellipse by just keeping its center in the center of the camera's view? – Controller Feb 29 '16 at 16:21
• I'm saying that you can't. It will only look elliptical if the vehicle's angle from the normal is significant enough -- probably more angle than the dimensions of the tube would allow. I would be surprised if your camera was good enough to correctly pick up that slight deformation shape before you hit the wall. – Ian Feb 29 '16 at 16:28