# Patent

## Title
Method and apparatus for dimensioning box object

## Abstract

A method to determine the volume of a box object from the captured image of the box object. The method includes identifying a geometric mark on the box object in the captured image to find the positions of two reference points of the geometric mark. The two reference points are separated by a predetermined distance. The method also includes processing a group of parameters and a predetermined mapping obtained from a calibration process. The group of parameters includes the positions of the two reference points and the predetermined distance separating the two reference points.

## Background
BACKGROUND
While many imaging systems can be used to capture images of a box object, most of the imaging systems do not have the functions to estimate the volume or the three box dimensions (i.e., the length, the width, and the height) of the box object from the captured images. There is a need for a method and apparatus for determining sizes of a box object conveniently based on image processing principles.



BRIEF DESCRIPTION OF THE FIGURES
The accompanying figures, where like reference numerals refer to identical or functionally similar elements throughout the separate views, together with the detailed description below, are incorporated in and form part of the specification, and serve to further illustrate embodiments of concepts that include the claimed invention, and explain various principles and advantages of those embodiments.
FIG. 1A and FIG. 1B are examples of imaging systems in accordance with some embodiments.
FIG. 2 is a schematic of an imaging system in accordance with some embodiments.
FIG. 3 shows that a barcode placed on the surface of a box object.
FIG. 4A is an example of a display screen that shows a captured image of the box object with the geometric mark on one face of the box object in accordance with some embodiments.
FIG. 4B is an example of a display screen on which the box dimensions and the volume of the box object are displayed in accordance with some embodiments.
FIG. 5A shows a captured image of a box object in accordance with some Embodiments.
FIG. 5B shows some edge lines in the captured image in accordance with some embodiments
FIG. 5C shows some points in the captured image that are selected as candidates for using as the corner points of the box object in accordance with some embodiments.
FIG. 6 is a flowchart showing one method of identifying corner points in the captured image in accordance with some embodiments.
FIG. 7 is a flowchart showing a method of finding the volume of the box object in accordance with some embodiments.
FIG. 8 shows the box object in a device coordinate O{circumflex over (X)}Ŷ{circumflex over (Z)} in accordance with some embodiments.
FIG. 9A shows a calibration matrix for a first example imaging system in accordance with some embodiments, and FIG. 9B shows a calibration matrix for a second example imaging system in accordance with some embodiments.
FIG. 10A shows the positions of the corner points of the box object in the captured image and the lines for identifying the edges of the box object in accordance with some embodiments.
FIG. 10B shows the vanishing lines and vanishing points in the captured image are obtained in accordance with some embodiments.
FIGS. 11A-11B and FIG. 12 illustrate an alternative embodiment for determining the normal vector of a face of the box object in accordance with some embodiments.



