A computer-system-implemented method for generating at least one descriptor for an object, the method comprising: receiving extracted line segments aligned with edge pixels associated with the object in an image (operation 112) or alternatively receiving the image that includes the object (operation 110) and extracting line segments aligned with the edge pixels associated with the object (operation 110); determining orientations for the line segments (operation 116); identifying a subset of the line segments (operation 118), wherein the subset includes k of the line segments that are proximate to a given line segment in the line segments; using the computer system, calculating pairs of geometric primitives representing relative displacement and relative orientation of pairs of line segments in the subset (operation 120), and generating the at least one descriptor for the object (operation 122) by computing a 2-dimensional histogram of the pairs of geometric primitives based on cells defined by quantization values, wherein a given pair of geometric primitives (514, 516) for a given pair of line segments (510, 512) in the subset includes a first angle, characterized in that said given pair of geometric primitives (514, 516) includes said first angle at a location on a first line segment in the given pair of line segments (510, 512), and a second angle at a location on the second line segment, the first angle being an angle between the first line segment and a connecting line segment, which couples said first line segment and said second line segment, and the second angle being an angle between the second line segment and the connecting line segment; and said quantization values are angular quantization values. receiving extracted line segments aligned with edge pixels associated with the object in an image (operation 112) or alternatively receiving the image that includes the object (operation 110) and extracting line segments aligned with the edge pixels associated with the object (operation 110); determining orientations for the line segments (operation 116); identifying a subset of the line segments (operation 118), wherein the subset includes k of the line segments that are proximate to a given line segment in the line segments; using the computer system, calculating pairs of geometric primitives representing relative displacement and relative orientation of pairs of line segments in the subset (operation 120), and generating the at least one descriptor for the object (operation 122) by computing a 2-dimensional histogram of the pairs of geometric primitives based on cells defined by quantization values, wherein a given pair of geometric primitives (514, 516) for a given pair of line segments (510, 512) in the subset includes a first angle, characterized in that said given pair of geometric primitives (514, 516) includes said first angle at a location on a first line segment in the given pair of line segments (510, 512), and a second angle at a location on the second line segment, the first angle being an angle between the first line segment and a connecting line segment, which couples said first line segment and said second line segment, and the second angle being an angle between the second line segment and the connecting line segment; and said quantization values are angular quantization values.