| Electronics > Projects, Designs, and Technical Stuff |
| A simple tool to aid in reverse engineering a PCB |
| << < (6/7) > >> |
| janoc:
Simon I have done a lot of camera calibrations on phones (it is necessary for doing any kind of computer vision/augmented reality) and they really don't distort that much, even at full wide setting. We aren't talking early 2000 camera phones anymore. For example iPhone/iPad cameras gave me a calibration that was pretty much dead on match to an ideal pinhole camera. Square pixels, distortion coefficients down in the noise. I am sure the physical camera isn't so great and Apple's firmware does some undistortion/pre-processing before delivering the image to the userland APIs (I am not talking about the camera app but images grabbed from the camera using my own code) but the user doesn't really care about that. SLR lenses often distort much more than tiny smartphone lenses, especially barrel distortion at the wide end can be really pronounced. The smartphone lenses with their microscopic focal length don't really have where to pick that kind of distortion up at the distances the lens is usually being used (and is even able to focus). It is extremely difficult to build anything resembling a fisheye in such small form factor. That doesn't mean it is impossible to build a crappy lens but given the smartphone prices today the customers would lynch such company. Of course there is no comparison with an SLR when it comes to sharpness, color aberrations and minimal aperture/low light capabilities but you really don't care about any of that when shooting pictures of PCBs for analysis. For this kind of job an SLR is an enormous overkill, even a crappy handheld phone shot is going to be usable just fine. The idea is to enable reverse engineering boards, not to win a photography contest! (and yes, I do own a Canon 80D with a few lenses too) Also often when you are fixing boards you don't have an SLR at hand but almost everyone has a phone - then the whole point is moot. Anyway, if you happen to have a phone that produces images so distorted that it would cause problems with the reverse engineering, it is pretty simple to calibrate the camera and remove the distortion in software after the fact. Definitely simpler than having to monkey around with a large camera, tripod and what not - and have to undistort the image anyway ... |
| intabits:
--- Quote from: janoc on December 01, 2018, 12:36:33 am ---A better solution is to get rid of the tripod (so that you can use a phone instead of a camera/scanner that may not be on hand, find a good angle where you don't have glare, etc.) and instead find 4 points that you know the position on the board (e.g. 4 corners). Then you can warp the image to get rid of any trapezoidal distortion due to the camera not being exactly perpendicular with the board. In theory this could be done with any 4 points (they don't have to be right angle corners but those are the simplest) automatically - it is called finding a homography transform. ..... The layer alignment can be done in a similar way - first rectify the images up as above and then you can find a transform between matching points that will scale and align one layer over the other one. All that this needs is solving a system of linear equations. --- End quote --- Yes, you could complicate a simple program with fancy algorithms and maths, to avoid using a tripod. Or, use a tripod. Or any arrangement of blocks of wood, rubber bands and blu-tack that will enable you to take two photos without moving the camera. Sure, you'd have all that fancy stuff in a full-featured program, but it's not an essential feature. There's other higher value core functionality that I would be adding long before that. --- Quote ---A few other features I have found useful or wished to have: - filling the traces with color so that you can easily see the individual nets - marking of the components and their pins - have a way to generate a netlist/rough schematic out of the above - e.g. this could be perfectly doable with KiCAD where the schematic is just a large text file. --- End quote --- I mentioned earlier that the component/pin marking and netlist generation was a desirable future direction. That's where I would be adding complexity... |
| intabits:
--- Quote from: janoc on December 01, 2018, 12:36:33 am ---...Then you can warp the image to get rid of any trapezoidal distortion due to the camera not being exactly perpendicular with the board. ...it is called finding a homography transform. --- End quote --- I've just played with a much more demanding example: a 275mm x 290mm double sided PCB with 100 chips on it. And with that, the distortion was too great, even with careful use of a tripod. I added pan and zoom, and then X/Y shift adjustments, but any given adjustment setting was good for only a small area, maybe 50mm square. So I accept that homography would be absolutely necessary for images like that. But I maintain that the other functions for marking pads and connections are still much more important. You'd want those facilities for all but the simplest PCBs, whereas you could probably get onto fairly complex PCBs without needing homography. Of course, trying to reverse engineer a large PCB like the one I mentioned above would be a massive task, no matter how sophisticated the tools being used. And might still be nigh on impossible... |
| Simon:
--- Quote from: janoc on December 01, 2018, 05:35:05 pm ---Simon I have done a lot of camera calibrations on phones (it is necessary for doing any kind of computer vision/augmented reality) and they really don't distort that much, even at full wide setting. --- End quote --- I just examined pictures taken of mysely and some friends, one on my SLR one on a camera phone. The people to the edge of the phone picture start to distort. Not enough for you to notice unless you make a comparison. Fortunately PCB's don't care if they look fat :) |
| janoc:
--- Quote from: intabits on December 01, 2018, 06:19:33 pm ---Yes, you could complicate a simple program with fancy algorithms and maths, to avoid using a tripod. Or, use a tripod. Or any arrangement of blocks of wood, rubber bands and blu-tack that will enable you to take two photos without moving the camera. Sure, you'd have all that fancy stuff in a full-featured program, but it's not an essential feature. There's other higher value core functionality that I would be adding long before that. --- End quote --- If you call a set of linear equations "fancy math", I don't know what to say. The issue is usability of the program. If I can click 4 corners and have the image fixed up vs. having to set up a tripod, prop up the board so that it sits level even if there are components on the bottom and still will have a distortion because the board isn't on the axis of the lens and isn't perfectly perpendicular, the former is a big win for me. But you are free to do as you wish, of course. |
| Navigation |
| Message Index |
| Next page |
| Previous page |