Re: DIY Laser levelling using webcam and laser level
Hi Devmonkey
Yes the line did produce a gaussian plot. It was a crude test. I just placed the paper in front of the Logitec camera about 150mm away no backlighting just ambient fluorescent (Its night time) I did get the curve plot. it was all hand held testing lots of movement. I really want to test it properly. It will be interesting to try inverting greyscale?.
Cheers
John
Re: DIY Laser levelling using webcam and laser level
To invert the greyscale add the following line to FrameAnalyzer.analyzeNextFrame() below where the rotation is performed:
Core.rotate(mat, mat, Core.ROTATE_90_CLOCKWISE);
Core.bitwise_not(mat, mat); <-- Add this line
3 Attachment(s)
Re: DIY Laser levelling using webcam and laser level
Hi Devmonkey
Hi All
First tests!
Today I set up a quick test to determine what sort of accuracy might be achieved using a Webcam and laser.
I mounted the webcam on a linear rail slide, I was going to use gauge blocks against a stop to measure the resolution of the device using a cheap laser that I picked up from Aldi one day. it is the only line laser I have. That did not work because the hard plastic ends on the linear rails were too flexible, I could not get constant results.....
The Webcam is a 640 x 480 resolution Microsoft LifeCam VX -1000. It has an adjustable lens that I was unable to remove quickly so I just used it as is! Pointing the laser directly at the camera produced horrible flare. However angling the camera did work! I am not sure why? Probably something to do with the lens. The next tests will be done without a lens.
I think you could say that the tests were a bit of a comedy of errors!
Fortunately I has also set a magnetic base 0.01mm indicator on the rail. It saved the day. By simply pressing on the linear slide I was able to move the slide laterally about 0.04mm with medium pressure. when i released the pressure the indicator went back to zero. This is all I needed...
Now for the exciting part; Hidden at the bottom of the Gaussian graph there is a tiny numeric value, It followed my indicator movement when I moved the slide. very roughly a value of 1 to 4 on the graph value to 1 to 4 ticks on the 0.01mm indicator. I assume this correlation may not have been planned however with the particular camera I used it was very convenient.
I ran the test several times and it was repeatable.
0.01mm is equal to .00039" (about 4 tenths)
A very good result from a crude setup.
The following improvements will no doubt greatly improve the results.
A better camera with the lens removed.
Controlled ambient light. moving around the room can move the graph also sunlight entering the room moved the graph.
The sensor needs to be shaded as much as possible.
The numeric values at the bottom of the screen needs to be enlarged. Optional rounding and time averaging settings that can be applied to the displayed number would help to reduce the flicker.
I have yet to test the device with wire.
Regards
John
Three images below:
Homage to Johann Carl Friedrich Gauss https://en.wikipedia.org/wiki/Carl_Friedrich_Gauss
And the measurement principal of reversal. https://www.google.com/search?q=meas...%3Apinterest.*
Attachment 26280
Attachment 26282
Attachment 26281
Re: DIY Laser levelling using webcam and laser level
Hi John,
Yes the tiny number is the deviation in pixels from where you pressed zero.
I don't think it was ambient light affecting your setup, the laser saturates the sensor. It is so sensitive it will easily pick up deflections in your floor from walking about. This happened when I was testing too, I had to sit completely still. It is less sensitive to walking about on a 6 inch bare concrete slab but you can still move it a few pixels.
You don't need a better camera you just need to rip the optics off that one. The difference in quality between webcams of the same resolution is simply the optics.
Re: DIY Laser levelling using webcam and laser level
Hi DevMonkey
I just did this calc in Excel
sensor size in mm 2
/ pixels 640
Space between pixel lines = 0.003125 mm
I got roughly 1 integer value change to 0.01mm div on the Mitutoyo indicator.
Quite a big variation?
Regards
John
Re: DIY Laser levelling using webcam and laser level
My setup works out at the predicted resolution of 3um per pixel. I don't think you can trust this at all with your setup as the optics are still attached but with nothing to focus on. You are also getting a load of noise on the gaussian, this is probably either a function of the crappy optics on the camera or the laser line is using a diffraction pattern rather than a cylindrical lens.
Rip the lens off the camera, then you will also be able to see if the sensor is indeed 2mm.
If you think about it, without optics and the laser projected directly onto the sensor moving the sensor 1 pixel will shift the maximum intensity one pixel, there is no other option as the sensor and beam have moved relatively and the intensity profile of a cross section of the laser line hitting the sensor has not changed.
Re: DIY Laser levelling using webcam and laser level
Hi Devmonkey
Your comment.....
"or the laser line is using a diffraction pattern rather than a cylindrical lens."
Yes I think there is a problem with the laser source.
Without the lens the graph is far worse with multiple peaks. Upon opening the case there is a shaped plastic stepped prism that limits the beam to 90 degrees of coverage. the step is in the middle of the laser. (There are actually 2 similar laser sources in the unit) both are the same. it is not a tubular lens.
I will have to source a good quality line laser. not sure where yet?
The camera sensor appears to be closer to 3.5mm wide including the border so I guess the active area to be about 3mm wide. Its a fairly old unit but it works well.
Regards
John
2 Attachment(s)
Re: DIY Laser levelling using webcam and laser level
Hi John,
I'm just using a bog standard Dewalt laser level, part number DW088.
I'm curious, the laser you have, how thick is the line at 2 and 5 or more meters? If it is still a nice narrow line 2-4mm thick it could still be usable, try moving it further away from the sensor. Also try using the laser without the case on, maybe the window is distorting it as well?
The £3 diffraction based lasers I have that are total rubbish but still work but can only be focused to a fine line line at a specific distance making them useless for any actual measurement we need.
This is what the crap lasers look like looking into the lens:
Attachment 26294
This is what a cylindrical lens looks like on the DW088
Attachment 26295
I haven't tried one but this looks like it might work well:
https://banggood.app.link/AAvDRpISpZ
Cheers, Joe
Re: DIY Laser levelling using webcam and laser level
Joe,
I've cloned the repository to my W10 laptop but installing Maven doesn't seem to have worked though I think I've followed the instructions. 'mvn' is unrecognised as an instruction by the Windows command prompt anyway. Is there any chance of a more idiot-friendly installation of your software?
EDIT: OK I've got the Maven path variable correct this time and something's beginning to happen!
Kit
Re: DIY Laser levelling using webcam and laser level
Hi Kitwin,
Glad you are making progress. It is a bit of a pain to do if you don't already have a dev environment setup I agree. When I get time and when the software has evolved into a usable state i'll generate some native executables people can just download an run.
Cheers, Joe