Skilled artisans will appreciate that elements in the figures are illustrated for simplicity and clarity and have not necessarily been drawn to scale. For example, the dimensions of some of the elements in the figures may be exaggerated relative to other elements to help to improve understanding of embodiments of the present invention.
The apparatus and method components have been represented where appropriate by conventional symbols in the drawings, showing only those specific details that are pertinent to understanding the embodiments of the present invention so as not to obscure the disclosure with details that will be readily apparent to those of ordinary skill in the art having the benefit of the description herein.
DETAILED DESCRIPTION
A method includes detecting light from a box object through an imaging lens arrangement with an imaging sensor having two-dimensional photosensitive elements to capture at least one image of the box object. The box object has the shape of a rectangular solid. The method also includes identifying at least six corners of the box object to find the positions of the at least six corners in the at least one image, and identifying a geometric mark with fixed dimensions on the box object in the at least one image to find the positions of at least two reference points of the geometric mark in the at least one image. The at least two reference points are separated by a predetermined distance. The method still includes processing a group of parameters and a predetermined mapping to determine one of (a) the volume of the box object and (b) the box dimensions of the box object. The box dimensions include the width, the length, and the height of the box object. The group of parameters includes (1) the positions of the at least six corners in the at least one image, (2) the positions of the at least two reference points in the at least one image, and (3) the predetermined distance separating the at least two reference points. The predetermined mapping is operative to establish a one-to-one corresponding relationship between a point in an image plane of the imaging sensor and a point in a reference plane in physical space.
There are many imaging systems that can be used to capture images of a box object. Examples of these imaging systems include the tablet computer as shown in FIG. 1A, and the imaging scanner 50 as shown in FIG. 1B. Other examples of imaging systems are a digital camera and a cellular telephone. FIG. 1B shows an imaging scanner 50 for implementation of the present invention. The imaging scanner 50 has a window 56 and a housing 58 with a handle. The imaging scanner 50 also has a base 52 for supporting itself on a countertop. The imaging scanner 50 can be used in a hands-free mode as a stationary workstation when it is placed on the countertop. The imaging scanner 50 can also be used in a handheld mode when it is picked up off the countertop and held in an operator's hand. In the hands-free mode, products can be slid, swiped past, or presented to the window 56. In the handheld mode, the imaging scanner 50 can be moved towards a barcode on a product, and a trigger 54 can be manually depressed to initiate imaging of the barcode. In some implementations, the base 52 can be omitted, and the housing 58 can also be in other shapes. In FIG. 1B, a cable is also connected to the base 52. In other implementations, when the cable connected to the base 52 is omitted, the imaging scanner 50 can be powered by an on-board battery and it can communicate with a remote host by a wireless link.
FIG. 2 is a schematic of an imaging system 50 in accordance with some embodiments. The imaging system 50 in FIG. 2 includes the following components: (1) an imaging sensor 62 positioned behind an imaging lens arrangement 60; (2) an illuminating lens arrangement 70 positioned in front of an illumination source 72; and (3) a controller 90. In FIG. 2, the imaging sensor 62 is mounted on a printed circuit board 91 in the imaging system.
The imaging sensor 62 can be a CCD or a CMOS imaging device. The imaging sensor 62 generally includes multiple pixel elements. These multiple pixel elements can be formed by a two-dimensional array of photosensitive elements arranged in mutually orthogonal rows and columns. The imaging sensor 62 is operative to detect light captured by an imaging lens arrangement 60 along an optical path or axis 61 through the window 56. Generally, the imaging sensor 62 and the imaging lens arrangement 60 are designed to operate together for capturing light scattered or reflected from a target object (e.g., the box object 30) as pixel data over a two-dimensional imaging field of view (FOV).
In many operation environments, as shown in FIG. 3, the barcode 40 is placed on one or more sides of a box object 30, and the imaging system 50 is often used to decode the barcode 40 for identifying the box object or finding other information of the box object. In some operation environments, the user also has to estimate the dimensions or the volume of the box object using additional equipment. It is recognized that it would be desirable to use the imaging system 50 to perform the function of estimating the dimensions or the volume of the box object 30.
In accordance with some embodiments, if the size of the barcode 40 (e.g., its width or its length) is known, the volume or the three box dimensions (i.e., the length, the width, and the height) of the box object 30 can be estimated if the box object 30 and the barcode 40 are both captured in an image by the imaging system 50. In general, if the distance between two points on a geometric mark 35 on the box object 30 is known, the volume or the three box dimensions of the box object 30 can be estimated from the image of the box object 30 as captured by the imaging system 50. Examples of the geometric mark 35 include a one-dimensional barcode, a two-dimensional barcode, a logo, a shipping label, or the combination of isolated point marks printed on the face of the box object 30.
FIG. 4A is an example of a display screen 98 that shows a captured image of the box object 30 with the geometric mark 35 on one face of the box object 30 in accordance with some embodiments. In this example, the geometric mark 35 has the shape of a rectangular solid, and two corner points of the geometric mark 35 are used as two reference points “P” and “Q” on a surface of the box object 30 as shown in FIG. 3. In FIG. 4A, these two reference points in the captured image are labeled as “p” and “q”. The positions of these two reference points in the captured image can be identified automatically with the imaging system 50 by performing certain image processing algorithm on the captured image as in FIG. 4A. In some implementations, after an identified position is displayed on the display screen 98 as shown in FIG. 4A, the identified position can be confirmed by a user. In some implementations, the positions of the reference points in the captured image can be identified by the user manually; for example, the user can visually choose a user-selected position on the display screen as the identified position, after the captured image is displayed on the display screen. In some embodiments, more than two reference points are used for performing required calculation or algorithm, the position of any of these more than two reference points in the captured image can be identified automatically with the imaging system 50 or identified by the user manually on the display screen 98.
Similarly, the box object in the captured image can be identified by the six corners v0, v1, v2, v3, v4, and v5, and the positions of these six corner points of the box object in the captured image can be identified automatically with the imaging system 50 by performing certain image processing algorithm on the captured image as shown in FIGS. 5A-5C. Specifically, FIG. 5A shows a captured image of a box object, FIG. 5B shows that some edge lines in the captured image are determined, and FIG. 5C shows that some points in the captured image (e.g., some cross points of the edge lines) are selected as candidates for using as the corner points of the box object.
FIG. 6 a flowchart showing one method of identifying corner points in the captured image in accordance with some embodiments. The image processing algorithm used in FIG. 6 includes smoothing such as Gaussian Blur, detection such as Canny algorithm, Hough transform algorithm with contour detection, Convex Hull algorithm, and box corners detection. It will be appreciated by those of ordinary skill in the art that other image processing algorithms may be alternatively used for automatically identifying the corner points. In some implementations, after an identified position is displayed on the display screen, such identified position can be confirmed by the user. In some implementations, the positions of the corner points of the box object in the captured image can be identified by the user manfully; for example, the user can visually chose a user-selected position on the display screen as the identified position, after the captured image is displayed on the display screen.
Once the positions of the six corners (e.g., v0, v1, v2, v3, v4, and v5,) and the positions of the two reference points (e.g., “p” and “q”) in the captured image are known, the volume of the box object 30 can be determined by the imaging system 50, provided that the physical distance separating the two reference points “P” and “Q” on the surface of the box object 30 has been predetermined and the imaging system 50 has been properly calibrated.
FIG. 7 is a flowchart showing a method 200 of finding the volume of the box object 30 in accordance with some embodiments. The method 200 includes blocks 210, 220, 230, 260, 270, 280, and 290. At block 210, the imaging system 50 is calibrated. At block 220, an image of the box object 30 is captured (e.g., as shown in FIG. 4A). At block 230, six corners of the box object and two reference points on a surface of the box object are identified to find the positions of the six corners and the positions of the two reference points in the captured image (e.g., as shown in FIG. 4A). At block 260, the surface orientation of three faces the box object 30 are determined (e.g., the three faces F0, F1, and F2, as shown in FIG. 3). At block 270, the positions of at least four corner points of the box object in object space are determined (e.g., four corner points V0, V1, V2, V3, as shown in FIG. 3). At block 280, the volume of the box object 30 is determined (e.g., using the height H, the width W, and the length L, as shown in FIG. 3). At block 290, the volume of the box object is displayed on a display screen (e.g., as shown in FIG. 4B).
In some implementations, before the box dimensions are displayed on the display screen as shown in FIG. 4B, the captured image of the box object 30 is displayed on the display screen as shown in FIG. 4A. In some implementations, after the image of the box object 30 is captured, the captured image of the box object 30 is displayed on the display screen to allow a user to select or confirm the corner points of the box object in the captured image and to select or confirm the reference points on the surface of the box object in the captured image. The user can initiate the calculation of the box dimensions or the calculation of the box dimensions the volume by clicking on the soft menus on the display, such as, the graphics icons labeled “Measure” and “Retry” as shown in FIG. 4A.
In the following, the operations in the method 200 of FIG. 7 are explained in more details. In particular, the operations in block 210, the block 260, and the block 270 are explained in more details with referring to FIG. 8. FIG. 8 shows the box object 30 in a device coordinate O{circumflex over (X)}Ŷ{circumflex over (Z)} in accordance with some embodiments. In some implementations, the device coordinate O{circumflex over (X)}Ŷ{circumflex over (Z)} is fixed relative to the imaging system 50. The box object 30 includes corner points V0, V1, V2, V3, V4, V5, and M0. The box object 30 also includes faces F0, F1, and F2, with corresponding normal vectors {right arrow over (N)}0, {right arrow over (N)}1, and {right arrow over (N)}2 respectively. There are two reference points “P” and “Q” on a surface of the box object 30. In some embodiments, the two reference points “P” and “Q” can be selected from two identifiable points on a geometric mark, such as the corner points of a barcode, a logo, or a shipping label.
In FIG. 7, at block 210, the imaging system 50 is calibrated. For each imaging system, calibration is needed to determine a mapping that is operative to establish a one-to-one corresponding relationship between a point in an image plane of the imaging sensor and a point in a reference plane in physical space. In some implementations, the reference plane in physical space can be a plane located at a known position and orientated perpendicular to the optical axis of the imaging system. In FIG. 8, the reference plane 110 can be described by equation Z=U0 in the device coordinate O{circumflex over (X)}Ŷ{circumflex over (Z)}. In some implementations, the calibration process at block 210 can be used to determine a mapping that maps a pixel point (x, y) in the imaging sensor to a point (x′, y′, U0) on the reference plane 110 in the device coordinate O{circumflex over (X)}Ŷ{circumflex over (Z)}. Any point on the light ray 120 can be identified as (x′Z/U0, y′Z/U0, Z), and light from such point will strike on the pixel point (x, y) in the imaging sensor. In some implementations, the reference plane 110 is selected to be at one unit distance from the origin “O” of the device coordinate O{circumflex over (X)}Ŷ{circumflex over (Z)}, that is, U0=1.
In some implementations, the mapping that maps a pixel point (x, y) in the imaging sensor to a point (x′, y′, 1) on the reference plane 110 in the device coordinate O{circumflex over (X)}Ŷ{circumflex over (Z)} can be equivalent to a 3×3 matrix that maps a point (x y 1)T in a homogeneous coordinate to a point (x′ y′ 1)T on the reference plane 110 in the device coordinate O{circumflex over (X)}Ŷ{circumflex over (Z)}. This 3×3 matrix can be represented by the product of the matrix R and the matrix K−1, that is,

