Stacking quality may have an effect on the measurement results. To avoid possible errors, just make the image from farther distance. Here’s why:

#### Individual log diameters

Objects that are closer to the camera will appear bigger in the captured image. This means that the diameters of logs that stick out will be overestimated and logs that are deep inside the pile get underestimated. But by how much?

The size of an object in one dimension in an image is the result of the following formula:

size_{onScreen} – object size in the image in pixels

size_{real} – object actual size

size_{screen} – image size in pixels

distance – object distance from the camera

fov – camera field of view

As the device screen size, field of vision and real log sizes are constants that do not change when we move closer or farther away, we can simplify formula 1 to see how a log protruding from the pile affects its measured size:

coef_{error} – ratio showing how much the result is overestimated

size_{protruding} – log diameter measured on the image, when the log sticks out

size_{level} – log diameter measured on the image, when it is level with the pile

size_{real} – actual log diameter

distance_{pile} – distance from the camera to the pile

distance_{log} – distance from the camera to the log

offset_{log} – how much the log sticks out of the pile

coef_{offset} – ratio showing how much the log sticks out compared to the distance of the pile

From the formula, we can see that the diameter size on the image is inversely proportional to its distance from the camera. So if a log were two times closer to you, it would look twice as big. As an example, if you capture an image at a distance of 2 meters and the log sticks out by 20cm from the rest of the pile, then the diameter would be overestimated by 11.1%.

The formula tells us something else that is useful: if we want to reduce the error in individual diameters, you can simply move farther away from the pile. So, if a log sticks out by 20cm and you captured the image from 4 meters away, it would only be overestimated by 5.3%.

#### Average diameter

The average diameter measurement result is affected very little by stacking quality, given that detection quality has not changed.

Let us calculate the average diameter of two 30cm logs, when the pile is 2 meters away and one log sticks out by 20cm and the other is 20cm deep:

average – average diameter on the image

diameter_{1} – diameter size of the first log on the image

diameter_{2} – diameter size of the second log on the image

As we can see, the average of these two logs would be overestimated by 1%. However, that is only the case for the two outermost logs. Most logs in the pile will be much closer to the pile average. Assuming uniform log positioning, we can calculate the average diameter error for a real pile using the following formula:

average – average diameter on the image

coef – ratio showing how much the outermost logs are offset from the pile average compared to the camera distance

In a pile that was measured from 2 meters away and the logs are offset from pile average up to 20cm (meaning that the offset coefficient is 0.1), we would find that the overestimation is only 0.34%. Furthermore, if the image were taken from twice as far, the error would be four times smaller. In our case, if the image were captured from 4 meters away, the average diameter would be overestimated by 0.083%.

#### Pile volume

Uneven piles affect measured volume more than the average diameter, but the effect is still limited. They are different because we need to square the diameter to calculate the log surface area and volume, which changes the ratio between the two values.

To compute the error in measuring the volume of an uneven pile we can use the following formula:

coef_{error} – ratio showing how much the volume is overestimated

coef_{offset} – ratio showing how much the outermost logs are offset from the pile average compared to the camera distance

We find that if you are 2m away and there are logs that stick out or are deep up to 20cm, then the volume would on average be overestimated by 1.0%.

Again, moving twice as far away to capture the image will have an effect equivalent to making the pile half as uneven, which reduces the error four times. If the previous pile were captured 4 meters away, the volume would be overestimated by 0.25%.

#### Conclusions

How much stacking quality affects you depends on what your are measuring. Individual diameters are very sensitive to stacking quality, but you can mostly ignore it if you are measuring the average diameter. For volume measurements, most users will find that the measurements are already very accurate. However, if your piles are uneven or you are taking pictures very close to the pile, you should take the time to consider how this affects your measurement results. Remember, if you do need to reduce the errors produced by uneven stacking, you can capture an image from farther away.