Field of the Invention
This invention relates to the measurement of an object by scanning its surface contour.
Description of Prior Art
It is known to scan the surface contour of an object by mounting a suitable probe in a machine tool, coordinate measuring machine, or in a specialist scanning machine. The probe is scanned across the surface of the object, and a large number of readings of position coordinates are taken. This position coordinate data is then fed to a computer, and the process is known as digitisation.
One example of a scanning machine which can be used for such purposes is shown in our earlier European Patent Application EP 528541. One example of a scanning method for scanning an object having an unknown surface contour is shown in our International Patent Application WO 91/20020.
Such scanning methods generate large amounts of coordinate data, representing individual scanned points on the surface of the object. The computer stores all this data, for example on a magnetic disc, and it is subsequently processed further.
Prior to such further processing, it is known to filter the data, in order to remove redundant information and thus reduce the amount of processing required. In particular, much redundant data can be filtered out where a particular part of the object surface is flat or planar, since obviously less data is needed to describe such a surface than a rapidly changing contour.
Summary of the Invention
The present invention relates to a method of scanning or digitising an object surface, in which a novel filtering algorithm is used. The preferred algorithm can be used as above, to filter data which has been stored prior to subsequent processing. Alternatively, however, the preferred algorithm can be used in real time to filter the data as it is generated, prior to storing it.
Brief Description of the Drawings
A preferred embodiment of the invention will now be described with reference to the accompanying drawings, wherein:
FIG. 1 shows a scanning machine with which the preferred method may be used;
FIG. 2 is a schematic illustration of a probe stylus scanning the surface of an object;
FIGS. 3-7 are diagrams showing points which have been scanned, to illustrate the application of a filtering algorithm to the data representing those points; and
FIG. 8 is a flow chart of the algorithm.
Description of Preferred Embodiments
FIG. 1 shows a scanning machine with which the preferred method according to the invention may be used. However, the method is of course equally applicable to other scanning machines, and to scanning methods performed on other machines such as coordinate measuring machines and machine tools.
The machine shown in FIG. 1 is generally as shown in our European Patent Application No. EP 528541, to which reference should be made for more detail. Briefly, the machine comprises a base 1, a pillar 2 upstanding from one end of the base, and two beams 3,4 which are positioned on top of the pillar. A bridge 6 can slide in a direction Y along the beams 3,4, while a carriage 7 can slide in a direction X along the bridge 6. The carriage 7 has a pillar 9 which supports a spindle 11 for movement in a vertical direction Z. At its lower end, the spindle 11 carries a probe 5, having a deflectable, object-contacting stylus 8.
The machine has conventional motor drives (not shown) for driving the bridge 6 in the Y direction on the beams 3,4, for driving the carriage 7 in the X direction on the bridge 6, and for driving the spindle 11 in the Z direction in the carriage. It also has scales or other transducers which indicate the X,Y,Z coordinate position of the probe 5 within the working volume of the machine.
For purposes of illustration, the probe 5 is assumed to be of the analogue type, containing further transducers which measure the deflection of the stylus 8 in the X,Y and Z directions when it is brought into contact with the surface of an object placed on the base 1. To measure the coordinate of a point on the surface, the outputs of these transducers are added to those of the scales. However, many other types of probe can be used, such as a touch trigger probe, which simply issues a trigger signal at the instant of contact between the object surface and the stylus, causing a coordinate reading to be taken from the scales. Alternatively, the probe may be a non-contact type, such as a laser triangulation probe.
In use, the motor drives are controlled by a program in a computer 20 so as to cause the probe 5 to scan the surface of an object placed on the base 1. There are a number of different ways in which the surface can be scanned, under the control of the computer 20.
For example, the stylus 8 can be scanned in the X direction along each of a series of lines, the lines each being slightly spaced in the Y direction to form an X-Y scanning raster. FIG. 2 shows the stylus scanning along one such line, over an object surface 30. It moves up and down in the Z direction as it does so, and the computer 20 takes a reading of the coordinate position at regular intervals. This builds up digitised coordinate data for a series of points P1-P6, and many other points, all lying within a single X-Z slice of the object. The result is a large amount of data which would conventionally be stored by the computer 20 in a file, prior to further processing, along with similar quantities of data for each of the other X-Z slices within the raster. For clarity, the spacing of points P1-P6 is exaggerated in FIG. 2; in reality the points are much closer together.
The raster scanning process may proceed along a predetermined path for the stylus 8, based upon the nominal shape of the object. Alternatively, it may use techniques designed for scanning a surface having an unknown shape, for example as in our earlier International Application WO 91/20020. Of course, the raster scanning may be turned through 90.degree. if desired, so as to build up coordinate data for a series of slices in the Y-Z direction. With suitable scanning software, the slices of the scan may be oriented in any desired vertical plane.
The data acquired is subjected to a novel data filtering algorithm which will be described below. This filtering algorithm may be performed at a subsequent time, either in the computer 20 or on a separate computer, acting upon the file of coordinate data which has been acquired and stored. However, the filtering algorithm may instead be performed in real time by the computer 20 as the data is being acquired, and before it is stored. This latter possibility has the advantage of removing redundant data before storage, thereby reducing the storage requirements. If the computer 20 has storage of limited capacity, for example a magnetic disc, this enables data to be acquired from a given object at a density which would not otherwise be possible.
The algorithm uses a tolerance value which is preset by the user, e.g. in response to a question asked by the computer 20 before the process commences. This tolerance value is known as the chordal tolerance value. For purposes of illustration, it is assumed that the coordinate data for the points P1-P6 in FIG. 2 is acquired, in that order. The algorithm proceeds in the following stages, receiving the coordinate data for the points in order, either directly as scanning takes place or from a file of data stored by the computer 20. The various stages are illustrated in FIGS. 3-6, which represent the data in the same X-Z plane as FIG. 2. The steps of the algorithm are also shown in FIG. 8.
Stage 1
The algorithm receives coordinate data for the first point P1. This is referred to as a base point. It is automatically deemed to be a required point (i.e. it is not redundant) and it is therefore passed to the output of the algorithm. (Step 40 in FIG. 8.)
Stage 2
When the data for the second point P2 (called a test point) is received, the algorithm creates a direct vector DV0, a top tolerance vector TV0 and a bottom tolerance vector BV0, as shown in FIG. 3. (Steps 42 and 44 in FIG. 8.) The direct vector DV0 is simply the vector between the base point P1 and the test point P2. The top and bottom tolerance vectors TV0,BV0 are the vectors running from the base point P1 through points on either side of the test point P2, spaced from the test point P2 by a distance h. The distance h is simply half the value of the chordal tolerance input by the user.
Stage 3
When the next point P3 is received (called the current point) a new direct vector DV1 is created running from the base point P1 through the current point P3. (Steps 46 and 48.) There are two possible conditions for the new vector DV1. Either it will lie outside the tolerance band bounded by the top and bottom tolerance vectors TV0,BV0 as illustrated in FIG. 4; or alternatively it will lie within that tolerance band as illustrated in FIG. 5. The algorithm determines which of these two cases has occurred by calculating the cross-product (vector product) of the new direct vector DV1 with each of the top and bottom tolerance vectors TV0,BV0 respectively. (Step 50.)
If it is determined that the new direct vector DV1 lies outside the tolerance band (FIG. 4) then the test point P2 is deemed to be required. The algorithm outputs the coordinate data for the test point P2 (step 52), after the coordinate data for the base point P1. The test point P2 is now treated as a new base point, and the current point P3 is treated as a new test point. (Steps 54 and 56.) The algorithm begins again from Stage 2, calculating new top and bottom tolerance vectors (TV0,BV0) based upon these new base and test points.
Should the new direct vector DV1 lie within the tolerance band between the top and bottom tolerance vectors TV0,BV0 (FIG. 5) then the test point P2 is rejected (i.e. filtered out) because it is deemed to be within the tolerance specifications of the algorithm. (Step 58.) That is, the test point P2 is redundant data which can be discarded because the surface contour is relatively flat or planar in this region. In this case, the algorithm retains the point P1 as its base point, and the current point P3 is re-defined as the new test point. (Step 60.) However, in this case the old tolerance vectors TV0, BV0 are not discarded.
New top and bottom tolerance vectors TV1,BV1 are now set around the new test point P3. (Step 62.) As illustrated in FIG. 6, this is done in a similar manner to Stage 2 above, using the distance h derived from the chordal tolerance.
Next, the algorithm chooses two of the tolerance vectors TV0,BV0,TV1,BV1 with which to continue, always taking one top tolerance vector and one bottom tolerance vector. The pair chosen is selected on the basis of which two vectors are closest to the direct vector DV1, above and below it respectively. (Step 64.) Usually the chosen pair will comprise one vector from each of the old and new sets. In the example shown in FIG. 6 the new top vector TVn is the top vector TV0 from the old set, while the new bottom vector BVn is the bottom vector BV1 from the new set. However, it is occasionally possible, especially after several iterations, for both vectors to be chosen from the new set. It will be seen from FIG. 6 that the band of tolerance associated with the chosen vectors TVn,BVn is always less than or equal to the chordal tolerance 2h.
The algorithm next repeats step 46, to receive a new point P4 (see FIG. 2). The procedure from Stage 3 onwards is repeated, using P1 as the base point, P3 as the test point and P4 as the current point, and using the new tolerance vectors TVn,BVn to define the tolerance band.
It will therefore be seen that whenever a data point is discarded, the tolerance requirements for each subsequent point become increasingly tight. As illustrated in FIG. 7, all discarded points P2 to P(n-1) are within the chordal tolerance of the straight line joining the two required points P1,Pn that bound them.
The algorithm can be used to reject unnecessary points entirely as it proceeds. Alternatively, it can just flag those points for action, so that they can be discarded at a later stage.
It is important to note that the algorithm uses only previous points to decide the fate of the current point. It does not need to know the behaviour of the whole set of points. For this reason, the algorithm is particularly suited for real time operation, deciding which points are required whilst the scan is under way. A further advantage is that the equations which must be calculated during the operation of the algorithm are simple, and involve only a few data points at a time. This is another reason why the algorithm lends itself to real time operation, and leads to improved speed and performance even if it is operating on a previously stored file of data. Moreover whilst many points can be discarded during operation, the vectors derived from discarded points may still be used to decide the fate of subsequent points, by narrowing the tolerance band, so that even discarded data can have an effect on the final result.
The algorithm described above is essentially two-dimensional, and is therefore suitable for scanned points which all lie within the same plane (e.g. the X-Z or Y-Z plane, as produced by the raster scanning operation described above). However, the algorithm can easily be extended to three dimensions where the data points are not all co-planar. This may be done by defining "cones of tolerance" in three dimensions, instead of the two-dimensional bands of tolerance illustrated in FIGS. 3-6. In FIG. 3, for example, the base point P1 will define the apex of the cone, and the direct vector DV0 will define its axis. Alternatively, to simplify the data processing, the two dimensional method described above may simply be repeated in the X-Y plane, so that there is a band of tolerance in the X-Y plane similar to that in the X-Z (or Y-Z) plane. It will be noted that the notional "cones of tolerance" just mentioned now become notional "pyramids of tolerance", with the base point P1 defining the apex of the pyramid and the horizontal and vertical tolerance distances 2h defining the size of the square (or rectangular) base of the pyramid.