(x′y′1)T=RK−1(xy1)T,

Here, the matrix R is the reflection matrix and the matrix K−1 is the inverse of matrix K,





  
    K
    =
    
      (
      
        
          
            
              α
              x
            
          
          
            γ
          
          
            u
          
        
        
          
            0
          
          
            
              α
              y
            
          
          
            v
          
        
        
          
            0
          
          
            0
          
          
            1
          
        
      
      )
    
  
  ,
  
    
      and
      ⁢
      
        
      
      ⁢
      R
    
    =
    
      
        (
        
          
            
              1
            
            
              0
            
            
              0
            
          
          
            
              0
            
            
              
                -
                1
              
            
            
              0
            
          
          
            
              0
            
            
              0
            
            
              1
            
          
        
        )
      
      .
    
  




Generally, the matrix K, which maps a point (x y 1)T in a homogeneous coordinate to a point (x′ y′ 1)T in the device coordinate {circumflex over (X)}Ŷ{circumflex over (Z)}, can be determined at block 210 in FIG. 7 by following some well established procedures. For example, some chessboard pattern can be presented to the imaging system 50, and the matrix K can be determined by invoking some calibration routines. The matrix K needs to be calibrated for each of different type of devices. For example, FIG. 9A shows a calibration matrix for a first example imaging system that is in the form of a digital camera implemented on a tablet computer, and FIG. 9B shows a calibration matrix for a first example imaging system that is in the form of a digital camera implemented on a smartphone.

