# Are there standards/references for determining spatial scale in photographic images?

EDIT, 12/12/20: Images below are of the radial sinusoid pattern. Left side is the "unrotated" version. Right side is what the a photograph of the pattern would look like if the disc was rotated into the depth dimension, 45 degrees about the x/horizontal axis, and 20 degrees about the y/vertical axis. Note that the diameter of the disc on the left is equal to the length of the long axis of the disc (ellipse) on the right. And thus the spatial frequency of the sinusoid along the long axis is equal to that of the unrotated disc.

END EDIT

I'm tasked with estimating the spatial (pixels/inch) resolution at the location (depth) of an object in a digital photograph. I can create a small "standard" reference signal (akin to a QR code or bar code) that will be clipped to the object, such that I can assess the resolution via image processing, Fourier analysis, etc.

1. Does such a standard reference exists? Along with optimized algorithms for estimating the spatial resolution via image processing?
2. If not, I'm looking for ideas for patterns that might serve as such a reference, and the associated estimation methods.

Some caveats:

• The object and the visual standard are not fixed in space, and may rotate (into the depth dimension), to some degree.
• The visual standard needs to be limited to ~3 inches in diameter (or a ~3x3 inch square).

Given the above caveats, my early thinking has been to use a circular reference (a "disc"), displaying concentric rings of a fixed spatial frequency--e.g., a sinusoid that is radial symmetric. If the disc rotates in any direction, the concentric circles will look like ellipses in the photographic image, but the sinusoidal frequency along the long axis of the ellipses will remain constant. I thought a 2D FFT would allow me to obtain a good frequency estimate, but based on some testing, the circular nature of the pattern results in "artifacts" in the frequency domain, such that the estimate is not sufficiently accurate. Perhaps the concentric rings are an adequate reference/standard pattern, but a better frequency estimation method is needed (I've also tried direct fitting via gradient descent). Or maybe I need some other pattern altogether?

Suggestions welcome!

• Since you don't say what size object fills the field of view, telling us that the reference is 3" x 3" doesn't help. Is that a 3" x 3" reference pasted to a computer mouse? Or a 3" x 3" reference pasted to a 747? Dec 12 '20 at 18:10
• Including the word "fiducial" in your web searches may help -- or it may lead you down pointless rabbit holes. Dec 12 '20 at 18:13
• I gave the 3"x3" inch information just as a matter of practicality. E.g., if NIST makes a standard that comes on an 8"x11.5" piece of paper, I wouldn't be able to use it. The physical size of the hypothetical standard doesn't really matter. Regardless of whether the standard was pasted to a computer mouse or a 747, the same mathematical approach could be taken to estimate the image scale (as long as the pixel resolution is high enough that aliasing is not a problem). Dec 12 '20 at 18:18
• Not in the real world. If your 3x3 inch standard is pasted to a 747 that fills the whole field of view of a 1080x1920 pixel camera, it may subtend two whole pixels if you're lucky. How do you determine the detailed properties of a smudge that spans two pixels? Dec 12 '20 at 18:27
• But that's what I mean... "as long as the pixel resolution is high enough." You can just assume that I'll select a camera, field of view, and distance to the standard such that the pixel resolution will be high enough to avoid aliasing (undersampling) of the details on the standard. Dec 12 '20 at 18:49

One possible answer to my own question is provided by the photographic scale reference detailed on this website.

https://smallpond.ca/jim/scale/

It doesn't quite provide the solution I was looking for, buy may help spur ideas. I really need something that can accommodate a good scale estimate even if the reference is rotated in space (about any of the three axes), and is of low pixel resolution.

There's standard targets for camera calibration (search for camera calibration target).

But: I think the problem might be older than digital image processing.

A optic meter to be used to measure distances far away? Stage left enters: Stream Gauges!

Honestly, these have good enough properties to find them automatically, and high accuracy through excellent cross-correlation along their axis. If you want to improve their principle, simply try the linear version of an optical binary encoder disk.

If you're looking for something that's easy and robust to deal with:

print a greyscale disc, where intensity is $$\cos(2\pi f r)$$, $$r$$ being the distance from center, with $$f$$ chose appropriately that a few rings can be put onto a printable disk. This is rotationally invariant!

Detecting that should be relatively straighforward: go through your image and do an FFT of every pixel row. The row with the highest Peak-to-Average magnitude ratio is probably the one going through the center of your disk.

The peak's frequency gives you the scale at the distance of the disk.

You can also put in more disk with cleverly chosen higher $$f$$ (maybe put them in different color?) to allow you to get a higher resolution for your distance estimate through the power of aliasing :)

• Thanks, Marcus. "print a greyscale disc, where intensity is cos(2𝜋𝑓𝑟), 𝑟 being the distance from center, with 𝑓 chose appropriately that a few rings can be put onto a printable disk. This is rotationally invariant!" Thats exactly what I've done (the "concentric circles" pattern). But the fact that the pattern is not always directly facing the camera makes things a little more difficult since this means the long axis through the ellipses could now be at any angle, not just horizontally or vertically through the pattern. Still, the peak-to-average statistic could certainly be helpful! Dec 11 '20 at 23:40