Imagine you have Christmas-tree style LED light at a distance D from a camera.
Knowing the properties of both the LED light (such as shape and intensity) and the cam
Bright light sources itself are not good for this as the bright light usually distorts the neighboring space with MIE+Rayleight scattering creating haze dependent on many things not just illumination. Also there are few problems in the camera itself like the bright H or V lines caused by charge jump across scan-line and or lens flares (that star like or polygonial shape usually rotated and sometimes rainbow colored) making really hard to measure the size in the image in some cases.
In case your image contains such problems I would use some other objects of known size like Christmas balls (or the light holders/sockets if visible/usable) also what about tree leafs for evergreen they usually all the same size. The precision can be estimated like this:
If FOV of camera in x
direction is 60deg
and resolution is 640x480
(assuming square pixels) then one pixel is da = 60deg/640pix=0.09375deg
angle accuracy. So for h=5cm=0.05m
big object d=2.5m
distant from camera I see it like this:
tan(ang) = h/d
--------------
ang = atan( h/d) = atan(0.05/2.5) = 1.14 deg
p = ang / da = 1.14/0.09375 = 12.2214 pixel
so image can be either 12 or 13 pixel big so computing the distance back
d = h/tan(p*da)
--------------
d0 = 0.05/tan(12*0.09375) = 2.54615m
d1 = 0.05/tan(13*0.09375) = 2.35024m
acc = 100*max(d-d0,d-d1)/d = 100*max(0.04615,0.25024)/2.5 = ~ 10.0096%
Now as you can see the precision is affected by object size and distance from camera. Also on the FOV and resolution of camera itself.
To improve this you can use sub-pixel precision object measurement ...