It should be noted that the matrix K is just one example representation of a mapping that is operative to establish a one-to-one corresponding relationship between a point in an image plane of the imaging sensor and a point in a reference plane in physical space, other representations are also possible, and there are other methods to establish a one-to-one corresponding relationship between a point in an image plane of the imaging sensor and a point in a reference plane in physical space. The imaging system can be calibrated before the imaging system is used to capture the image of the box object 30. The imaging system can also be calibrated after the imaging system is used to capture the image of the box object 30.
In FIG. 7, at block 220 of the method 200, an image of the box object 30 is captured. In some implementations, such image can be a single image captured by the imaging system after receiving a triggering event, such as, the pulling of a trigger. In some implementations, such image can be a frame selected from a stream of video frames. In some implementations, such image can be a processed image that is obtained from some image-processing process operating on multiple images; each of the multiple images can be a frame selected from a stream of video frames. In some implementations, consecutive frames of the same object captured by the same imaging system can be used to auto-calibrate the device and estimate the measurement error of the measured object.
In FIG. 7, after the image of the box object 30 is captured, at block 230 of the method 200, six corners of the box object and two reference points on a surface of the box object are identified (e.g., as shown in FIG. 4A) to find the positions of the six corners (e.g., v0, v1, v2, v3, v4, and v5) and the positions of the two reference points (e.g., “p” and“q”) in the captured image.
In FIG. 7, at block 260 of the method 200, the normal vectors {right arrow over (N)}0, {right arrow over (N)}1, and {right arrow over (N)}2—which are respectively corresponding to faces F0, F1, and F2 of the box object 30 as shown in FIG. 8—are determined Specifically, as shown in FIG. 10A, using the positions of the six corner points (e.g., v0, v1, v2, v3, v4, and v5) of the box object, the location and the orientation of the lines (e.g., e0, e1, e2, e3, e4, and e5) for identifying the edges of the box object can be obtained. Using these lines e0, e1, e2, e3, e4, and e5, the normal vectors {right arrow over (N)}0, {right arrow over (N)}1, and {right arrow over (N)}2 can be determined.
People skilled in the art may find many methods to find the normal vectors {right arrow over (N)}0, {right arrow over (N)}1, and {right arrow over (N)}2 from the positions of the six corner points v0, v1, v2, v3, v4, and v5 in the captured image. One of such methods relies on the technique of multiple view geometry, as descried, for example, by R. I. Hartley and A. Zisserman, in a reference titled “Multiple View Geometry in Computer Vision”, published by Cambridge University Press, 2000.
With multiple view geometry, points and lines are represented by vectors in projective space. As shown in FIG. 10A and FIG. 10B, each of the vanishing points {right arrow over (ω)}i can be calculated from the cross product of two lines selected from lines {right arrow over (e)}0, {right arrow over (e)}1, {right arrow over (e)}2, {right arrow over (e)}3, {right arrow over (e)}4, and {right arrow over (e)}5; that is, {right arrow over (ω)}i={right arrow over (e)}i×{right arrow over (e)}i+3, for i=0, 1, and 2. As shown in FIG. 10B, each of the vanishing lines {right arrow over (λ)}i can be calculated from the cross product of two vanishing points selected from vanishing points {right arrow over (ω)}0, {right arrow over (ω)}1, and ω2; that is, {right arrow over (λ)}i=ωi×{right arrow over (ω)}(i+3)mod 3, for i=0, 1, and 2. The normal vectors {right arrow over (N)}0, {right arrow over (N)}1, and {right arrow over (N)}2 can be calculated from the vanishing lines {right arrow over (λ)}i and the matrix K that maps a point (x y 1)T in a homogeneous coordinate to a point (x′ y′ 1)T in the device coordinate O{circumflex over (X)}Ŷ{circumflex over (Z)}. Specifically, with a representation in which {right arrow over (N)}i=(Ai Bi Ci)T and {right arrow over (λ)}i=(λix λiy λiz)T, the normal vector is given by the following equation:




  
    
      
        (
        
          
            
              
                A
                i
              
            
            
              
                B
                i
              
            
            
              
                C
                i
              
            
          
        
        )
      
      T
    
    =
    
      
        1
        
          
          
            RK
            T
          
          
        
      
      ⁢
      
        
          
            RK
            T
          
          ⁡
          
            (
            
              
                
                  
                    λ
                    ix
                  
                
                
                  
                    λ
                    iy
                  
                
                
                  
                    λ
                    iz
                  
                
              
            
            )
          
        
        T
      
    
  
  ,




for i=0, 1, and 2, with R being the reflection matrix.

In the method 200 as shown in FIG. 7, after the normal vectors {right arrow over (N)}0, {right arrow over (N)}1, and {right arrow over (N)}2 are determined at block 260, the positions of at least four corner points of the box object 30 in object space is determined at block 270. In the device coordinate O{circumflex over (X)}Ŷ{circumflex over (Z)}, as shown in FIG. 8, any point (X Y Z)T on the faces F0, F1, or F2 of the box object 30 needs to satisfy one of the corresponding linear equations AiX+BiY+CiZ=D1, with i=0, 1, or 2. The position of such point (X Y Z)T in the device coordinate can be determined from the position (x, y) of its corresponding point in the captured image:

(XYZ)T=(x′Zy′ZZ)T=(x′y′1)TZ, 

where (x′ y′ 1)T=RK−1(x y 1)T.

After the normal vectors {right arrow over (N)}0, {right arrow over (N)}1, and {right arrow over (N)}2 are determined, if the distance L0 between the two reference points “P” and “Q” on the surface of the box object 30 is also known, it will be possible to determine the remaining unknown parameters D0, D1, and D2 for describing all three faces F0, F1, and F2 with linear equations AiX+BiY+CiZ=D. In the device coordinate O{circumflex over (X)}Ŷ{circumflex over (Z)}, as shown in FIG. 8, the position of the reference point “P” is (XP YP ZP)T, and the position of the reference point “Q” is (XQ YQ ZQ)T. The distance between the two reference points “P” and “Q” is

√{square root over ((XP−XQ)2+(YP−YQ)2+(ZP−ZQ)2)}=L0 

In one embodiment, as shown in FIG. 8, if the two reference points “P” and “Q” are located on the surface F0 of the box object 30, the positions of these points “P” and “Q” respectively satisfy linear equations

