-
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
-
Re: DIY Laser levelling using webcam and laser level
Joe,
That would be good. It's downloaded everything at the second attempt but I'm now having to install java JDK in place of the vanilla version. We'll get there in the end. It's getting late here in WA (just after midnight) but a nightcap over ice is helping pass the time:beer:
Kit
-
Re: DIY Laser levelling using webcam and laser level
Joe,
So here I am in the bright light of the morning:cool:
No luck with the software I'm afraid. I got the following message from Maven about the lack of a compiler. I loaded the JDK version of Java, deleted and reloaded the vanilla one but nothing's changed. I read the Maven help file referenced later in the error report (not shown here) but didn't get anything I could see how to action from it.
Unless there's an obvious way forward I'm going to wait until you produce the more easily installed package.
-
This has been a very interesting thread to follow, plenty of new knowledge about the use of lasers and taught wires learned. I need to build a more solid base for my machine than the reinforced office table it sits on at present and that will be the time for some minor mods and reworking aimed at improving the accuracy.
Kit
_
c:\cnc\github\laserlevel>mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< webcam-apps:laserlevel >-----------------------
[INFO] Building laserlevel 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ laserlevel ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory c:\cnc\github\laserlevel\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ laserlevel ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to c:\cnc\github\laserlevel\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
-
Re: DIY Laser levelling using webcam and laser level
Kit,
You need java.exe on your PATH and setup another environment variable JAVA_HOME that points to the directory with the jdk in it. e.g. if java.exe is in c:\\java\jdkXXXX\bin\java.exe then JAVA_HOME must point to c:\\java\jdkXXXX
Anyway to help i've put up a build in a zip file here:
https://github.com/betzuka/laserleve...ilds/laser.zip
Download that, unzip it and double click on laser.bat
It still requires that you have java installed.
Cheers, Joe
-
Re: DIY Laser levelling using webcam and laser level
Joe,
Thankyou, that's brilliant. It works as simply as that!
-
For anyone else who want's to try it the only thing you need to know is how to dissable the built-in webcam on your laptop. Go into Device Manager, click on 'Cameras', Right-click on the entry for your buil-in camera and click 'dissable device'. This will cause the software to find your USB camera instead.
-
Unfortunately my Black & Decker 'CrossHair' level doesn't produce a suitable beam, it's a series of dots even though the source inside appears to have a curved lens in front. Perhaps the family of MYCNCUK contributers can come up with a list of commercial laser levels that produce a suitable, unbroken line.
Kit
-
Re: DIY Laser levelling using webcam and laser level
Kit,
Did you remove the camera lens? Do you have a picture of the laser? If it is a single laser that produces a cross then it does not have a proper lens in my understanding, for example my laser produces a pair of crossed lines but it has two lasers, one vertical, one horizontal.
I have updated the build to include a camera chooser if more than one camera is attached to the computer so you don't have to disable the built in one.
https://github.com/betzuka/laserleve...r.zip?raw=true
Joe
-
Re: DIY Laser levelling using webcam and laser level
Joe,
You'll be calling it "Plug & Play" if you carry on like this! Exactly what most of your readers require, thankyou.
I haven't got as far as mutilating my webcam just yet, the B&D laser beastie is many years old and is specifically designed to hang on a wall and produce a straight horizontal and vertical line along the same wall it's hung on rather than a horizontal line across the room. Laser units are cheap on eBay, it's just a matter of working out which ones to buy and how to mount them.
I've yet to decide exactly how I'm going to use your program, with a laser or with John's sugestion using the image of a taught wire, or with both at different stages of setting up the whole machine. More thinking and experimenting is required to devise a method of aligning all the different parts of the machine in isolation and in the correct order to end up with a hand built machine that can cut out pieces with a much higher accuracy than the basic methods used to construct it.
Kit
-
3 Attachment(s)
Re: DIY Laser levelling using webcam and laser level
Hi Kitwin
Glad you got the software going, pity you are so far away From Melbourne.
Hi Devmonkey
This weekend I experimented with the tools I had to hand. An Aldi Cheapie Laser and the Microsoft webcam. I wanted to understand my tools better.
This session I left the lens on the camera and to avoid the distortion caused by the lens, I pointed the laser at a piece of flat finished black cardboard. I aimed the camera at the cardboard As you can see this cardboard caused the beam to appear very dim visually. However as the Graph below shows the camera responded very well to the beam. The software was able to discriminate the bright beam against a dark background very well. A nice sharp Gaussian peak was produced. i Am not sure what the white flecks are I grabbed the screen and each time they were in a different position They did not affect the resulting graph.
However the setup reminded me that using a lens will change the resolution of the device.
See the spreadsheet image below. For no particular reason I had placed the camera at a distance from the target that meant that the area covered was about 3.8 inches. This means that the 640 pixels of the image sensor will be divided over the 3.8 inches.
I used gauge blocks to measure a distance of 0.05 inches. a difference of about 8.4 pixel lines. This means that the setup as illustrated can not resolve more than about 6 thousandths of an inch.(I did not attempt to read more than 1 digit past the decimal point in the output box) The results were repeatable.
Clearly if a camera with a lens is to be used from wide angle to microscope the resolvable distance will be determined by the magnification power. A microscope would increase the resolution. As I am interested in wire alignment, using a lowish power microscope is worth consideration. Depth of field needs to be investigated.
Yes I knew this before but making a test brings it into focus. (Excuse the pun!) It also made me think on other applications that may benefit from a wider field of view at a lower resolution. As tested 6 thousandths of an inch resolution over 3.8 inches is excellent. EDIT There may be some lens distortion of the image and therefore the linear accuracy that would need to be taken into account.
My next tests will be with wire no lens.
Regards
John
Three images below.
Attachment 26316
Attachment 26317
Attachment 26318
-
Re: DIY Laser levelling using webcam and laser level
John,
Great stuff. The latest version of the software allows you invert the intensity so it should work with a wire (as a shadow camera). You can also input a pixel to um scale (or inches or whatever) so it reads in your calibrated units rather than pixels. There is a preferences option in the menu. Note it leaves the webcam image unchanged performs the inversion on the intensity profile before fitting the gaussian.
FWIW the usb 1000x microscope I took apart to start this project at mid (say 100x) magnification is effectively 1:1 with the sensor area hence why it works so well without the lens. The magnification of these things seems to be defined as the multiplier of the subject size to screen size when displayed, i.e. it fully depends on the pixel pitch of your screen, thus should be largely ignored.
My screen is 1440 pixels tall and has a height of 330mm therefore a vertical pitch of 1440/330 = 4.36 pixels/mm. Given the 640 pixel height we are using this implies a screen height of 147mm, so without the lens a 2mm test subject that appears 147mm tall is equivalent to magnifying 73x using the above very ropey definition of magnification.
The depth of field of the usb microscope lens at the magnification you need is a few mm, should be sufficient. Non-linearity of your lens would have to be measured by focusing on a microscope scale, I have a couple of these that came with the cheepo usb microscopes.
To my mind much easier to think it terms of subject size to sensor pixel pitch, e.g. with no lens and 640 pixel rows over 2mm we get 3um.
Also something you must be aware of if trying to use a camera lens is that none of them are firmly fixed to the camera board meaning they will wobble and generate huge error as you move the camera around. The only solution I came up with for this was to find the focus/magnification you need then super glue the lens assembly in place. Also related is that the camera boards themselves are quite often not firmly fixed into the webcam cases causing the same problem. This is why I built a highly stable cube mount for the sensor (sensor is bolted hard to the delrin cube).
Cheers, Joe
-
1 Attachment(s)
Re: DIY Laser levelling using webcam and laser level
Hi all,
I've put a new version up with some major improvements, starting to turn into a piece of software I might use!
So it will now allow you to record a bunch of measurements against a particular zero, and you can export these to the clip board for pasting into excel or whatever. It will also allow you to average the samples used in taking a measurement, this is set in the preferences and defaults to 10. Remember once you have calibrated it you can put in the scale per pixel so you get real units displayed and measured rather than pixels.
Attachment 26319
Get the latest version here:
https://github.com/betzuka/laserleve...r.zip?raw=true
Cheers, Joe
-
Re: DIY Laser levelling using webcam and laser level
Quote:
Originally Posted by
John McNamara
Hi Kitwin
Glad you got the software going, pity you are so far away From Melbourne.
I'm far away from everywhere!
-
Re: DIY Laser levelling using webcam and laser level
Joe,
It's all working, giving a good display even with the B&D laser which I thought might be a problem. The only issue I have now is that my not-quite-full-HD 768 line laptop monitor can't show me the table of results which wants to be at the bottom of the screen rather than the side as in your picture. Looks a treat on the desktop monitor though. I wonder what the chances are of my wife lending me her swanky new full-HD touch-screen hybrid laptop for use in the shed? I could fold it over into tablet mode, put it keyboard down on top of a pile of sharp, greasy tools and then enjoy a slow, painfull death:thumbdown:
-
1 Attachment(s)
Re: DIY Laser levelling using webcam and laser level
Hi guys,
Fixed some UI issues so it should work on a 1024x768 laptop screen (just for you Kit). I've also added linear regression to the measurements taken. This is because the best way to use this imho is not to try to align to the reference plane (the laser) rather to calculate the error to the reference plane and then to shim or scrape such that these errors lie in a straight line. Please let me know if this makes sense to you. It is kind of a fudge and only works because given our vertical resolution is only +/-1mm and we are using it over a range of over 1000mm (or however long your x rail is) giving a worst case divergence angle of ~0.1degrees, i.e. the laser and the linear regression are very nearly paralllel. This implies a worst case vertical error of the residual caused by the divergence of the regression line from the laser is a rather small 1 nanometer, 1000x smaller than our sensor resolution.
The app now plots both the absolute and residual errors and tells you how much to shim or scrape at each point. So this is everything we need to level a rail, and when operated with a vertical laser line everything we need to straighten a rail. When I get around to it I will add two further measurement types, one for getting two rails planar, the other for tramming the spindle.
https://github.com/betzuka/laserleve...r.zip?raw=true
Attachment 26321
Cheers, Joe
-
Re: DIY Laser levelling using webcam and laser level
And he does all this whilst standing on one leg and juggling with knives.:smile:
Kit
-
2 Attachment(s)
Re: DIY Laser levelling using webcam and laser level
Just for fun I tried the system out with the very cheap line lasers you can get on Amazon and ebay for £3. These don't use a glass cylindrical lens, rather a plastic ridged grating with multiple ridges. Although the software was able to get a solid lock on the beam I personally wouldn't trust this, the lens seems to create multiple lines that when focused land on top of each other, giving us multiple guassians. The depth of focus is also not good. See the pictures:
Attachment 26340
Attachment 26341
-
Re: DIY Laser levelling using webcam and laser level
-
Re: DIY Laser levelling using webcam and laser level
The cheapest are definitely these plastic grate things, the glass cylinders are much more, then the powel lens are about twice as much again. I think the cylinder is the best choice as the powel is designed to remove the gaussian beam intensity which for our purposes is extremely useful.
The self levelling laser i'm using is 1.3mW and has two lasers each with a cylindrical glass lens. 1.3mW is very weak compared to what you can buy online. Probably wants to be low power to avoid potentially damaging the cmos camera sensor.
If you want something that definitely works pick up a broken Dewalt DW088 on ebay. These seem to fail whereby one or other of the lasers becomes very dim, this is down to the driver board failing, so I would expect the lasers still work perfectly and can be scavenged.
-
Re: DIY Laser levelling using webcam and laser level
Quote:
Originally Posted by
John McNamara
Hi Joe
I wish I knew more about optics.
Cylinder lenses appear to be the cheapest.
I wonder if a piece of glass rod would suffice?
I don't think they are round, rather half round, I maybe wrong. The better ones are made out of something called K9 glass, again I don't know what this is. Maybe Andy can jump in here?
-
Re: DIY Laser levelling using webcam and laser level
Quote:
Originally Posted by
devmonkey
I don't think they are round, rather half round, I maybe wrong. The better ones are made out of something called K9 glass, again I don't know what this is. Maybe Andy can jump in here?
Watching the thread with interest, but unfortunately its been many years since I studied optics, and I'm not massively useful at this point! But I whole-heartedly agree that you want to keep the guassian characteristic where possible, as its a nice structure to fit to. You could use the FWHM from a flat-top profile, but I'd trust the guassian fit better as the regression uses the entire curve, rather than just the penumbras.
Re. lenses; It all depends on the incoming beam width, the radius of the rod/lens, and the refractive index of the material being used; in general I'd guesstimate that given a beam focused to infinity, you're likely to get a wider output spread by using a full rod, but there are so many variables here to play with, i'd be tempted to just go with an off the shelf lens designed for the job which will also guarantee clarity of the beam to a certain extent.
-
Re: DIY Laser levelling using webcam and laser level
A number of sites show what appears to be a plain cylinder.
https://www.google.com/search?q=line...%3Apinterest.*
-
Re: DIY Laser levelling using webcam and laser level
Joe,
The latest software version works perfectly and can be resized to fit nicely on my 'old' laptop. Thanks for all your effort.
Does the software work with a lens-less camera pointed directly at a laser pointer? I'm thinking you could arrange the pointer to provide a straight beam at a set height above a rail and detect how the spot moves around on the sensor as the camera backs away from the source on a carriage. Turning the camera 90 degrees allows measurement of horizontal and vertical errors. This is the quantum version of John's taught wire and requires a rigid, adjustable mount for the laser on the bed of the machine under test.
All,
I advise against trying to remove the optics from your cylindrically shaped, metal bodied, Mircosoft, auto-focus webcam. They're actually very solidly put together and mine is now a small pile of mangled bin-fodder. I've ordered a much more flimsy looking manual focus version from eBay (and a laser pointer).
Kit
-
Re: DIY Laser levelling using webcam and laser level
Hi Joe and Kit
I have been working on automating the positioning of the sensor to the wire.
To do that it really needs a micro to do the hardware housekeeping, control step motors and limits etc. It also removes the need to lug a PC around.
A mate tried running the cam software on a laptop that runs Debian Linux. It Ran!
He is also into Rasberry PI micros. as said that the software should be fairly easy to port over to a PI. Best a PI 4 for speed. it may be slower than a PC that has to be tested.
I am going to order one and we will try it.
To automate the software will it to address some output registers to hold the current position of the wire or laser relative to the centre point of the camera sensor.
The more I work on this project the more excited I get. Great work Joe.
Regards
John
-
Re: DIY Laser levelling using webcam and laser level
John,
I have a Pi 4 and a matching touch screen waiting for something useful to do so will be very interested to see your results.
Kit
-
Re: DIY Laser levelling using webcam and laser level
Software should work on most platforms, that is the point of java. However the native component that talks to the webcam doesn't work on the RPI without some changes, see here from the author.
http://webcam-capture.sarxos.pl/
-
Re: DIY Laser levelling using webcam and laser level
Quote:
Originally Posted by
Kitwn
Joe,
The latest software version works perfectly and can be resized to fit nicely on my 'old' laptop. Thanks for all your effort.
Does the software work with a lens-less camera pointed directly at a laser pointer? I'm thinking you could arrange the pointer to provide a straight beam at a set height above a rail and detect how the spot moves around on the sensor as the camera backs away from the source on a carriage. Turning the camera 90 degrees allows measurement of horizontal and vertical errors. This is the quantum version of John's taught wire and requires a rigid, adjustable mount for the laser on the bed of the machine under test.
All,
I advise against trying to remove the optics from your cylindrically shaped, metal bodied, Mircosoft, auto-focus webcam. They're actually very solidly put together and mine is now a small pile of mangled bin-fodder. I've ordered a much more flimsy looking manual focus version from eBay (and a laser pointer).
Kit
Hi Kit,
At the moment the app is only performing a gaussian fit in 2D, i.e. one spatial dimension say Z and intensity. I could probably add a 3D fit which would allow you to use a dot laser.
The method I'm going to use will not require this as I think it is considerably easier to straighten in one dimension at a time having done some shimming and scraping in the past. I will use the laser horizontally to flatten the rail in Z with shims then rotate the laser and camera and straighten it in X, trying to do both at once is a nightmare in my experience, not from a measurement perspective but from an adjustment perspective. Since i'm only getting the errors in a straight line rather than trying to get the rail parallel with the laser it doesn't matter if the laser and camera move relatively to each other all over the place when you rotate them, the two operations (flatten then straighten) are entirely independent.
This is the camera I'm currently using, very easy to take apart and remount and only £7, works superbly.
https://www.amazon.co.uk/gp/product/B01L1XAQAS
Cheers, Joe
-
1 Attachment(s)
Re: DIY Laser levelling using webcam and laser level
Hi All
A mate and I made this device a while back, The test device searches for and senses the position of a wire electrically to .0001" The stepper and 3:1 timing belt driven screw attached to a Flexure hinged 10:1 ratio lever provided repeatable accuracy. The only variable was the contact resistance of the wire. It sensed on the break of contact naturally. This occasionally led to false readings, I left the test running for hours.
This is where the non contact camera is very attractive.
Automating positioning using a webcam the laser or wire sensing requires accurate mechanicals. This test machine was bulky It was designed to move a cutting head with an attached sensor, it cost very little.
I guess a ball screw would be the obvious answer. surprisingly small ones are not inexpensive. That is why I used a flexure for the first stage of amplification, Flexures have effectively no backlash. Have to think on this.....
Attachment 26346
It was driven by a baby Arduino with a small attached display for settings.
Regards
John
-
Re: DIY Laser levelling using webcam and laser level
John, it would be trivial to extend the software to write the resolved beam location down a com port to your arduino. On the arduino you would run a closed loop to move the sensor to get the beam central.
Let me know if you want this added, and also what format to send the data in.
-
Re: DIY Laser levelling using webcam and laser level
Gee Joe.
So many minds around the planet working on a problem generously sharing their ideas.
I Ordered a PI 4 today and will start thinking on the software.
Regards
John
-
Re: DIY Laser levelling using webcam and laser level
Quote:
Originally Posted by
John McNamara
Gee Joe.
So many minds around the planet working on a problem generously sharing their ideas.
I Ordered a PI 4 today and will start thinking on the software.
Regards
John
See what I said above about it not working on a PI by default.
-
1 Attachment(s)
Re: DIY Laser levelling using webcam and laser level
Quote:
Originally Posted by
devmonkey
Hi Kit,
At the moment the app is only performing a gaussian fit in 2D, i.e. one spatial dimension say Z and intensity. I could probably add a 3D fit which would allow you to use a dot laser.
I wasn't thinking of measuring in two dimensions at once, just wondering if the software would cope with just a spot, treating it rather like a short line segment covering only part of the sensor. I would always expect to rotate the sensor to select between horizontal and vertical error measurements. Please don't do even more work just to suit my whims! This was more to do with removing the problems associated with the line-laser lenses. As you would only ever be working with the same central area of the laser line anyway if used as I was thinking, it probably makes no difference.
The camera I've ordered is this one, it looks suitably flimsy at the front and is even cheaper than yours!
Attachment 26348
-
5 Attachment(s)
Re: DIY Laser levelling using webcam and laser level
Hi All
Today I tested the software using a 640 x 480 VGA webcam without a lens and #2 Roslau Music wire (0.0010" thick).
Digging around the workshop I resurrected an accurate XYZ jig table I lashed up with some star linear bearings and preloaded 8mm screws some time ago, this enabled me to precisely position the webcam now stripped from it plastic housing and mounted on in an aluminium bracket securely clamped on the XY stage of the jig. Measurements were taken with a Mitutoyo 0.01mm per division dial indicator.
The wire was positioned about .0015" above the face of the Camera sensor.
Calculated resolution achieved was 130 lines used to measure 0.05m = .003846mm per pixel line 0.000151") see Excel Image below.
This was repeatable I performed the test several times. however there are some issues measuring small values. It was difficult to measure .01 increments repeatably due to the software constantly recalculating very slightly different values. the source of this error needs to be tracked down. It may not be a software issue, I suspect It may be a combination of hardware and software issues.
From various tests I have observed changing light conditions cause the measured value to change in a very substantial way. I also observed this using the laser in earlier tests although to a lesser extent.
In the image below notice the paper tent covering the sensor this is essential to reduce the effect of stray light while providing somewhat even illumination of the sensor. It is not Ideal. I need to enclose the sensor in total darkness apart from an even illumination source behind the wire. I think this light source needs to be variable intensity to provide the correct grey scale balance for the software.
Once the correct lighting conditions are achieved I will run the tests again.
The tests today have proved that the Webcam software is already capable of very good repeatable accuracy. and that there is still plenty of room for improvement. Very exciting!
Regards
John
4 images below:
Attachment 26366
Attachment 26363
Attachment 26364
Attachment 26365