Hello Guest it is April 18, 2024, 03:13:46 PM

Author Topic: setting up cammera and laser  (Read 57103 times)

0 Members and 1 Guest are viewing this topic.

Offline Greolt

*
  •  956 956
    • View Profile
Re: setting up cammera and laser
« Reply #10 on: December 04, 2007, 04:46:51 PM »
To be fair,  Tom was using the example of a spot laser just to make the concept clear.

Thanks for taking the time Tom.

Greg

Offline Don C

*
  •  25 25
    • View Profile
Re: setting up cammera and laser
« Reply #11 on: December 04, 2007, 05:06:34 PM »
 Its hard enough to get a answer that is plane and to the point. To often poster try to make things harder than they need to be. When someone answers a post with wrong or misguided info it just makes it harder for folks that need an answer they can use. All I wanted to know was the placement of the laser in referance to the camera.
  Thanks
   Don
Re: setting up cammera and laser
« Reply #12 on: December 04, 2007, 06:43:22 PM »
The example art shows is a line laser not a point laser. I have used David, and triangle and both use a line laser. I also own a nextengine 3d laser scanner. I think your confused and should find out what is correct before giving advice.
 I could not resist
 Don

Hello Don,

My apologies for directing my previous post to you. You are correct. Your query was specific about setting up a line laser and my response was meant to be a general tutorial to demostrate the principle of laser triangulation with minimal equipment.

So, although I stand by the accuracy and usefulness of my response, it did not answer your question and I should not have quoted your query.

This is only my second day on this forum and I am just getting the hang of how to post. Perhaps I should have started a new thread for discussion of laser triangulation basics.

Tom Hubin
thubin@earthlink.net
Re: setting up cammera and laser
« Reply #13 on: December 05, 2007, 08:09:18 PM »
Does it really matter in which axis the camera and the laser are installed as long as the movement and capture are in the correct direction?  You could mount the laser and camera on the vertical with the line being on the horizontal.  I see why Art did it this way, he took advantage of his CNC machine and it's ability to move in precise steps.
Re: setting up cammera and laser
« Reply #14 on: February 18, 2008, 10:12:36 PM »
Tom

You say in a previous post you want a short depth of field (DOF) and a narrow field angle (FOV)...why? I would think you need at least 1.4 times (if the camera plane and the laser plane are at 45 degrees to one another) the field view so that the laser is in sharp focus when its in the camera's field of view. I am not sure if fully follow what Art is doing in his setup, does he change the camera/ laser height to get a deeper measurment?

The way I see it if the height above the object being scanned is fixed the maximum measurable distance in the Z direction will be the camera field of veiw devided by 1.4  for a 45 degree intersection of laser plane and camera axis.

I understand that minimising both feild and DOF will increase the pixel to displacement amount therefore increase scanning resolution but maybe we should work backwards from a desired resolution (plus safety margin like 3 times) and then decide what FOV is desirable to acheive this.


Cheers

Mark

Re: setting up camera and laser
« Reply #15 on: February 19, 2008, 05:27:17 AM »
Hello Mark,

Thanx for commenting and questioning. I work best in an interactive mode.

Accuracy depends on being able to find the center of the image of the laser where it encounters the target surface. Noise, like illuminated background objects, can be a serious problem. Part of the solution is to make the laser diameter very small so that it is 100 to 10000 times brighter than any other light on the target surface. Another part is to be sure that the laser is to be imaged small on the camera ccd array while anything closer or farther is blurred.

That means that the laser plane must be imaged onto the ccd plane. A short depth of focus will permit a fine image of the laser while blurring any sources not originating in the laser plane.

Most of the drawings I have seen that explain the principle of laser triangulation show a single line being traced from the intersection of laser and target, through the center of the lens, to the ccd array. This is valid for a pinhole camera that does not have a lens but uses a tiny pinhole instead. Unfortunately a pinhole camera has low resoultion, low sensitivity, and high depth of focus...all undesirable characteristics.

When you use a lens you need to consider the point where the laser encounters the surface as a small source scattering light in all directions. A cone of that light passes through the lens and is imaged to a small area. If you trace several such cones you will find out that if the ccd array plane is parallel to the lens plane then the laser plane must also be parallel to the lens plane. If this is not so then most of the points in the laser plane will not be imaged onto the ccd array. Putting it another way, the "points" on the ccd array will be large blurs.