A0XP+B0YP+C0ZP=D0 and A0XQ+B0YQ+C0ZQ=D0.

The positions of the points “P” and “Q” in the device coordinate O{circumflex over (X)}Ŷ{circumflex over (Z)} is related to the positions of the points “p” and “q” in the captured image. Specifically, if the position of the point “p” in the captured image is (xP yP) and the position of the point “q” in the captured image is (xQ YQ), the positions of the points “P” and “Q” in the device coordinate are related by the following equations:

(XPYPZP)T=(x′Py′P1)TZP, and

(XQYQZQ)T=(x′Qy′Q1)TZQ.

with

(x′Py′P1)T=RK−1(xPyP1)T, and

(x′Qy′Q1)T=RK−1(xQyQ1)T.

From above equations, it can be determined that




  
    
      Z
      P
    
    =
    
      
        L
        0
      
      
        
          
            
              (
              
                
                  x
                  P
                  ′
                
                -
                
                  kx
                  Q
                  ′
                
              
              )
            
            2
          
          +
          
            
              (
              
                
                  y
                  P
                  ′
                
                -
                
                  ky
                  Q
                  ′
                
              
              )
            
            2
          
          +
          
            
              (
              
                1
                -
                k
              
              )
            
            2
          
        
      
    
  




  with




  
    k
    =
    
      
        
          
            
              A
              0
            
            ⁢
            
              x
              P
              ′
            
          
          +
          
            
              B
              0
            
            ⁢
            
              y
              P
              ′
            
          
          +
          
            C
            0
          
        
        
          
            
              A
              0
            
            ⁢
            
              x
              Q
              ′
            
          
          +
          
            
              B
              0
            
            ⁢
            
              y
              Q
              ′
            
          
          +
          
            C
            0
          
        
      
      =
      
        
          Z
          Q
        
        
          Z
          P
        
      
    
  



After the position (XP YP ZP)T of the point “P” is determined, the position (X Y Z)T of any point on the surface F0 in the device coordinate O{circumflex over (X)}Ŷ{circumflex over (Z)} can be determined from the position of its corresponding point in the captured image. In particular, the position (Xi Yi Zi)T of the corner point Vi as shown in FIG. 8—for i=0, 1, or 2—can be determined from the position (xi yi) of the corner point vi in the captured image as shown in FIG. 10. Specifically, the positions (X0 Y0 Z0)T, (X1 Y1 Z1)T, and (X2 Y2 Z2)T can be determined from the following equations:



  
    
      
        (
        
          
            
              
                X
                i
              
            
            
              
                Y
                i
              
            
            
              
                Z
                i
              
            
          
        
        )
      
      T
    
    =
    
      
        
          (
          
            
              
                
                  x
                  i
                  ′
                
              
              
                
                  y
                  i
                  ′
                
              
              
                1
              
            
          
          )
        
        T
      
      ⁢
      
        Z
        P
      
      ⁢
      
        
          
            
              A
              0
            
            ⁢
            
              x
              P
              ′
            
          
          +
          
            
              B
              0
            
            ⁢
            
              y
              P
              ′
            
          
          +
          
            C
            0
          
        
        
          
            
              A
              0
            
            ⁢
            
              x
              i
              ′
            
          
          +
          
            
              B
              0
            
            ⁢
            
              y
              i
              ′
            
          
          +
          
            C
            0
          
        
      
    
  




  
    
      
        
          with
          ⁢
          
            

          
          (
          
            
              
                
                  x
                  i
                  ′
                
              
              
                
                  y
                  i
                  ′
                
              
              
                1
              
            
          
          )
        
        T
      
      =
      
        
          
            RK
            
              -
              1
            
          
          ⁡
          
            (
            
              
                
                  
                    x
                    i
                  
                
                
                  
                    y
                    i
                  
                
                
                  1
                
              
            
            )
          
        
        T
      
    
    ,
  



for i=0, 1, and 2. Similarly, the position of the corner point M0 as shown in FIG. 8 can be determined from the position of the corner point m0 in the captured image as shown in FIG. 10.

After the position (X0 Y0 Z0)T of the point V0 is determined, the position (X Y Z)T of any point on the surface F1 in the device coordinate O{circumflex over (X)}Ŷ{circumflex over (Z)} can be determined from the position of its corresponding point in the captured image. In particular, the position (X5 Y5 Z5)T of the corner point V5 as shown in FIG. 8, can be determined from the position (x5 y5) of the corner point v5 in the captured image as shown in FIG. 10.



  
    
      
        (
        
          
            
              
                X
                5
              
            
            
              
                Y
                5
              
            
            
              
                Z
                5
              
            
          
        
        )
      
      T
    
    =
    
      
        
          (
          
            
              
                
                  x
                  0
                  ′
                
              
              
                
                  y
                  0
                  ′
                
              
              
                1
              
            
          
          )
        
        T
      
      ⁢
      
        Z
        0
      
      ⁢
      
        
          
            
              A
              1
            
            ⁢
            
              x
              0
              ′
            
          
          +
          
            
              B
              1
            
            ⁢
            
              y
              0
              ′
            
          
          +
          
            C
            1
          
        
        
          
            
              A
              1
            
            ⁢
            
              x
              5
              ′
            
          
          +
          
            
              B
              1
            
            ⁢
            
              y
              5
              ′
            
          
          +
          
            C
            1
          
        
      
    
  




  
    
      
        with
        ⁢
        
          

        
        (
        
          
            
              
                x
                5
                ′
              
            
            
              
                y
                5
                ′
              
            
            
              1
            
          
        
        )
      
      T
    
    =
    
      
        
          
            RK
            
              -
              1
            
          
          ⁡
          
            (
            
              
                
                  
                    x
                    5
                  
                
                
                  
                    y
                    5
                  
                
                
                  1
                
              
            
            )
          
        
        T
      
      .
    
  



