Abstract:
The present invention relates to a method for recording a bar code, which consists of a plurality of parallel lines of varying thickness. The method comprises the steps of  
     a) capturing, by means of a reading device, a sequence of two-dimensional images of at least portions of the bar code during moving of the reading device across the same;  
     b) detecting the edges of the bar code in at least a subset of the images;  
     c) determining, for the edges of at least a subset of the detected images, possible displacements in relation to the edges of a preceding image;  
     d) determining the most probable sequence of displacements for the sequence of images; and  
     e) reconstructing the bar code by means of said sequence of images and said most probable sequence of displacements.  
     This method allows reliable detection of bar codes of arbitrary length and production of a bar code reader at a low cost.

Description:
FIELD OF THE INVENTION  
         [0001]    The present invention relates to a method, a reading device, and/or a computer program for recording a bar code having a plurality of parallel lines of varying thickness.  
         BACKGROUND ART  
         [0002]    Bar codes are today used to a great extent in the industry, trade and other branches of business. They constitute a possibility of rationally identifying an object and recording an object passing a certain point. Several standards for bar codes are already established, such as European Article Numbering (EAN), Universal Product Code (UPC) etc.  
           [0003]    A number of variants of bar code readers are presently available. The simplest type of bar code reader is the point sensor. A point sensor is passed by the user across the base, on which the bar code is printed. The point sensor then records the bar code as a variation in received light intensity.  
           [0004]    A condition for the point sensor to record the information correctly is that the speed at which it is moved across the base is very even. If the point sensor has a comparatively high speed in a first portion of the bar code and a comparatively low speed in a second portion of the bar code, a line in the second portion will be interpreted as wider than an identical line in the first portion. Since the requirement for an even speed of motion is very high for this type of sensor, many reading attempts will fail. The most reliable method of achieving an even speed as the sensor is being moved across the base is to move the sensor quickly. A user who has been unsuccessful in a first reading will, however, probably make the next reading more slowly since a slow reading is intuitively perceived as more accurate. The use of the point sensor as a bar code reader is thus associated with some problems, which makes its usability limited.  
           [0005]    Another known method is to use an elongate sensor. It may consist of a row of juxtaposed CCD pixels (CCD=Charge Coupled Device). These absorb light from a surface, which is illuminated by a row of light-emitting diodes. This sensor is not passed across the bar code but is kept stationary over the same, all lines in the code being recorded simultaneously.  
           [0006]    A drawback of the elongate sensor, in addition to its higher price, is that it cannot record bar codes of an arbitrary length. For each sensor of this type there is a certain maximum bar code length which is dependent on the number of pixels in the sensor and associated optics. Moreover, the elongate sensor can only with difficulty be used to record bar codes on a non-planar base.  
           [0007]    A third prior-art method of recording a bar code is to use a bar code reader with a scanning laser. The bar code reader then comprises mechanically movable optics, which sweep a laser beam over a bar code. The received light is projected onto a point sensor.  
           [0008]    The drawback of this type of bar code reader is above all a high price. However, the movable optics are also very susceptible to shocks, which restricts the usability of this bar code reader.  
         SUMMARY OF THE INVENTION  
         [0009]    An object of the present invention is to wholly or partly remedy the above problems.  
           [0010]    This object is achieved by a method for recording a bar code according to the present invention, a reading device for recording a bar code according to the present invention and a storage medium according to the present invention.  
           [0011]    According to a first aspect of the invention, the above object is achieved more specifically by a method for recording a bar code, which consists of a plurality of parallel lines of varying thickness. The method comprises the steps of:  
           [0012]    a) capturing, by means of a reading device, a sequence of two-dimensional images of at least portions of the bar code during moving of the reading device across the same;  
           [0013]    b) detecting the edges of the bar code in at least a subset of the images;  
           [0014]    c) determining, for the edges of at least a subset of the detected images, possible displacements in relation to the edges of a preceding image;  
           [0015]    d) determining the most probable sequence of displacements for the sequence of images; and  
           [0016]    e) reconstructing the bar code by means of said sequence of images and said most probable sequence of displacements.  
           [0017]    By means of such a method, a bar code can be interpreted in a very reliable manner. The reading device can be moved across the bar code in an arbitrary fashion as long as the entire bar code is recorded. The speed of the motion may vary from immobile up to the speed at which two successive images do not overlap each other any longer. Bar codes of an arbitrary length can be recorded. The reading device can be accomplished at a very low cost. Merely by adding new software to a reading pen of the type as disclosed in International Patent Publication No. WO 98/20446,A1, and used to record text, a reading device for interpretation of bar codes can be accomplished. A person who for other purposes owns such a reading pen can thus at a very low cost provide a bar code reader which operates according to the inventive method.  
           [0018]    According to a preferred embodiment, detection is carried out in said step b) of the edges starting from the darkness level in pixels in a band over the image, said band extending essentially perpendicular to the direction of extension of the lines of the bar code. This results in a more reliable detection of the bar code. Preferably step b) comprises the following steps:  
           [0019]    b1) generating, for at least a subset of the images which represent parts of the bar code, a histogram corresponding to the darkness level in said pixel along said band; and  
           [0020]    b2) differentiating said histogram so that a sequence of edge coordinates is provided, which describe where along said band in the image the edges of the lines of the bar code are located. This results in a more reliable detection of the bar code.  
           [0021]    According to a preferred embodiment, differentiated histograms are generated for a plurality of bands extending over an image at different angles, the band whose differentiated histograms have the highest peaks being selected as the band which is essentially perpendicular to the direction of extension of the lines of the bar code. As a result, the bar code can be detected even if the reading device is rotated during the motion. Preferably differentiated histograms are generated for more bands in the first image of the image sequence than in subsequent images. This enables quicker data processing for subsequent images.  
           [0022]    An edge coordinate can preferably be determined more accurately by maximizing an approximating function, such as a second degree function, which runs through the points forming the corresponding peak in said differentiated histograms. This allows more exact detection of the edges of the bar code.  
           [0023]    Preferably possible displacements are determined in step c) by assuming such a displacement that two edge coordinates belonging to successive images correspond to each other, and then determining whether the remaining edge coordinates in the images correspond to each other. This enables quick and exact detection of conceivable displacements.  
           [0024]    The most probable sequence of displacements is determined preferably with a criterion based on low acceleration of the reading device. This enables reliable detection of the bar code.  
           [0025]    Preferably, error functions are determined in step d) for the images in which edges have been detected, for at least a subset of the conceivable displacements relative to the displacements of a preceding image. This makes it possible to determine a most probable displacement.  
           [0026]    Such an error function, e k,  can preferably be calculated as follows: 
             e   k =max[ e   k−1 ,( V   k   −V   k−1 ) ( a   k   −a   k−1 )] 
           [0027]    wherein  
           [0028]    e k−1 =error function of the displacement of a preceding image,  
           [0029]    V k−1 =speed of the reading device when the preceding image was captured if the displacement of the preceding image is valid,  
           [0030]    V k =speed of the reading device when the image in question was captured if the displacement of the image in question is valid,  
           [0031]    a k−1 =acceleration of the reading device when the preceding image was captured if the displacement of the preceding image is valid,  
           [0032]    a k =acceleration of the reading device when the image in question was captured if the displacement of the image in question is valid.  
           [0033]    Such an error function has been found very reliable.  
           [0034]    For the last image in the image sequence, the displacement relative to displacements of the preceding image, which has the lowest error function, is suitably selected as the most probable displacement. This results in more reliable detection of the bar code.  
           [0035]    Preferably, for each image the displacement with regard to the most probable displacement of the subsequent image, which has the lowest error function, is selected as the most probable displacement. This, too, results in more reliable detection of the bar code.  
           [0036]    According to a second aspect, the present invention relates more specifically to a reading device for recording a bar code, which consists of a plurality of parallel lines of varying thickness. The reading device comprises means for capturing a sequence of two-dimensional images of at least portions of the bar code when moving the reading device across the same, means for detecting the edges of the bar code in at least a subset of the images, means for determining possible displacements in relation to the edges of a pre-ceding image for the edges of at least a subset of the detected images, means for determining the most probable sequence of displacements for the sequence of images, and means for reconstructing the bar code by means of said sequence of images and said most probable sequence of displacements.  
           [0037]    The reading device involves advantages corresponding to those of the above-described method and can be varied correspondingly. Then the reading device generally comprises means for carrying out the steps defined in the method.  
           [0038]    According to a preferred embodiment, the reading device can be included in a reading pen. The reading device can then be accomplished by adding software to such a reading pen as disclosed in International Patent Publication No. WO 98/20446,A1.  
           [0039]    The reading device can also be integrated in electronic equipment of some other type, such as a mobile telephone. Then the reading device can be used, for instance, to record a telephone number.  
           [0040]    According to a third aspect, the present invention relates more specifically to a digital storage medium comprising a computer program for recording a bar code, which consists of a plurality of parallel lines of varying thickness. The program comprises instructions for  
           [0041]    a) capturing by means of a reading device a sequence of two-dimensional images at least portions of the bar code when moving the reading device across the same;  
           [0042]    b) detecting the edges of the bar code in at least a subset of the images;  
           [0043]    c) determining possible displacements in relation to the edges of a preceding image for the edges of at least a subset of the detected images;  
           [0044]    d) determining the most probable sequence of displacements for the sequence of images; and  
           [0045]    e) reconstructing the bar code by means of said sequence of images and said most probable sequence of displacements.  
           [0046]    This computer program involves advantages corresponding to those of the above-described method and can be varied correspondingly. Then the computer program generally comprises instructions for carrying out the steps defined in the method. 
       
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS  
       [0047]    [0047]FIG. 1 illustrates a reading device in which a method according to the present invention can be applied.  
         [0048]    [0048]FIGS. 2 a - 2   c  show a method according to the present invention.  
         [0049]    [0049]FIG. 3 shows schematically an image representing a bar code.  
         [0050]    [0050]FIG. 4 a  shows an image of a bar code.  
         [0051]    [0051]FIGS. 4 b - 4   c  show histograms for different bands over the bar code image in FIG. 4 a.    
         [0052]    [0052]FIGS. 5 a - 5   b  show differentiated histograms corresponding to the histograms in FIGS. 4 c  and  4   b,  respectively.  
         [0053]    [0053]FIG. 5 c  shows an enlarged detail from the histogram in FIG. 5 a.    
         [0054]    [0054]FIGS. 6 a - 6   d  show how conceivable displacements between two successive images are determined.  
         [0055]    [0055]FIG. 7 is a diagram of a sequence of possible displacements between a sequence of images.  
         [0056]    [0056]FIG. 8 a  and FIG. 8 b  show an example of inputting of a bar code.  
     
    
     DESCRIPTION OF PREFERRED EMBODIMENTS  
       [0057]    [0057]FIG. 1 shows a reading device in which a method according to the present invention can be applied.  
         [0058]    The reading device  100  can preferably resemble the type disclosed in International Patent Publication No. WO 98/20446,A1, the description of which is incorporated herewith by reference. This reading device, however, is used for recording of text.  
         [0059]    The reading device  100  according to the invention then has a casing  101 , which resembles an ordinary high-lighter. The reading device  100  can in a preferred embodiment also be used for inputting of text. The reading device  100  can also be integrated with other equipment, such as mobile telephones, Personal Digital Assistants (PDA&#39;s), digital cameras etc. In one short side of the casing there is a window  102  which is to abut against or be held at a short distance from the base from which reading is intended to occur. The width and height of the window  102  essentially conform with the surface reproduced by the reading device  100  as an image is being captured. The window  102  forms an acute angle to the longitudinal axis of the casing of the reading device, so that the user of the reading device  100  is made to hold the reading device  100  at a certain predetermined angle to the base. The window  102  is slightly retracted into the casing  101  in order not to be worn against the base in the use of the reading device  100 .  
         [0060]    The casing contains essentially an optics part  103 , an electronic circuitry part  104  and a power supply part  105 .  
         [0061]    The optics part  103  comprises a light-emitting diode  106 , a lens system  107  and a light-sensitive sensor  108 , which constitutes an interface with the electronic circuitry part  104 . The light-emitting diode  106  serves to illuminate the part of the base, which is to be imaged, i.e. the part positioned under the window  102 . A diffuser  109  is mounted in front of the light-emitting diode  106  to distribute the light. The purpose of the lens system  107  is to project an image of the part of the base positioned under the window  103  on the light-sensitive sensor  108 . The light-sensitive sensor is preferably a two-dimensional CCD sensor with a built-in analog-to-digital (A/D) converter.  
         [0062]    The power supply unit  105  comprises a battery  112 , which is mounted in the casing  101 .  
         [0063]    The electronic circuitry part  104  comprises a processor and data memories for processing images recorded by the light-sensitive sensor  108 . A reading device according to the invention comprises means for carrying out the method steps that will be described below. These means suitably consist of said processor and memories provided with appropriate software. Part of or the entire recording method may also be carried out by means of an Application Specific Intergrated Circuit (ASIC).  
         [0064]    The inventive storage medium can consist of one of the above-mentioned memories in the reading device but can also be another storage medium, such as a diskette or a hard disk connected to a server.  
         [0065]    The electronic circuitry part  104  also comprises a transmitter for transmitting information, for instance to a personal computer. This can be of the type infrared (IR) transmitter, or a short range radio transmitter, for instance according to the BLUETOOTH technology.  
         [0066]    [0066]FIGS. 2 a - 2   c  show as a flow chart a method according to the present invention. The reading device described above captures at regular interval images of the base across which it is being passed. In a preferred embodiment the image frequency is 50 Hz. The process in which the method of the present invention is carried out thus receives an even flow of images. The images can be stored in a memory in the reading device. First the recording of all pictures can thus occur, after which the images are interpreted according to the present invention. According to the invention the interpretation can also be begun as soon as the first image has been captured.  
         [0067]    The reading device can be used for other purposes than entering of bar codes; for instance text, digits and other types of symbols can be entered. When the process through which the inventive method is carried out receives  201  (see FIG. 2 a ) an image, it is checked  202  whether the received image is a bar code.  
         [0068]    This check can be carried out relative to a set criterion. For instance, it is possible to identify the pixels located in the edges of the lines, i.e. black pixels which have a white neighboring pixel on their right or left side, or alternatively above or below them. Subsequently, calculation, both vertically and horizon-tally, of the total length of continuous rows/columns having a length greater than one, of such edge pixels is carried out. If the ratio between the total length seen in the vertical direction (columns) and the total length in the horizontal direction (rows) exceeds a certain value, the image probably shows a bar code. This method for recognizing a bar code can also be used separately in other applications than in the method according to the present invention.  
         [0069]    If the captured image does not describe a bar code, it is to be processed  203  in another manner. This may imply, for example, that recording of text occurs according to what is known from International Patent Publication No. WO 98/20446, A1. If the captured image describes a bar code, it is to be processed as the first image in a sequence of images describing the bar code.  
         [0070]    First, a number of histograms  204  (see FIGS. 4 b ,  4   c ) are generated, which describe the darkness level of the pixels along a number of bands  401 ,  402  etc. (see FIG. 4 a ), of a certain width, which bands extend over the image  403  at different angles. Preferably, the bands intersect an area close the center of the image. A band  402  extending perpendicular to the lines of the bar code in the image  403  will result in a histogram where the total value of the darkness degree of the pixels along the width of the band suddenly changes (see FIG. 4 c ) where the band extends over the edge of a line. In a histogram corresponding to a band  401  which extends more obliquely over the bar code, the total value of the dark-ness degree (on a gray scale) of the pixels over the width of the band will, however, change more slowly (see FIG. 4 b ), since pixels along the width of the band can be positioned on both sides of the edge of a line. By histogram is here generally meant a logic structure, such as a vector, which describes the darkness degree in different positions along the length of the band. In fact, the histogram need normally not be printed, but is here shown only for descriptive purposes.  
         [0071]    With reference once more to FIG. 2 a , the above generated histograms are differentiated  205 , i.e. on the basis of each histogram a new histogram is generated, which describes the difference in level between two neighboring points in the previously generated histogram. FIGS. 5 a  and  5   b  show differentiated histograms corresponding to those in FIGS. 4 c  and  4   b,  respectively.  
         [0072]    Using a criterion which takes the height of the peaks in these differentiated histograms into consideration, the differentiated histogram corresponding to the most perpendicular band over the bar code is selected  206 , with reference once more to FIG. 2 a.  For example, the sum of the square of the values of the differentiated histogram along the band can then be calculated. The most perpendicular band gives the highest peaks and thus the highest value of the square sum. Alternatively the sum of absolute values above a certain level can be calculated. The peaks constitute a rough estimate of the position of the edges in the band.  
         [0073]    In order to more exactly determine the position of the edge in the selected band, interpolation  207  of the peaks in the selected histogram is carried out. FIG. 5 c  shows an enlargement of a detail of the differentiated histogram in FIG. 5 a,  more specifically a peak, which represents a transition from white to black. As appears from Fig. 5 c,  this peak consists of three successive bars  501 ,  502 ,  503 . An approximation of the second degree  504  of these bars is effected, and the maximum of this approximation of the second degree is calculated. The edge of the line can now be assumed to be very close to this maximum and is thus determined on the sub-pixel level, i.e. with a higher resolution than the resolution of the pixels. By carrying out such interpolations of all peaks in the selected differentiated histogram, a set of edge coordinates is obtained, where the position of the edges along the selected band is most exactly determined. By edges is generally meant transitions from white to black and vice versa, but of course other colors may occur.  
         [0074]    The set of edge coordinates can be made as an up/down set where all edges are included, or as separate up sets (white to black) and down sets (black to white). The position of the edges in the first image thus is determined.  
         [0075]    With reference to FIG. 2 b,  the next image is then received  208 . Similarly to the first image, histograms of the darkness level of the pixels in bands over the image are generated  209 . For images following the first image it is, however, normally not necessary to generate histograms for a large number of bands at different angles over the image. If the image frequency is 50 Hz, only 20 ms have passed since the preceding image was captured, and therefore it can be assumed that the angle of the reading device to the base has not changed to any considerable extent. Therefore only histograms for three different bands are generated, one at the angle which in the preceding image was found to be essentially perpendicular to the direction of extension of the lines of the bar code, and two bands angled at, for example, +2° and −2° (one turn =360°) relative to this band. This results in quicker data processing for images following the first image.  
         [0076]    These three histograms are differentiated  210  and the histogram having the highest peaks is selected as the most perpendicular. In the same way as for the first image, interpolation  211  is carried out to determine the position of the edges of the lines of the bar code in the band on the sub-pixel level.  
         [0077]    Subsequently, conceivable displacements of a later image  605  (FIG. 6, corresponding to image  7  in FIG. 8 a ) in relation to the preceding image  606  (image  6  in FIG. 8 a ) are determined, which is illustrated with reference to FIGS. 6 a - 6   d . This occurs in such manner that the sets of edge coordinates, here shown as lines upwards and downwards along an axis, of the two images are compared. For example, the up-coordinate  601  (transition from white to black) in the preceding image  606  which is furthest to the right can be set as a reference point. The up-coordinates  602 ,  603 ,  604  etc. of the subsequent image then provide proposals for displacements Δ1, Δ2, Δ3, Δ4 of the reading device to the right. For each of these proposals, it is decided whether down-coordinates and the other up-coordinates coincide. In that case, this displacement is conceivable.  
         [0078]    In FIG. 6 a,  the up-coordinate of the later image which is positioned furthest to the left is assumed to conform with the up-coordinate of the preceding image  606  furthest to the right, which results in a displacement (or offset) Δ1. Then also the down-coordinate which is furthest to the right in the preceding image  606  conforms with the down-coordinate which is positioned furthest to the left in the later image  605 . No other coordinates are positioned within the overlap of the images, the size of the overlap being determined by the displacement. Δ1 therefore is a conceivable displacement.  
         [0079]    In FIG. 6 b,  the up-coordinate of the later image which is positioned furthest to the left but one is assumed to correspond with the up-coordinate of the preceding image  606  furthest to the right, which gives the displacement Δ2. Then also the two down-coordinates which are positioned furthest to the right in the preceding image  606  conform with the two down-coordinates which are positioned furthest to the left in the later image  605 . At the same time, the two up-coordinates which are positioned furthest to the right in the preceding image  606  conform with the two up-coordinates which are positioned furthest to the left in the later image  605 . Δ2 therefore is a conceivable displacement.  
         [0080]    In FIG. 6 c,  the up-coordinate of the later image which is positioned furthest to the left but two is assumed to conform with the up-coordinate of the pre-ceding image  606  furthest to the right, which gives the displacement Δ3. Then also the three down-coordinates which are positioned furthest to the right in the preceding image  606  conform with the three down-coordinates which are positioned furthest to the left in the later image  605 . At the same time the three up-coordinates which are positioned furthest to the right in the pre-ceding image  606  conform with the three up-coordinates which are positioned furthest to the left in the later image  605 . Therefore Δ3 is a conceivable displacement.  
         [0081]    In FIG. 6 d,  the up-coordinate of the later image, which is furthest to the left but three, is assumed to conform with the up-coordinate of the preceding image  606  furthest to the right, which gives the displacement Δ4. However, here are conflicts between several of the other coordinates in the different images. For example, the up-coordinate which is furthest to the right but one in the preceding image  606  has no correspondence in the later image. Thus Δ4 is not a conceivable displacement.  
         [0082]    The diagrams in FIGS. 6 a - 6   d  are shown only for descriptive purposes; in the inventive method the data of the images is processed as sets of coordinates. Then a certain degree of displacement is added to the coordinates, which correspond to the later image. Whether the displacement is conceivable or not is determined according to a certain criterion. For instance, the square sum of deviations in pairs of up and down coordinates of the overlapping parts of each image can be calculated (for instance, the difference between the coordinate value of the lowest up-coordinate in the overlapping part of the first image and the coordinate value of the lowest up-coordinate in the overlapping part of the later image). If the square sum of these deviations is below a certain value, the displacement is assumed to be possible.  
         [0083]    To be able to detect also motions from the left to the right, also the corresponding method can be carried out where, for example, the up-coordinates furthest to the left in the preceding image are used as a reference point.  
         [0084]    For most pairs of images in the sequence, which reproduce the bar code, it is probable that more than one conceivable displacement will be found. It is established  213  by the process whether conceivable displacements with regard to the preceding image exist. If no conceivable displacements exist, this means that the recording of the bar code has been terminated and that the final processing is to take place as will be described below with reference to FIG. 2 c.    
         [0085]    If, however, valid displacements exist, there is determined  214  or each of these an error function with regard to each of the displacements of the preceding image. This is shown in FIG. 7, which includes a diagram with a horizontal time axis whereas the amount of displacement between successive images is disposed in the direction of the vertical axis. Between the first image  701  and the second image  702  there is a set  703  containing three conceivable displacements (each denoted with an “x”), in this case two to the right  707 ,  712  which give displacement values above the time axis and one to the left  708  which gives a displacement below the axis, i.e. negative displacement. Between the second image  702  and the third image  704  there is a set  705  containing two conceivable displacements. In this case however, both are positive, which corresponds to motions of the reading device to the right at different speeds. For all displacements between the preceding and subsequent images in the sequence, error functions are determined, as mentioned above, relative to all displacements in the displacements of the preceding set. For example, for the greatest displacement  706 , between the second  702  and the third  704  image, error functions are determined relative to the set  703  of conceivable displacements  707 ,  708 ,  712  between the first  701  and the second  702  image.  
         [0086]    The error function e k  can preferably be written as follows: 
           e   k =max[ e   k−1 ,( v   k   −v   k−1 )( a   k   −a   k−1 )] 
         [0087]    wherein  
         [0088]    e k−1 =error function of the displacement of a preceding image,  
         [0089]    V k−1 =speed of the reading device when the preceding image was captured if the displacement of the preceding image is valid,  
         [0090]    V k =speed of the reading device when the image in question was captured if the displacement of the image in question is valid,  
         [0091]    a k−1 =acceleration of the reading device when the preceding image was captured if the displacement of the preceding image is valid, and  
         [0092]    a k =acceleration of the reading device when the image in question was captured if the displacement of the image in question is valid.  
         [0093]    If the difference in the speed required for the displacement of the preceding image to be valid and the speed required for the displacement of the image in question (and the displacement of the preceding image) to be valid is great, and moreover the corresponding difference in acceleration is great, a great error is given, since this is a motion which is improbable for the reading device. Even if the differences in speed and acceleration are small, a great error will, however, be given if the preceding displacement had a great error, since this error then propagates in the maximum function. Speed is here measured in the number of pixels (integer or real number) perpendicular to the lines of the bar code between two captured images.  
         [0094]    For each conceivable displacement in an image, the displacement of the preceding image which has the lowest error function is selected (FIG. 2 b,    215 ) as the most probable preceding displacement. For the greatest conceivable displacement  706  between the second  702  and the third  704  image, for instance the positive displacement  707  (i.e. to the right) between the first  701  and the second  702  image is selected as the most probable preceding displacement. In FIG. 7 each displacement points at its most probable preceding diplacement. An example of a less probable preceding displacement is indicated with a dashed line.  
         [0095]    Subsequently the process is repeated, once more with reference to FIG. 2 b,  when the next image is received  208 .  
         [0096]    When the process establishes  216  that no conceivable displacements relative to the preceding image exist for an arrived image, the scanned bar code is finally processed, as will be described in more detail with reference to FIG. 2 c.    
         [0097]    For the last image which had conceivable displacements relative to the preceding image and which thus was the last image describing the bar code, it is established  217  which displacement relative to displacements of the preceding image had the lowest error function. This displacement ( 710  in FIG. 7) is assumed to be the most probable displacement between the penultimate and the last image. Since each conceivable displacement for each image has a most probable preceding displacement, a chain of most probable displacements for the entire image sequence can now be created  218 .  
         [0098]    This chain ( 709  in FIG. 7) of most probable displacements forms a set of displacements which together with the edge coordinates in each image can be used to reconstruct the edge coordinates for the entire bar code into a global set of edge coordinates. This global set of edge coordinates describes the appearance of the bar code, provided that the entire bar code has been imaged. Consequently, the set of edge coordinates can be used to extract  220  the information contents of the bar code, in manners well known per se.  
         [0099]    An example of the method is shown in FIGS. 8 a  and  8   b . A bar code  801 , in this case according to the EAN 13 Standard, is recorded. The symbol value of the bar code, i.e. the information that is to be extracted, is the string “7331424010072”. Twelve images of the bar code are captured when a reading device is passed across the bar code  801 . The positions of the first and the seventh image are indicated in FIG. 8 a.  From these twelve images, a set of edge coordinates  802 ,  803  etc. is produced. These are shown as diagrams in FIG. 8 a.  When displacements Δ2, Δ3 etc. between preceding and subsequent images have been determined, as shown in FIG. 8 b,  a global set of edge coordinates  804  for the entire bar code can be produced. The global set of edge coordinates  804  is then used to extract the information contents  805  of the bar code. This occurs in a manner similar to that of prior-art bar code readers.  
         [0100]    The method according to the invention can generally be described with the following steps:  
         [0101]    a) capturing by means of the reading device a sequence of two-dimensional images of at least portions of the bar code when moving the reading device across the same;  
         [0102]    b) detecting the edges of the bar code in at least a subset of the images;  
         [0103]    c) determining possible displacements in relation to the edges of a preceding image for the edges of at least a subset of the detected images;  
         [0104]    d) determining the most probable sequence of displacements for the sequence of images; and  
         [0105]    e) reconstructing the bar code by means of said sequence of images and said most probable sequence of displacements.  
         [0106]    Normally, each image comprises a portion of a bar-code. However, at bar-codes with small length the complete bar-code maybe included in one image. In this case, several images of the same bar-code may increase this accuracy by taking a mean value.  
         [0107]    The invention is not restricted by the embodiments described above and can be varied in several ways within the scope of the appended claims.