To use an inexpensive camera like a webcam, with the lens built in so that the lens plane is parallel to the ccd plane, it is necessary to arrange the camera and laser so that the laser plane is also parallel to the ccd plane.

Ideally the laser would point straight down the z axis and the camera would be off to the left and looking to the right. However, the camera's view would be blocked by the target.

A more practical solution would be for the assembled gauge to be rotated. Suppose the setup is rotated 30 degrees CW. Then the laser plane is 30 degrees CW of the z axis and the camera axis is 60 degrees CCW of the z axis. The ccd plane and lens plane are parallel to each other and to the laser plane. This also results in very little distortion since the only source of distortion is the lens itself.l

Certainly it is desirable to package in other ways. Like maybe have the laser pointed straight down the z axis and have the camera axis 30 degrees CCW from the z axis. This is the type that I used to design. The problem is that the laser plane is not parallel to the ccd plane. In order to form an image onto the ccd array it is necessary to separate the lens from the camera and mount it at an appropriate angle.

We can talk about those calculations if there is interest. But to use a prepackaged camera and lens it is essential that the laser plane be parallel to the ccd and lens planes. The lens should have the lowest fNumber you can arrange so that only the laser plane is imaged onto the array while background and foreground are blurred as much as possible.

If you do this then you can turn off the camera AGC and set the exposure time for 1ms or less. All of the foreground and background will be black since the exposure time is so short. The laser scattered from the target will be bright enough to be detected by the camera and it will only cover a few pixels. This allows for faster capture of frames and faster processing of the small data set.

I don't know what hardware arrangement Art and others are using. The written descriptions that I have seen have been vague and I have seen no drawings.

Tom Hubin
thubin@earthlink.net
Re: setting up cammera and laser
« Reply #16 on: February 19, 2008, 06:30:44 PM »
Thanks Tom

Ok I now understand. What I was confused with was your decription and Arts setup which shows the included angle between the laser plane and the optical axis being around 45 degrees.
My background is also in laser imaging and electronics as I used to work for an imagesetter manufacturer in Canada. So I understand flat field optics and laser beam shaping and have access to some parts from some decommisioned gear at my new job (actually 90% of my CNC router is being built with salvaged high quality parts)

So if I understand correctly the ideal is to have a F-theta type optic in front of the CCd to bring the laser plane in focus over the entire CCD while still having the camera axis a something less than the ideal 90 degrees included angle (FYI for those not familiar with F-theta optics they are a special type of lens (usually an array of lenses) that has different focal lengths F depending on the incident angle theta and are used in all flatbed imaging devices like photocopiers and scanners)

Now I guess the challenge is to either find just the right optic ($$$ and quite involved) or to use sofware to find the center of a fussy beam image (less than ideal and sacrifice accuracy and resolution). The later is the approach that seems to be favoured by both Art and the David setup.

Anybody got access to ray tracing software? Might make finding the right layout and optics choice easier.

I am still a long way from completing my CNC and have a huge pile of parts waiting to be assembled so unfortunately I can't test much right now but when it is all together I plan on using high res B/W securiity cams which were part of a machine vision system and either buy a cheap laser pen or use the high end optics that I also have out of an old imagesetter and add a line gen optic.

Cheers

Mark

PS When I do get to the test stage I have access to a laser power meter and 2 axis beam scan collimation shearing plates, stearing first surface mirror etc etc..This is not however the case for most people and thus maybe those of us that have the gear and some i dear,  can come up with a simple solution thats more obtainable to the masses. I think software solution is the go but maybe we can improve the overall performance with a bit of optical enhancements.
Re: setting up cammera and laser
« Reply #17 on: February 20, 2008, 01:13:56 AM »
Hello Mark,

> So if I understand correctly the ideal is to have a F-theta type optic in front of the CCd
> to bring the laser plane in focus over the entire CCD while still having the camera axis a
> something less than the ideal 90 degrees included angle

