PHOTOGRAMMETRIC TECHNIQUE FOR TIMBER STACK VOLUME CONTOL

The problem of accurate log volume measurement is a very important, especially in case of seaport volume control where logs are put in a huge stack of hundred meters length and a time for volume control is strongly restricted. Current technology of volume control use manual means such as measuring tape, so the process of measurement is rather inaccurate and time consuming. To estimate the volume of timber stack its frontal area is measured and some control parts of a stack are used for stacking coefficient (wood density in a stack) determination. Non-contact vision based technique is proposed for manual measurements substituting. The developed methods are implemented in portable photogrammetric system for stack parameters measuring and documenting. * V. Knyaz. Tel. +7 499 157 3127, Fax: +7 499 943 8605, e-mail: Knyaz@gosniias.ru


INTRODUCTION
Despite of great amount of industrial wood being produced and transferred to woodworking industry for further processing the level of measurement accuracy and automation is not high still.The most part of techniques use statistical coefficient and manual measurements (West P., 2009;Round and sawn timber, 2006).In most cases measurements are made manually using a measuring tape and a ruler.Systematic errors of such measurements can reach ±15% (Janak, K., 2005;Janak, K., 2007).
The most accurate technique of timber volume measurements is piece-by-piece method when each timber volume is measured separately.For piece-by-piece measurement conveyor automated systems are developed applying laser measurement system.Such systems provide the most accurate measurements but are rather expansive and can not be used at any point where stack volume is to be measured.Along this manual piece-bypiece volume estimation is also applied being very timeconsuming and not accurate enough.In this case measurements era performed by an operator as a key element.An operator measures top and bottom and manually writes the measured values into notebook for further calculations.Then the volume is estimated using empirical equation.The procedure seems to have low accuracy, low productivity and good background for man-made errors.Even for piece-by-piece manual technique errors can reach ±10%.
In many cases piece-by-piece method could not be applied due to strong time restriction.So for seaport wood control measurements (Figure 1), wood stacks transported by track/train etc. stack volume are measured.Stack method is used for measuring almost all the pulp logs and the greater part of saw and plywood logs.
According to the existing rules height of the stack must be measured from upper log of stack and use permanent stacking coefficients.Systematic errors of this method reaches ±15%.Recently Scandinavian experience is widely used with measuring a stack by «full box» rule and visual assessment of stacking coefficients.

Figure 1. Seaport timber stack
To make the process of timber stack measuring more accurate, convenient, fast and well documented photogrammetric technique is developed.It is aimed to eliminate manual measurement from control process and to provide objective and accurate volume estimation.
The image-based 3D-measurement system is proposed as an alternative for manual measurement.The main requirements to the developed system are following:  high precision of 3D measurements  high productivity -capability of fast measurements  support of automated measuring mode  support of manual mode for 3D measurements  capability of measurement of area of every log end in a test area  capability of calculating the number of trees in package The developed system has to provide automated measurements of stacking coefficient and stacking volume.

MEASURING SCHEME
According to existing guiding methods for timber stack control two stack parameters have to be determined during measuring procedure: an overall stacking volume and a stacking coefficient.
An overall stacking volume is determined by overall dimensions of the stack.For overall stacking volume calculation the overall length of a stack L s is measured by measuring tape and a width of a stack W s as a mean of several arbitrary logs in the stack.Then a set of heights of stack H si with the period of 1 meter is measured for overall stacking volume calculation as a sum of a partial volumes A stacking coefficient is defined as ratio of a wood volume in a given space of a stack to the volume of this space.For stacking coefficient determination test stack space is taken as a box with a bottom of length L t and height H t on a frontal side of a stack and having width W s of a stack.A wood volume in a test stack space is concerned as the summary ends area A t for logs belonging to the test space multiplied by width W s of a stack.So the stacking coefficient K s is the ratio of summary log ends area to the area of test box bottom.
In manual mode summary log ends area A t is estimated by measuring log ends diameters with the help of ruler and calculating summary area then K s calculating.
Another (more simple but less accurate) method is sum of all log ends chords belonging to a test box bottom diagonal to the length of this diagonal.

Hardware configuration
For eliminating time consuming and inaccurate manual measurements photogrammetric system was developed.It was designed for stacking coefficient and stacking volume determination and for producing measurements report in automated mode.
Contradictory requirements of measuring log diameter of size of 0.2 … 0.5 meters with the accuracy about 0.1 mm and overall stack height and partial length with characteristic size of 8 … 15 meters by single portable photogrammetric system lead to system configuration including two still digital Canon EOS 1100D cameras (left camera being set up perpendicular to the system basis) installed on basis of 800 mm (Figure 2).Notebook is located on the basis and is used for cameras control and image processing.

System calibration
To meet mentioned above contradictory requirements the digital cameras were equipped with 50 mm lenses and special calibration procedure was developed using test field with reference points at distances from 2 to 20 meters and some known reference distances between given reference points.