After the position (X2 Y2 Z2)T of the point V2 is determined, the position (X Y Z)T of any point on the surface F2 in the device coordinate O{circumflex over (X)}Ŷ{circumflex over (Z)} can be determined from the position of its corresponding point in the captured image. In particular, the position (Xi Yi Zi)T of the corner point Vi as shown in FIG. 8—for i=3 or 4—can be determined from the position (xi yi) of the corner point vi in the captured image as shown in FIG. 10. Specifically, the positions (X3 Y3 Z3)T and (X4 Y4 Z4)T can be determined from the following equations:



  
    
      
        (
        
          
            
              
                X
                i
              
            
            
              
                Y
                i
              
            
            
              
                Z
                i
              
            
          
        
        )
      
      T
    
    =
    
      
        
          (
          
            
              
                
                  x
                  i
                  ′
                
              
              
                
                  y
                  i
                  ′
                
              
              
                1
              
            
          
          )
        
        T
      
      ⁢
      
        Z
        2
      
      ⁢
      
        
          
            
              A
              2
            
            ⁢
            
              x
              2
              ′
            
          
          +
          
            
              B
              2
            
            ⁢
            
              y
              2
              ′
            
          
          +
          
            C
            2
          
        
        
          
            
              A
              2
            
            ⁢
            
              x
              i
              ′
            
          
          +
          
            
              B
              2
            
            ⁢
            
              y
              i
              ′
            
          
          +
          
            C
            2
          
        
      
    
  




  
    
      
        with
        ⁢
        
          

        
        (
        
          
            
              
                x
                i
                ′
              
            
            
              
                y
                i
                ′
              
            
            
              1
            
          
        
        )
      
      T
    
    =
    
      
        
          RK
          
            -
            1
          
        
        ⁡
        
          (
          
            
              
                
                  x
                  i
                
              
              
                
                  y
                  i
                
              
              
                1
              
            
          
          )
        
      
      T
    
  



for i=3 and 4.