No. The lens is a typical imaging lens...an fTan(theta) lens if you want to put a math label on it. An fTheta lens is used to produce a constant velocity line scan from a rotating mirror. An fTheta lens will produce distortion if used for imaging.

I will say that a small angular field of view is preferred as that is simply a longer focal length and otherwise nothing special. A short focal length lens produces a wide angular field of view but usually also produces significant barrel distortion unless you buy an expensive wide angle lens. Try to keep the full angular field of view under 20 degrees where the tangent of the angle is nearly equal to the angle in radians. Focal lengths in the 10mm to 25mm range are much better than 3mm to 10mm range for low distortion. 

> Now I guess the challenge is to ... use sofware to find the center of a fuzzy beam
> image (less than ideal and sacrifice accuracy and resolution).

Bad plan. That is like saying that you will not use an antenna because you can digitally salvage a radio signal. There is only so much you can do with software to salvage a poor signal buried in noise.

> Anybody got access to ray tracing software?

I do.
 
> Might make finding the right layout and optics choice easier.

I have done this many times. However, I need the lens prescription to do a proper trace. That info is not included with a $30 webcam. I have reverse engineered one camera but cannot possibly reverse engineer the variety of cameras being used by this group.

When I did this for hire I started with customer requirements then chose the camera and its lens and the laser and its lens from optical engineering catalogs and designed everything else. Costwise these components put the project out of the amateur's reach.

But to see for yourself how bad it is when the ccd plane IS parallel to the lens while the laser plane IS NOT parallel to the lens you need only do a paraxial ray trace on graph paper or with line drawing software. If I can figure out how to post embedded drawings I will post some and describe the problem details.

Tom Hubin
thubin@earthlink.net
Re: setting up cammera and laser
« Reply #18 on: February 20, 2008, 08:20:28 AM »
Hi Tom