Figure 2. Portable photogrammetric system
For automated reference points detection and identification and their sub-pixel image coordinates measuring the original coded target are used (Knyaz V.,2002 ).
Calibration includes two stages: a) interior camera parameter determination and b) system relative orientation.As a consequence of first calibration stage the parameters of interior orientation (principal point x p , y p , scales in x and y directions m x , m y , and affinity factor a, the radial symmetric K 1 ,K 2 ,K 3 distortion and decentering P 1 ,P 2 distortion) are estimated.
The additional parameters in co-linearity equation are taken in form: Precision results (standard deviation) of interior orientation estimation are given in table 1: spatial reference points coordinates  хs = 0.121 mm angle exterior orientation parameters   = 0.042 residuals of collinearity conditions  l0 = 0.214 mm Table 1.

Precision of interior orientation
The relative orientation procedure (second stage) is performed using the same data for estimating unknown relative orientation parameters: ( 1 ,0, 1 ) angle position of the left camera and (X 2 , 0, 0)location and ( 2 , 2 , 2 ) and angle position of the right camera relatively to basis coordinate system.The residual of colinearity conditions for orientation procedure is 0.05 mm.
The results of calibration demonstrate the necessary accuracy for the concerned task of 3D measurements.
To support the proposed technology original software for Windows 7 is developed.It provides the complete technology of 3D measurement:  image acquisition  system automated calibration  image processing for feature extraction  calculating the required characteristics and report generation

LOG STACK MEASUREMENT
For first task solutionstack coefficient determination -some original methods and algorithms developed: for log ends detection in the left and right images of acquired stereo pair, for log ends stereo matching in the stereo pair, for log ends area calculation and stack coefficient estimation.
For second taskstack volume determinationstack segmentby-segment procedure is proposed because of huge frontal length of a timber stack and the requirement of applying a single system for both tasks solution.Segments borders are marked with special vertical probes with targets.These probes determine the vertical plane of a segment and the upper border of a stack segment is detected as convex hull.The targets on the probes are used for automated measuring distance determination.

Stacking coefficient calculation
Stacking coefficient determines the density of wood in a stack.It can be found as the volume of wood in whole stacking volume which is determined by overall dimensions of the stack.
For density determination a set of test parts in a stack is taken.rectangular test areas on a stack frontal and back sides is chosen.Volume of wood in a test area is estimated by middle diameter method for which knowing of top and bottom diameters of a timber is required.
Wood density in a test area is calculated as the area of all log ends inside the test area divided by test area.(Parts of log ends belonging to the test area are also accounted in calculations).

Orthophoto generation
Log ends are detected in supposition that they could be represented by circles.To support this supposition the system camera configuration is chosen so the left camera being set up perpendicular to the system basis and the right camera has  angle of about 10°.
For image acquisition the system is installed in front of a stack at the working distance of about 4 meters.Such set up allows obtaining nearly frontal image and log ends in this image look like circles not ellipses (Figure 3).

Image analysis algorithm
The image analysis algorithm based on the original circle detection technique (Knyaz V., 2000;Knyaz V., 2004).The complete procedure of image analysis for one frame includes the following steps: 1. Forming of intensity gradient field 2. Testing hypotheses from discrete space of circle parameters (2x2D-accumulator) 3. 2x2D-accumulator analysis: determination of circles' locations 4. Computation of required area parameters These steps are briefly described bellow.

Forming an intensity gradient field:
The intensity gradient field is implemented as two 2D arrays: array of gradients in x-direction and array of gradients in y-direction.It is formed as follows:  Evaluation of gradients by Sobel operator;  Elimination of weak gradients;  Thinning of gradient field.
The Sobel operator is a well-known image processing procedure allowing the determination of both magnitude and orientation of image intensity gradients at the each pixel of image.
Resulting gradients map is shown in Figure 5. Also gradient directions map is calculated for log ends detection.
Figure 5. Gradients map Elimination of weak gradients means that the elements of gradient field with gradient magnitude less than some threshold to be set to zero.
Thinning of gradient field is a procedure that eliminates all points of gradient field those are not the local maxima in their directions.This procedure makes the contours of objects as sharp as possible.Practically, at this stage, the gradient field may be considered as a contour image supported with gradient values at each contour point.

Testing hypotheses from discrete space of circle parameters (2x2D-accumulator):
At this step, the each point of area of interest is tested as a possible centre of circle.This testing presumes the following operations:  Collecting a number of appropriate contour points for each value of possible circle radius in some given range;  Normalizing this numbers as per cents of circle length for corresponding radii;  Finding the best radius that corresponds to the maximum percentage value.
The "appropriate contour point" means here that the angle between the radius vector from this point to centre point and the gradient vector in this point is small enough.Normalizing of numbers is performed, because the possible number of points on discrete circle depends on its length.
The best hypothesis for tested point is stored in a special 2x2Daccumulator.The accumulator of hypotheses is implemented as two 2D-arrays those geometry corresponds to the geometry of source image.One accumulator array R(x,y) contains the radius of probable circle for this centre point (x,y) and the other array N(x,y) contains the corresponding number of points on the circle contour.