In the method 200 as shown in FIG. 7, after the positions of at least four corner points of the box object in object space are determined at block 270, the volume of the box object 30 is determined at block 280. In some implementations, the volume of the box object 30 can be determined directly from the positions of the at least four corner points of the box object in object space. In some implementations, the box dimensions including the width, the length, and the height of the box object 30 are determined first before the volume of the box object 30 is calculated. In the method 200 as shown in FIG. 7, proceeding from block 280 to block 290, the volume of the box object is displayed on a display screen. In some implementations, after the positions of at least four corner points are determined at block 270, the width, the length, and the height of the box object 30 are determined and displayed on a display screen as shown in FIG. 4B.
FIGS. 11A-11B illustrate an alternative embodiment for determining the normal vector of a face of the box object in accordance with some embodiments. In FIG. 11A, a two-dimensional barcode 35 is placed on a face of the box object 30, and the corner points of the barcode 35 are used as reference points R0, R1, R2, and R3. In the captured image of the box object 30, as shown in FIG. 11B, the corner points of the barcode 35 are r0, r1, r2, and r3. The line connecting the points r0 and r1 is e01, the line connecting the points r3 and r2 is e32, the line connecting the points r3 and r0 is e30, and the line connecting the points r2 and r1 is e21. With multiple view geometry, the vanishing points be calculated from the cross product of two lines selected from lines {right arrow over (e)}01, {right arrow over (e)}32, {right arrow over (e)}30, and {right arrow over (e)}21. Specifically, {right arrow over (ω)}0={right arrow over (e)}01×{right arrow over (e)}32, and {right arrow over (ω)}1={right arrow over (e)}30×{right arrow over (e)}21. Vanishing line {right arrow over (λ)}0 can be calculated from the cross product of the vanishing points, that is, {right arrow over (λ)}0={right arrow over (ω)}0×{right arrow over (ω)}1. The normal vectors {right arrow over (N)}0 of the face F0 can be calculated from the vanishing lines {right arrow over (λ)}0 and the matrix K that maps a point (x y 1)T in a homogeneous coordinate to a point (x′ y′ 1)T in the device coordinate O{circumflex over (X)}Ŷ{circumflex over (Z)}.
Additionally, if the distance between any two of the four reference points R0, R1, R2, and R3 is known, the position (X Y Z)T of any point on the surface F0 in the device coordinate O{circumflex over (X)}Ŷ{circumflex over (Z)} can be determined from the position of its corresponding point in the captured image. If the normal vectors {right arrow over (N)}1 and {right arrow over (N)}2 of faces F1 and F2 are also determined independently, such as, from additional corner points of the box object, the dimensions and the volume of the box object can be determined. In one embodiment, vanishing point {right arrow over (ω)}2 can be determined from four corner points of the box object, such as, points V0, V2, V3, and V5—as shown in FIG. 8—in the captured image. In such embodiment, using the newly determined ω2 and previously determined vanishing points {right arrow over (ω)}0 and {right arrow over (ω)}1, the normal vectors {right arrow over (N)}1 and {right arrow over (N)}2 of faces F1 and F2 can be determined. If a fifth corner point (e.g., the point V1, or M0) in the captured image is also identified, all required dimensions for determining the volume of the box object 30 (e.g., the width, the length, and the height) can all be subsequently calculated.
In another embodiment, vanishing point {right arrow over (ω)}2 can be determined from four reference points on the face F1 or the face F2. For example, these four reference points can be the corner points of another shipping label (or another barcode) placed on the face F1 or the face F2. In this embodiment, four corner positions (e.g., the points V0, V1, V2, and V3—as shown in FIG. 8) of the box object 30 will be sufficient to determine the volume of the box object.
In another implementation as shown in FIG. 12, a shipping label 35 is placed on a face of the box object 30, and the corner points of the shipping label 35 are used as reference points, R0, R1, R2, and R3, for determining the normal vectors {right arrow over (N)}0 of the face F0, and for determining the position (X Y Z)T of any point on the surface F0 in the device coordinate O{circumflex over (X)}Ŷ{circumflex over (Z)}. In some implementations, not all of the reference points, R0, R1, R2, and R3 need to be the corner points of the shipping label (or the barcode); that is, one or more identifiable points on the shipping label (or the barcode) can also be used as the reference points. In some implementations, one or more corner points of the box object 30 can also be used as the reference points.
In the foregoing specification, specific embodiments have been described. However, one of ordinary skill in the art appreciates that various modifications and changes can be made without departing from the scope of the invention as set forth in the claims below. Accordingly, the specification and figures are to be regarded in an illustrative rather than a restrictive sense, and all such modifications are intended to be included within the scope of present teachings.
For example, people skilled in the art may find many methods to find the normal vectors {right arrow over (N)}0, {right arrow over (N)}1, and {right arrow over (N)}2 in FIG. 8 from the positions of the six corner points v0, v1, v2, v3, v4, and v5 in the captured image as shown in FIG. 10. People skilled in the art may also find many methods to find the normal vectors {right arrow over (N)}0, {right arrow over (N)}1, and {right arrow over (N)}2 in FIG. 8 from the positions of the six corner points v0, v1, v2, v3, v4, and m0 in the captured image as shown in FIG. 10. In addition, for the method 200 as described in FIG. 7, more than six corner points can be used to find the normal vectors {right arrow over (N)}0, {right arrow over (N)}1, and {right arrow over (N)}2, and the redundancy of the corner points can be used to improve the accuracy of the results based on some known methods, such as, curve fitting, parameter fitting, or result-averaging. Similarly, more than two reference points on a geometric mark (e.g., a shipping label, or a logo) on the surface of the box object can be used to improve the accuracy of the final results, such as, the accuracy of the volume or the box dimensions that are estimated from the captured image. Additionally, for the method as described with respect to FIGS. 11A-11B, more than four reference points on a geometric mark on the surface of the box object can be used to improve the accuracy of the final results, and more than five corner points of the box object can also be used to improve the accuracy of the final results.
The benefits, advantages, solutions to problems, and any element(s) that may cause any benefit, advantage, or solution to occur or become more pronounced are not to be construed as a critical, required, or essential features or elements of any or all the claims. The invention is defined solely by the appended claims including any amendments made during the pendency of this application and all equivalents of those claims as issued.
Moreover in this document, relational terms such as first and second, top and bottom, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. The terms “comprises,” “comprising,” “has”, “having,” “includes”, “including,” “contains”, “containing” or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises, has, includes, contains a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by “comprises . . . a”, “has . . . a”, “includes . . . a”, “contains . . . a” does not, without more constraints, preclude the existence of additional identical elements in the process, method, article, or apparatus that comprises, has, includes, contains the element. The terms “a” and “an” are defined as one or more unless explicitly stated otherwise herein. The terms “substantially”, “essentially”, “approximately”, “about” or any other version thereof, are defined as being close to as understood by one of ordinary skill in the art, and in one non-limiting embodiment the term is defined to be within 10%, in another embodiment within 5%, in another embodiment within 1% and in another embodiment within 0.5%. The term “coupled” as used herein is defined as connected, although not necessarily directly and not necessarily mechanically. A device or structure that is “configured” in a certain way is configured in at least that way, but may also be configured in ways that are not listed.
It will be appreciated that some embodiments may be comprised of one or more generic or specialized processors (or “processing devices”) such as microprocessors, digital signal processors, customized processors and field programmable gate arrays (FPGAs) and unique stored program instructions (including both software and firmware) that control the one or more processors to implement, in conjunction with certain non-processor circuits, some, most, or all of the functions of the method and/or apparatus described herein. Alternatively, some or all functions could be implemented by a state machine that has no stored program instructions, or in one or more application specific integrated circuits (ASICs), in which each function or some combinations of certain of the functions are implemented as custom logic. Of course, a combination of the two approaches could be used.
Moreover, an embodiment can be implemented as a computer-readable storage medium having computer readable code stored thereon for programming a computer (e.g., comprising a processor) to perform a method as described and claimed herein. Examples of such computer-readable storage mediums include, but are not limited to, a hard disk, a CD-ROM, an optical storage device, a magnetic storage device, a ROM (Read Only Memory), a PROM (Programmable Read Only Memory), an EPROM (Erasable Programmable Read Only Memory), an EEPROM (Electrically Erasable Programmable Read Only Memory) and a Flash memory. Further, it is expected that one of ordinary skill, notwithstanding possibly significant effort and many design choices motivated by, for example, available time, current technology, and economic considerations, when guided by the concepts and principles disclosed herein will be readily capable of generating such software instructions and programs and ICs with minimal experimentation.
The Abstract of the Disclosure is provided to allow the reader to quickly ascertain the nature of the technical disclosure. It is submitted with the understanding that it will not be used to interpret or limit the scope or meaning of the claims. In addition, in the foregoing Detailed Description, it can be seen that various features are grouped together in various embodiments for the purpose of streamlining the disclosure. This method of disclosure is not to be interpreted as reflecting an intention that the claimed embodiments require more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive subject matter lies in less than all features of a single disclosed embodiment. Thus the following claims are hereby incorporated into the Detailed Description, with each claim standing on its own as a separately claimed subject matter.