Its good having a 10 hour time delay between us (Your in the UK? aren't you?) as it allows me think about your response and come up with some more questions.

Like I said my background is going the other way and putting a focused beam onto a flat surface that is orthogonal to the center of the scan rather than read an image back to a CCD. Hence the need for optics that have longer focal lengths at the sides of them than at the center. BTW they don't actually do a perfect job of creating a constant velocity scan and the artifacts (compression and expansion of the image in the scan direction) are removed by manipulation of the data clock which is frequency locked to the scanner... but I digress.

I am still not clear on what type of optic element would be required to keep the laser in focus with a non orthogonal CCD axis to laser plane. I would have thought it would be some form of cylindrical lens or prism not just the standard lens mounted at an angle to the CCD.

Maybe I'm not thinking about this the right way. Here's how i see it:

First off I am only interested in the image of the beam at the point it crosses the horizontal line of the lens.
Lets assume I want the camera axis looking straight down and the laser plane intersecting it a 45 degrees from the RHS.The image from the camera is in landscape and the laser plane draws a vertical line.
 Lets also say that when the beam is imaged in the center of the CCD that this represents Z(measured)=0 and if it is to the right this is Z(meas) >0 to the left of center Z(meas) <0
We want the beam to be in focus for the entire range from left to right but the distance is varying hence the need for a longer focal length of the LHS compared to the RHS.

Looking at it another way if I was to place a DOF scale (with the same angle as our beam angle) under the camera the entire scale should be in focus if the center is in focus.

I usually draw pics to help explain what I'm thinking so this may or may not make any sense.

 I agree that you can only salvage so much from a poor signal, I also agree that good optics are outside the scope of what most of us are able to use in our designs (like I said previously $$$ and quite involved) so we have a catch 22.

You can however do some pretty neat stuff in S/W to reduce the effects of noise much the same way that you do in electronics through differential inputs. For example take the image frame with the beam on minus the same frame with the laser off.
You are also right in pointing out that you will most likely have either barrel or pincushion distortion but this too can be compensated for by s/w calibration using a look up table and a known gauge block.

I may be wrong but I would think a B/W security camera would be better suited to this app than a Web cam. You don't need colour as you will just be filtering out as much as possible outside the 670nm (for HeNe or for whatever colour laser you chose) plus the single CCd may be less noisy and most likely higher res. I would think that one could get one of these fairly inexpensively since everyone wants colour theses days.

So the question now is.... If one has a camera and separate lens is it a simple matter of adding another optical element between them to get the desired effect and if so what does this beast look like?

My setup consists of Panasonic B/W security cam with a 1/3" CCD  a 5mm extension tube and a 50mm 1:1.8 lens . this gives a focal length of around 12" with a FOV of around 1"
 I can make the image even tighter using a 2x adapter but that really restricts the FOV and hence the measurement range plus by changing the extension tubes I can increase or decrease the working range which will depend on how I end up mounting the gear.

The other thing that I would think is a trade off is that as you decrease the included angle between the camera axis and the beam plane the measurement range goes up while the resolution goes down while the FOV remains constant.


Cheers
Mark
Re: setting up cammera and laser
« Reply #19 on: February 21, 2008, 03:08:47 AM »
Hello Mark,

> Its good having a 10 hour time delay between us (Your in the UK? aren't you?)

Nope. Just a night person in Maryland USA.

> I am still not clear on what type of optic element would be required to keep the laser
> in focus with a non orthogonal CCD axis to laser plane.

Nothing special. An ordinary imaging lens is all that you need.

> Maybe I'm not thinking about this the right way.

You need to read about the Scheimpflug principle. Many references in a google search. Reading about it will make you cross eyed and dazed until the instant that it makes sense.

Here is a mini lesson.

Let's define the optical axis as the line perpendicular to the lens plane and passing through the center of the lens.

odist is the distance from lens to object plane as measured along the optical axis.

idist is the distance from lens to image plane as measured along the optical axis.

latmag = -idist/odist is lateral magnification where the optical axis intersects the object and image planes.

It is customary for the object plane to be parallel to the lens plane. In that case the image is also parallel to the lens plane.

However, if you tilt the object plane so that it is NOT parallel to the lens plane then the image plane will also be tilted so that it is NOT parallel to the lens plane either.

To be more specific,

tan(image tilt angle) = latmag*tan(object tilt angle)

or

image tilt angle = arctan(latmag*tan(object tilt angle))

> You are also right in pointing out that you will most likely have either barrel or pincushion
> distortion but this too can be compensated for by s/w calibration

agreed

> I would think a B/W security camera would be better suited to this app than a Web cam.
> You don't need colour as you will just be filtering out as much as possible outside the
> 670nm (for HeNe or for whatever colour laser you chose) plus the single CCd may be
> less noisy and most likely higher res. I would think that one could get one of these
> fairly inexpensively since everyone wants colour theses days.

I agree about B&W being better and cheaper than color. However, webcam vs BNC is a debate about connector and communication styles. Either type has both good and poor quality cameras. I am accustomed to the Sony XC-75 but that is a $500 BNC CCTV camera and then you need to buy a frame grabber and do some programming. Webcams are convenient because they are cheap and plentiful and...most important...that is what Mach3 uses. 

> So the question now is.... If one has a camera and separate lens is it a simple
> matter of adding another optical element between them to get the desired
> effect and if so what does this beast look like?

Only one lens needed. See the math above to start.

> My setup consists of Panasonic B/W security cam with a 1/3" CCD
> a 5mm extension tube and a 50mm 1:1.8 lens . this gives a focal
> length of around 12" with a FOV of around 1"
> I can make the image even tighter using a 2x adapter but that really restricts
> the FOV and hence the measurement range plus by changing the extension
> tubes I can increase or decrease the working range which will depend on how
> I end up mounting the gear.

You need to start with your requirements and do the math to determine lens focal length and location and orientation. Then find a close lens and redo the math to fit the chosen lens focal length.

There are graphical techniques as well as math for the layout but you really need to get a handle on the Scheimpflug principle first.

> The other thing that I would think is a trade off is that as you decrease the included
> angle between the camera axis and the beam plane the measurement range goes up
> while the resolution goes down while the FOV remains constant.

The ANGULAR FOV remains constant.

The resolution at the near end of the measurement range is the best while the resolution at the far end is the worst. Kind of like your own vision. You might judge distance to a far away object as 100 feet plus or minus 10 feet and the distance to a nearby object as 10 feet plus or minus 1 foot.

Tom Hubin
thubin@earthlink.net