# Calculating the excact size of a PCB from a photo?

I have multiple photos of Graphics card PCBs. I would like to come up with a technique to calculate the exact size of them using Pictures.

The Picture is slightly distorted by the lens and not taken from a exact top- view angle.

The only size reference I have is that the part with the golden connector is 8.35 cm long.

Is there a way for me to calculate the exact (mm) width and lenght from this picture? If so, how?

I tried straightening the image using Photoshop but ended up modifying the actual size.

• Why not include the part number and a hyperlink to the datasheet for the card in your question? What does it fit into? – Transistor May 15 '18 at 20:25
• Because my question is not what the size of this PCB is. I want to figure out a technique that I can use the calculate the size of PCBs using these kind of pictures. – O. Vale May 15 '18 at 20:27
• Your question doesn't say that. Edit required. – Transistor May 15 '18 at 20:29
• Alright I edited it. – O. Vale May 15 '18 at 20:31
• Can you take a photo of a piece of graph paper with the same camera and lens? (Note that not all graph paper is accurate.) – Andrew Morton May 15 '18 at 20:38

... the golden connector is 8.35 cm long.

Figure 1. Using an image editor select tool to get a pixels/cm scale factor.

The image shows a selection tool reporting that the 8.35 cm connector is 194 pixels wide. $Pixels/cm = \frac {pixels}{cm} = \frac {194}{8.35} = 23.2$. You can use this figure to scale any other pixel measurements with reasonable confidence on the X-axis. It will work on the Y-axis too if the photo has been taken from an orthogonal viewpoint.

If you were to scale this photo by $\frac {100}{23.2}$ you would have 100 pixels/cm and measurements would be very easy.

• I tried that but the problem is that its not taken exactly from the top. I'm guessing that is a "orthogonal viewpoint". There is also a minor lens distortion. – O. Vale May 15 '18 at 21:04
• Machine vision systems use a grid to calibrate the view and correct for lens distortion. With random photos from the Internet you haven't a chance. – Transistor May 15 '18 at 21:06
• So what you are saying is that you think that it is not possible? Since all lines are straight I thought the lens distortion might be able to be fixed – O. Vale May 15 '18 at 21:08

Well, it depends on what you mean by exact. I suggest you figure out the actual tolerances.

1) You can calculate the length of the bottom edge using the method described by Transistor.

2) Assume that the top edge is the same length as the bottom edge, and all the corners are 90 degrees. In other words, it is a rectangle (but with a few chunks cut out of it etc).

3) You have the length of the bottom edge and the top edge, so now how do you get the length of the sides? Take some drafting software (there are lots of free ones thanks to the advent of 3D printing). Draw a rectangle that has the same bottom/top edge length as your picture. Drop it on top of your picture, and then tweak the X/Y/Z rotation and the height until it lines up perfectly with your picture. Then get the height from the software.

It won't be exact but it will be pretty close, which might be good enough.

You might try asking mechanical engineers or geometry experts; this isn't really a EE question.

I use Irfanview to measure pixels per mm or “ and use a 0.1” spaced pins or similar for a reference then convert pixels to any units. The image can be scaled to any pixel size for convenience.

The accuracy of course is limited by the quality of the photo and the skill of distortion correction of the user.

## Anecdotal

Back in the mid-70's we would layout circuit boards on D scale gridded Mylar with colour-coded trace widths and send them to Toronto for digitizing where they use a light table and cursor to enter every track hole and outline milling. Then artwork checkplots would return in a few days so we could check them and then order the boards. So this method could be done on a computer now but we used 4x scale Mylar so 0.1" grid was 25 mils. This way we each person could design a board a week. Then we found out they could layout complex boards with 1 IC per square inch faster than us, so we just sent the schematics. At the time we were generating designs of 4x8" boards every week for a large complex system. One such board I did was for a UART which was before Motorola released a single chip IC that could do the same in CMOS.

• But that still wouldn't solve the biggest problem, the distortion. – O. Vale May 15 '18 at 21:07
• You can gauge the distortion to some extent using Transistor's pixel analysis on known components around the board : there are several 0.1inch pitch connectors for example. – Brian Drummond May 15 '18 at 21:57