## Claims

1. A method comprising:
detecting light from a box object through an imaging lens arrangement with an imaging sensor having two-dimensional photosensitive elements to capture at least one image of the box object, wherein the box object has the shape of a rectangular solid;
identifying a geometric mark with fixed dimensions on the box object in the at least one image to find positions of at least two reference points of the geometric mark in the at least one image, wherein the at least two reference points are separated by a predetermined distance;
identifying corners of the box object in the at least one image;
determining, using a processor and based on the corners identified in the at least one image, normal vectors corresponding to orientations of faces of the box object;
determining, using the processor and based on (i) the normal vectors and (ii) the positions of the at least two reference points, positions of at least four corner points of the box object in an object space;
determining, using the processor and based on the positions of the at least four corner points in the object space, dimensions of the box object, with the box dimensions including the width, the length, and the height of the box object.

2. The method of claim 1, wherein the geometric mark includes one of a barcode, a logo, and a shipping label.

3. The method of claim 1, wherein the geometric mark includes two isolated point marks.

4. The method of claim 1, further comprising:
identifying edges of the box object based on the corners identified in the at least one image, wherein determining the normal vectors is further based on the identified edges.

5. The method of claim 1, further comprising:
finding positions of at least four reference points of the geometric mark in the at least one image.

6. The method of claim 1, further comprising:
finding positions of at least four reference points of the geometric mark in the at least one image; and
finding positions of at least four reference points of another geometric mark in the at least one image.

7. A method comprising:
detecting light from a box object through an imaging lens arrangement with an imaging sensor having two-dimensional photosensitive elements to capture at least one image of the box object, wherein the box object has the shape of a rectangular solid;
identifying at least two reference points on a surface of the box object to find positions of the at least two reference points in the at least one image, wherein the at least two reference points are two fixed points that are stationary in a coordinate fixed on the box object and the at least two reference points are separated by a predetermined distance on the surface of the box object, the predetermined distance being independent of geometric orientation of the box object;
identifying corners of the box object in the at least one image;
determining, using a processor and based on the corners of the box object, normal vectors indicative of face orientations corresponding to surfaces of the box object;
determining, using the processor and based on (i) the normal vectors, (ii) the positions of the at least two reference points, and (iii) the predetermined distance separating the at least two reference points, positions of at least four corner points of the box object in an object space;
determining, using the processor, dimensions of the box object based on the positions of the at least four corner points in the object space, with the box dimensions including the width, the length, and the height of the box object.

8. The method of claim 7, further comprising:
determining a mapping in a calibration process.

9. The method of claim 8, wherein the mapping is operative to establish a one-to-one corresponding relationship between a point in an image plane of the imaging sensor and a point in a reference plane in physical space.

10. The method of claim 8, wherein the mapping is a matrix that models intrinsic parameters of an imaging system that includes the imaging lens arrangement and the imaging sensor.

11. The method of claim 7, further comprising:
determining a volume of the box object based on the dimensions.

12. The method of claim 7, further comprising:
displaying the width, the length, and the height of the box object.

13. The method of claim 7, further comprising:
displaying at least one of the width, the length, and the height of the box object.

14. The method of claim 7, further comprising:
identifying at least six corners of the box object to find the positions of the at least six corners in the at least one image.

15. The method of claim 7, further comprising:
processing multiple images to identify the corners of the box object.

16. The method of claim 7, further comprising:
identifying edges of the box object based on the corners identified in the at least one image, wherein determining the normal vectors is further based on the identified edges.

17. The method of claim 7, further comprising:
processing the at least one image to identify at least one of the at least two reference points.

18. The method of claim 7, further comprising:
processing the at least one image to identify all of the at least two reference points.

19. The method of claim 7, further comprising:
displaying the at least one image of the box object on a display screen; and
identifying at least one corner of the box object with a user-selected position on the display screen.

20. The method of claim 7, further comprising:
displaying the at least one image of the box object on a display screen; and
identifying at least one of the reference points with a user-selected position on the display screen.

21. An apparatus comprising:
an imaging lens arrangement;
an imaging sensor having two-dimensional photosensitive elements configured to detect light from a box object through the imaging lens arrangement and configured to capture at least one image of the box object that has the shape of a rectangular solid;
a controller operative to decode a barcode and operative to determine dimensions of the box object by:
determining positions of the two reference points on a surface of the box object in the at least one image, the two reference points being spaced apart by a known distance;
identifying corners of the box object in the at least one image;
determining normal vectors of the box object based on positions of the corners in the at least one image;
determining positions of corners of the box in an object space based on (i) the normal vectors, (ii) the positions of the two reference points in the at least one image with the two reference points being at fixed positions in a coordinate fixed on the box object, and (iii) a predetermined mapping operative to establish a one-to-one corresponding relationship between a point in an image plane of the imaging sensor and a point in physical space.

22. The apparatus of claim 21, comprising:
a display screen operative to display the at least one image of the box object and to display a user-selected position specifying at least one corner of the box object in the at least one image.

23. The apparatus of claim 21, comprising:
a display screen operative to display the at least one image of the box object and to display a user-selected position specifying at least one of the two reference points in the at least one image.