2x2D-accumulator analysis: determination of circles' locations:
The procedure of 2x2D-accumulator analysis performs the iterative search of local maxima according to the following algorithm: Step 1. Find the global maximum of N(x,y) array Step 2. Put the circle with (x,y) center and R(x,y) radius into the list of circles.
Step 3. If (N(x,y)/R(x,y)<Percentage_Ratio) then stop the search.else clear the accumulator in the round neighborhood of (x,y) with R(x,y) radius and go to step 1.This procedure starts from big circles and proceeds to small circles until all appropriate candidates in the accumulator will be put in a list.
Result of work of accumulator for circle hypotheses is shown in Figure 7.

Reconstruction of non-detected circles:
As it was stated in the previous section, the proposed approach is based on an assumption that all log ends (circles) lay approximately in one plane.However, it the real cuts may not satisfy this condition.Therefore, on the ortho transformed image some ends will screen the other ends.If the big cut screen the small cut, the small become "invisible" for the detection algorithm due to low number of visible points on its contour.Fortunately, these «invisible» objects make the "holes" in the entire structure of the circle set.In our algorithm, the holes inside the covering polygon are detected to recover the lost cuts (circles).
Sometimes this recovering algorithm fails, when it try to fill the hole from one lost circle by two or even three smaller circles (if the environment allows such decision).However, the estimation of sum of ends areas still better that for the case without recovering of lost circles.

Computation of required test area parameters:
Finally, three basic characteristics of a test area are calculated:  The number of log ends in the test area  The total area of log ends in the test area  The stacking coefficient.

Stacking volume estimation
For stacking volume calculation special photogrammetric probes are used.The probe is a metal bar with two markers placed in the top and the bottom of the bar (Figure 9).Probe's markers are automatically detected and identified in an image.Their image coordinates are found with sub-pixel accuracy in the left and in the right images and then are used for calculation of 3D coordinates of the targets.
Figure 9. Log stack section with photogrammetric probes These spatial coordinates define a plane on which an orthophoto is generated and in which the frontal stack area is calculated (Figure 10).In this plane vertical lines with a period of approximately 1 meter are drawn for section height determination.The next segment is formed by moving the left bar along the log stack, the right bar being fixed at its place.The described procedure is performed until reaching the end of the log stack.
After measuring all segments in a stack overall stack volume is calculated and final report is generated (Figure 12).It contains all necessary information on given log stack including type of measured wood, overall stack volume, stacking coefficient, log length and all measured data with images, used for documenting.

CONCLUSIONS
Non-contact photogrammetric technique is proposed for stack parameters measurements in woodworking industry.It is developed for substituting existing manual measuring methods providing non-contact determination the same parameters as existing manual methods, such as stacking coefficient and stacking volume.
Automatic stacking coefficient determination is based on detecting log ends in the orthophoto produced on stack middle frontal plane with further end diameter rectification using ends correspondences in the left and in the right image.Such approach provides robust and accurate log end measurement.
The developed non-contact overall stack volume estimation technique allows to find the area of a frontal (back) side of a log stack in a way similar to manual method but using a set of scaled stack segments orthophotos for stack height and length measurements.
The developed methods are implemented in a single portable photogrammetric system suitable for measuring both required parameters.
The developed system was tested in real seaport conditions and results of photogrammetric measurement were compared with results of existing manual technique.The results of system evaluation show that proposed technique provide fast and accurate measurements in automated mode and significantly surpass the existing manual technique.

Figure 3 .
Figure 3. Left image of the controlled stack partThen left image orthotransformation to some reference plane Z is performed.It gives scaled map of the front side of a log stack with known scale factor, but the dimensions of log ends could not be found from this image because really log ends do not belong to orthotransformation plane.

Figure 4 .
Figure 4.The orthophoto of the controlled stack part Figure 4 presents the orthophoto of a stack produced basing on the reference plane and left image.In the orthophoto lens distortion and projection distortion are compensated using results of calibration and supposition about reference plane.

Figure. 6 .
Figure. 6. Example of function of a number of appropriate contour points for each value of possible circle radius

Figure 7 .
Figure 7. Result of work of accumulator for circle hypotheses Then corresponding points for circles centres are detected in the right image.For this purpose the left and the right images are rectified and corresponding points in the right image are searching by correlation technique using information about probable location of corresponding point from epipolar geometry and possible depth diapason (Figure 8).

Figure 8 .
Figure 8. Result of corresponding ends detection

Figure 10 .
Figure 10.Log stack section orthophoto divided into sections for heights calculation Then the upper contour of log stack is detected and the points of its intersection with vertical section lines are determined.For these points corresponding points in the left image and in the right image by correlation technique.Then their 3D coordinates are calculated and they are projected into the orthphoto plane.The area of the segment is found as a sum of areas of 1-metertrapezoidal sections (Figure11).

Figure 12 .
Figure 12.Final report with measurement results