This application claims priority to Chinese Patent Application No. 201410460655.7 filed on Sep. 11, 2014, the contents of which are incorporated by reference herein.
The subject matter herein generally relates to image technology, and particularly to a computing device and a method for calculating an area of an outline of an object.
There is a specific formula for calculating an area of a regular shape, such as a triangle, a cube, a rectangle, a circle or the like. However, there may not exist a specific formula for calculating an area of an irregular shape.
Many aspects of the disclosure can be better understood with reference to the following drawings. The components in the drawings are not necessarily drawn to scale, the emphasis instead being placed upon clearly illustrating the principles of the disclosure. Moreover, in the drawings, like reference numerals designate corresponding parts throughout the several views.
It will be appreciated that for simplicity and clarity of illustration, where appropriate, reference numerals have been repeated among the different figures to indicate corresponding or analogous elements. In addition, numerous specific details are set forth in order to provide a thorough understanding of the embodiments described herein. However, it will be understood by those of ordinary skill in the art that the embodiments described herein can be practiced without these specific details. In other instances, methods, procedures, and components have not been described in detail so as not to obscure the related relevant feature being described. The drawings are not necessarily to scale and the proportions of certain parts may be exaggerated to better illustrate details and features. The description is not to be considered as limiting the scope of the embodiments described herein.
Several definitions that apply throughout this disclosure will now be presented. The term “module” refers to logic embodied in computing or firmware, or to a collection of software instructions, written in a programming language, such as, Java, C, or assembly. One or more software instructions in the modules may be embedded in firmware, such as in an erasable programmable read only memory (EPROM). The modules described herein may be implemented as either software and/or computing modules and may be stored in any type of non-transitory computer-readable medium or other storage device. Some non-limiting examples of non-transitory computer-readable media include CDs, DVDs, BLU-RAY™, flash memory, and hard disk drives. The term “comprising” means “including, but not necessarily limited to”; it specifically indicates open-ended inclusion or membership in a so-described combination, group, series and the like.
In at least one embodiment, the storage device 12 can be an internal storage device, such as a flash memory, a random access memory (RAM) for temporary storage of information, and/or a read-only memory (ROM) for permanent storage of information. The storage device 12 can also be an external storage device, such as an external hard disk, a storage card, or a data storage medium. The at least one processor 14 can be a central processing unit (CPU), a microprocessor, or other data processor chip that performs functions of the computing device 1.
Referring to
At block 301, a obtaining module obtains an image of an object from an measurement machine. In at least one embodiment, the object is positioned on a platform of the measurement machine, and a CCD of the measurement machine captures the image of the object and sends the image of the object to a computing device.
At block 302, the obtaining module obtains outline points of the object from the image of the object. In at least one embodiment, the obtaining module processes the image of the object using a binary processing method to generate pixel gray values of the image of the object. The obtaining module further obtains the outline points of the object using the pixel gray values of the image of the object. For example, if a pixel gray value of the image of the object exceeds a predetermined pixel gray value (e.g., 155) which is at a range of [0, 255], the pixel gray value of the image of the object is determined as an outline point.
At block 303, a triangulation module triangulates the outline points of the object using a plurality of triangles and generates an outline of the object. In at least one embodiment, the outline points of the object can be represented by the plurality of triangles after triangulation. Each triangle is determined to be qualified when the triangle meets two following conditions: (1) there are no points inside a circumcircle of the triangle. For example, as shown in
At block 304, a calculation module calculates an area of an outline of the object according to an area of each triangle. In at least one embodiment, the area of the outline of the object is a sum area of all triangles. The area of the outline of the object is calculated by a formula as follows:
where n is an amount of all triangles, A is an area of the triangle. A is calculated by a formula as follows:
where ai is a first line of the ith triangle, bi is a second line of the ith triangle, and ci is a third line of the triangle, the triangle consists of the first line, the second line and the third line. As shown in
The embodiments shown and a described above are only examples. Even though numerous characteristics and advantages of the present technology have been set forth in the foregoing description, together with details of the structure and function of the present disclosure, the disclosure is illustrative only, and changes may be made in the detail, including in particular the matters of shape, size and arrangement of parts within the principles of the present disclosure, up to and including the full extent established by the broad general meaning of the terms used in the claims.
Number | Date | Country | Kind |
---|---|---|---|
201410460655.7 | Sep 2014 | CN | national |