Handheld size measurement device and size measurement method
By combining a TOF sensor and a camera with mathematical and geometric relationships, the problem of high computational load in handheld devices in offline scenarios is solved, providing a method for quickly measuring object size and avoiding the need to generate 3D images.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI SUMI TECH CO LTD
- Filing Date
- 2023-05-25
- Publication Date
- 2026-05-29
AI Technical Summary
In existing technologies, measuring the geometric dimensions of an object using a handheld device requires generating a 3D image, which is computationally expensive and unsuitable for applications in scenarios without internet access.
The system uses a TOF sensor to obtain physical distance, combines the camera's focal length and pixel distance, calculates the object size through mathematical geometric relationships, uses a semantic segmentation model to identify the target image, the interaction module determines the measurement start point and end point, and the processor calculates the physical size.
It enables quick and easy measurement of the external or internal dimensions of an object without internet connectivity, with simple calculations and no need to generate 3D images.
Smart Images

Figure CN116538926B_ABST
Abstract
Description
Technical Field
[0001] This invention relates primarily to the field of measurement technology, and more particularly to a handheld size measuring device and size measuring method. Background Technology
[0002] With the development of intelligent technologies, there is an increasing demand for measuring the geometric dimensions of objects by capturing images with handheld devices. For example, in the measurement of agricultural and livestock products, quality inspectors want to measure the geometric dimensions of fruits, vegetables, or poultry by taking images with handheld devices. A common method for dimension measurement is to use a monocular camera to generate 3D depth information, build a 3D image based on the 3D depth information, and calculate the distance between two points in space from the 3D image. However, generating 3D images with handheld monocular devices is computationally expensive and generally requires cloud service resources, making it unsuitable for applications without internet access.
[0003] Therefore, there is an urgent need for a handheld dimensional measurement device and method that requires minimal computation and does not require internet connectivity. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a handheld size measurement device and size measurement method, which solves the problem that the current size measurement method requires the generation of 3D images, which has too high a computational cost and is not suitable for handheld devices.
[0005] To address the aforementioned technical problems, this invention provides a handheld size measurement device, comprising: a camera for acquiring an image of an object to be measured; a TOF sensor for obtaining the physical distance from the camera to the object to be measured; an interaction module for determining the starting and ending points of the measurement of the object to be measured based on user operations on the target image and obtaining a calculation mode, the calculation mode including a length calculation mode and a diameter calculation mode; and a processor for identifying the target image of the object to be measured from the image, calculating the pixel distance from the starting point to the ending point, and calculating the physical dimensions of the object to be measured based on the focal length of the image, the pixel distance, the physical distance, and the calculation mode.
[0006] Optionally, the processor is further configured to: when the calculation mode is the length calculation mode, calculate the physical length of the object to be measured based on the ratio of the physical distance to the focal length and the pixel distance.
[0007] Optionally, the processor is further configured to calculate the physical length using the following formula:
[0008]
[0009] Wherein, P1 is the physical length, L1 is the pixel distance, D2 is the physical distance, and D1 is the focal length.
[0010] Optionally, the processor is further configured to: when the calculation mode is the diameter calculation mode, obtain the deviation distance between the midpoint of the starting point and the ending point and the light-sensitive center of the camera, and calculate the physical diameter of the object under test in the cross section where the starting point and the ending point are located based on the focal length, the physical distance, the deviation distance and the pixel distance.
[0011] Optionally, the processor is further configured to: calculate a first angle and a second angle based on the focal length, the offset distance, and the pixel distance; calculate the sum of the first angle and the second angle, denoted as a third angle; determine whether the absolute value of the cosine of the first angle is greater than or equal to the absolute value of the cosine of the third angle; if so, calculate the physical diameter based on the first angle, the third angle, and the physical distance.
[0012] Optionally, the processor is further configured to calculate the physical diameter using the following formula:
[0013]
[0014] Where r is the physical radius, the physical diameter is 2r, s is the physical distance, θ1 is the first angle, and α is the third angle.
[0015] Optionally, the processor includes: a semantic segmentation model for performing semantic segmentation on the image and outputting target image pixels and background region pixels; wherein the processor is further configured to import the target image pixels into a new layer to obtain the target image.
[0016] Optionally, the interaction module is further configured to: acquire a ranging line on the target image; and determine the starting point and the ending point based on the intersection of the ranging line and the boundary of the target image.
[0017] To address the aforementioned technical problems, this invention provides a size measurement method, comprising: acquiring an image of an object to be measured via a camera; acquiring the physical distance from the camera to the object to be measured based on Time-of-Flight (TOF) technology; identifying a target image of the object to be measured from the image; determining the starting point and ending point of the measurement of the object to be measured based on user operations on the target image; calculating the pixel distance from the starting point to the ending point; acquiring a calculation mode, the calculation mode including a length calculation mode and a diameter calculation mode; and calculating the physical size of the object to be measured based on the focal length of the image, the pixel distance, the physical distance, and the calculation mode.
[0018] Optionally, calculating the physical size of the object under test based on the focal length of the image, the pixel distance, the physical distance, and the calculation mode includes: when the calculation mode is the length calculation mode, calculating the physical length of the object under test based on the ratio of the physical distance to the focal length and the pixel distance.
[0019] Alternatively, the physical length can be calculated using the following formula:
[0020]
[0021] Wherein, P1 is the physical length, L1 is the pixel distance, D2 is the physical distance, and D1 is the focal length.
[0022] Optionally, calculating the physical size of the object under test based on the focal length of the image, the pixel distance, the physical distance, and the calculation mode includes: when the calculation mode is the diameter calculation mode, obtaining the deviation distance between the midpoint of the starting point and the ending point and the light-sensitive center of the camera, and calculating the physical diameter of the object under test in the cross section where the starting point and the ending point are located based on the focal length, the physical distance, the deviation distance, and the pixel distance.
[0023] Optionally, calculating the physical diameter of the object under test at the cross-section where the starting point and the ending point are located based on the focal length, the physical distance, the offset distance, and the pixel distance includes: calculating a first angle and a second angle based on the focal length, the offset distance, and the pixel distance; calculating the sum of the first angle and the second angle, denoted as a third angle; determining whether the absolute value of the cosine of the first angle is greater than or equal to the absolute value of the cosine of the third angle; if so, calculating the physical diameter based on the first angle, the third angle, and the physical distance.
[0024] Optionally, identifying the target image of the object to be tested from the image includes: inputting the image into a pre-trained semantic segmentation model, outputting target image pixels and background area pixels; and importing the target image pixels into a new layer to obtain the target image.
[0025] Optionally, obtaining the starting point and ending point of the measurement of the object to be measured based on the target image includes: obtaining a distance measuring line on the target image; and determining the starting point and the ending point based on the intersection of the distance measuring line and the boundary of the target image.
[0026] Compared with the prior art, the present invention has the following advantages:
[0027] This invention provides a handheld size measuring device and size measuring method, which calculates the external dimensions or internal diameter of the object to be measured by combining camera intrinsic parameters and mathematical geometric relationships. It does not require the generation of 3D images, the calculation is simple and does not require a network connection. Attached Figure Description
[0028] The accompanying drawings are included to provide a further understanding of this application; they are incorporated into and constitute a part of this application. The drawings illustrate embodiments of this application and, together with this specification, serve to explain the principles of the invention. In the drawings:
[0029] Figure 1 This is a system block diagram of a handheld size measuring device according to an embodiment of the present invention.
[0030] Figure 2 yes Figure 1 An application scenario diagram of a handheld size measuring device according to one embodiment.
[0031] Figure 3 This is a schematic diagram of the first state of an interactive module according to an embodiment of the present invention.
[0032] Figure 4 yes Figure 3 A schematic diagram of the corresponding geometric relationship.
[0033] Figure 5 This is a schematic diagram of the second state of the interaction module according to an embodiment of the present invention.
[0034] Figure 6 yes Figure 5 The corresponding calculation diagram of the object to be tested.
[0035] Figure 7 yes Figure 6 A schematic diagram of the corresponding geometric relationship.
[0036] Figure 8 This is a flowchart of a time-of-flight (TOF) based dimension measurement method according to an embodiment of the present invention. Detailed Implementation
[0037] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are merely some examples or embodiments of this application. For those skilled in the art, these drawings can be applied to other similar scenarios without creative effort. Unless obvious from the context or otherwise specified, the same reference numerals in the drawings represent the same structures or operations.
[0038] As indicated in this application and claims, unless the context clearly indicates otherwise, the words "a," "an," "an," and / or "the" are not specifically singular and may include plural forms. Generally speaking, the terms "comprising" and "including" only indicate the inclusion of explicitly identified steps and elements, which do not constitute an exclusive list, and the method or apparatus may also include other steps or elements.
[0039] Unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps described in these embodiments do not limit the scope of this application. It should also be understood that, for ease of description, the dimensions of the various parts shown in the drawings are not drawn to actual scale. Techniques, methods, and devices known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and devices should be considered part of the specification. In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values. It should be noted that similar reference numerals and letters in the following drawings denote similar items; therefore, once an item is defined in one drawing, it need not be further discussed in subsequent drawings.
[0040] In the description of this application, it should be understood that the orientation or positional relationship indicated by directional terms such as "front, back, up, down, left, right", "horizontal, vertical, horizontal" and "top, bottom" is usually based on the orientation or positional relationship shown in the accompanying drawings, and is only for the convenience of describing this application and simplifying the description. Unless otherwise stated, these directional terms do not indicate or imply that the device or element referred to must have a specific orientation or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on the scope of protection of this application; the directional terms "inner" and "outer" refer to the inner and outer contours relative to the outline of each component itself.
[0041] For ease of description, spatial relative terms such as "above," "on top of," "on the upper surface of," "above," etc., are used herein to describe the spatial positional relationship of a device or feature as shown in the figures to other devices or features. It should be understood that spatial relative terms are intended to encompass different orientations in use or operation beyond the orientation of the device as described in the figures. For example, if the device in the figures were inverted, a device described as "above" or "on top of" other devices or structures would subsequently be positioned as "below" or "under" other devices or structures. Thus, the exemplary term "above" can include both "above" and "below." The device may also be positioned in other different ways (rotated 90 degrees or in other orientations), and the spatial relative descriptions used herein will be interpreted accordingly.
[0042] Furthermore, it should be noted that the use of terms such as "first" and "second" to define components is merely for the purpose of distinguishing the corresponding components. Unless otherwise stated, these terms have no special meaning and therefore should not be construed as limiting the scope of protection of this application. In addition, although the terminology used in this application is selected from commonly known and used terms, some terms mentioned in this application's specification may have been chosen by the applicant according to his or her judgment, and their detailed meanings are explained in the relevant sections of this description. Moreover, this application should be understood not only through the actual terms used, but also through the meaning implied by each term.
[0043] Flowcharts are used in this application to illustrate the operations performed by the system according to embodiments of this application. It should be understood that the preceding or following operations are not necessarily performed in exact order. Instead, various steps can be processed in reverse order or simultaneously. Furthermore, other operations may be added to these processes, or one or more steps may be removed from these processes.
[0044] As mentioned in the background section, common dimensional measurement methods utilize a monocular camera to generate 3D depth information, create a 3D image based on this depth information, and calculate the distance between two points in space from the 3D image. However, generating 3D images with a handheld monocular device is computationally expensive, generally requiring cloud service resources, making it unsuitable for applications without internet access. To address this issue, this invention provides a handheld dimensional measurement device and method that combines camera intrinsic parameters and mathematical geometric relationships to calculate the external dimensions or internal diameter of the object being measured. This method eliminates the need to generate a 3D image, is computationally simple, and does not require an internet connection.
[0045] Figure 1 This is a system block diagram of a handheld dimensional measuring device according to an embodiment of the present invention. Figure 1As shown, the handheld size measuring device 100 includes a TOF sensor 11, a camera 12, an interaction module 13, and a processor 14.
[0046] TOF sensor 11 is used to obtain the physical distance from the camera to the object under test. TOF is an abbreviation for Time-of-Flight. A TOF sensor is a sensor that actively emits infrared light. It emits light pulses and receives the pulse signals reflected back from the object, and finally calculates the flight time of the light pulses to obtain the distance to the target object. Camera 12 is used to acquire images of the object under test. Camera 12 can be an RGB camera to acquire color images of the object under test. Processor 14 is used to acquire images of the object under test from camera 12, as well as the focal length of the image, and to identify the target image of the object under test from the image. Interaction module 13 is used to acquire the starting point and ending point of the measurement of the object under test based on the target image, and to acquire the calculation mode, including a length calculation mode and a diameter calculation mode. Processor 14 is also used to calculate the pixel distance from the starting point to the ending point, and to calculate the physical dimensions of the object under test based on the focal length, pixel distance, physical distance, and calculation mode.
[0047] Figure 2 yes Figure 1 An application scenario diagram of a handheld dimensional measuring device according to an embodiment. In this application scenario, the handheld dimensional measuring device 100 is used to measure the physical dimensions of an object A to be measured. The physical dimensions include external dimensions or internal diameter. Taking an object A as a cucumber as an example, the handheld dimensional measuring device 100 is used to measure the length of the cucumber and the diameter of its central cross-section. Figure 2 As shown, the handheld dimensional measuring device 100 includes a TOF sensor 11, a camera 12, an interaction module 13, and a processor 14 (see reference). Figure 1 Camera 12 is used to acquire images of the object under test A. During image acquisition, the TOF center alignment mark Z in the image is aligned as closely as possible to the center of the object under test A, and then the current image is captured and locked. TOF sensor 11 is used to obtain the physical distance D2 between camera 12 and the object under test A. Processor 14 is used to identify the target image A1 of the object under test A from the images acquired by camera 12 and sends the identified target image A1 to interaction module 13. Interaction module 13 includes a display component for displaying the target image A1.
[0048] Optionally, the processor includes a semantic segmentation model, which performs semantic segmentation on the image, outputting target image pixels and background pixels. The processor also imports the target image pixels into a new layer to obtain the target image. Semantic segmentation performs pixel-level classification of the semantic content of an image, thus representing the same object with the same pixel value. The semantic segmentation model can be pre-trained. Taking the scenario of measuring the size of agricultural and livestock products as an example, photos of different agricultural and livestock products are taken using the camera of the handheld measuring device or another device. During the shooting, a single object is taken as the main subject, occupying more than 50% of the frame. For example, an apple is counted as a single apple, a banana as a single banana or a bunch of bananas, and pigs, cows, sheep, etc., as a single animal. After shooting, a labeling tool is used to segment and label the main target, distinguishing the main subject from the background pixels into two categories. For example, the main subject is enclosed in a polygon; pixels inside the closed frame belong to the main subject pixels, and pixels outside the frame belong to the background pixels. The labeled data is input into an untrained semantic segmentation model for training, obtaining a model capable of segmenting the main agricultural and livestock products from the image. The model is quantized and pruned to optimize embedded deployment, stored on disk, and then deployed to a handheld dimensional measurement device.
[0049] The semantic segmentation model can be U-Net, FCN, SegNet, PSPNet, DeepLab v1 / v2 / v3 / v3+, etc., and this application does not impose any restrictions on it. Taking the U-Net model as an example, the U-Net model includes convolutional layers, ReLU layers, copy and crop layers, max pooling layers, and upconvolutional layers. The U-Net model can be divided into two parts: an encoder and a decoder. The encoder's role is to extract features from the original image and compress the feature image to a small, fixed size. The encoder consists of 4 pooling layers and 4 convolutional layers. Each pooling layer consists of a max pooling layer and the ReLU activation function, and each convolutional layer consists of a 3×3 convolutional kernel with a stride of 1 and padding of 1, and the ReLU activation function. The decoder's role is to upsample the features extracted by the encoder and restore the feature image to the original input size so that it can be paired with the target mask. The decoder consists of 4 convolutional layers and 4 dilation layers. Each convolutional layer consists of a 3×3 convolutional kernel, a stride of 1, padding of 1, and the ReLU activation function. Each dilation layer consists of a max-diffuse layer and the ReLU activation function.
[0050] The interaction module 13 includes an input component for determining the start and end points of the measurement of the object under test based on user operations on the target image of the object under test, and for obtaining the calculation mode, which includes a length calculation mode and a diameter calculation mode. In one example, the interaction module 13 is a touch screen. Figure 3This is a schematic diagram of the first state of an interactive module according to an embodiment of the present invention. Figure 3 As shown, the interaction module 13 displays the target image A1, calculation mode 1, and calculation mode 2. Calculation mode 1 can be a length calculation mode, and calculation mode 2 can be a diameter calculation mode. The user can slide their finger across the target image A1 to draw a distance measuring line N1, and then select calculation mode 1 or calculation mode 2. Taking calculation mode 1 as an example, the interaction module 13 acquires the distance measuring line N1 on the target image A1; it determines the starting point S1 and the ending point E1 based on the intersection of the distance measuring line N1 and the boundary of the target image A1. The interaction module 13 sends the starting point S1, the ending point E1, and calculation mode 1 to the processor.
[0051] The processor 14 is also used to calculate the pixel distance from the starting point to the ending point, obtain the focal length of the image, and calculate the physical size of the object under test based on the focal length, pixel distance, physical distance and calculation mode. Figure 4 yes Figure 3 A schematic diagram of the corresponding geometric relationship. For example... Figure 4 As shown, the processor calculates the pixel distance L1 from the starting point S1 to the ending point E1, obtains the focal length D1 during image capture, and the physical distance D2 obtained by the TOF sensor 11. Then, based on the geometric relationship of equal-ratio triangles, the physical length P1 of the object A to be measured can be calculated. Specifically, the physical length is calculated using the following formula:
[0052]
[0053] Where P1 is the physical length, L1 is the pixel distance, D2 is the physical distance, and D1 is the focal length.
[0054] At this point, the length L2 of the object to be measured, A (cucumber), can be determined.
[0055] Figure 5 This is a schematic diagram of the second state of an interactive module according to an embodiment of the present invention. Figure 5 As shown, the interaction module 13 displays the target image A1, calculation mode 1, and calculation mode 2. Calculation mode 1 can be a length calculation mode, and calculation mode 2 can be a diameter calculation mode. The user can slide their finger across the target image A1 to draw a distance measuring line N2, and then select calculation mode 1 or calculation mode 2. Taking calculation mode 2 as an example, the interaction module 13 acquires the distance measuring line N2 on the target image A1; it determines the starting point S2 and the ending point E2 based on the intersection of the distance measuring line N2 and the boundary of the target image A1. The interaction module 13 sends the starting point S2, the ending point E2, and calculation mode 2 to the processor 14.
[0056] Figure 6 yes Figure 5The corresponding calculation diagram of the object under test. When the calculation mode is calculation mode 2, i.e. diameter calculation mode, the processor is used to calculate the diameter D of the cylindrical cross-section formed by the plane formed by the drawn straight line and TOF and the object under test.
[0057] Figure 7 yes Figure 6 A schematic diagram of the corresponding geometric relationship. For example... Figure 7 As shown, in calculation mode 2, i.e., diameter calculation mode, the operator can only try to align the TOF center with the mark Z as closely as possible to the center of the object A being measured, but errors always exist. The processor is also used to obtain the deviation distance h between the midpoint C1 of the starting point S2 and the ending point E2 and the camera's photosensitive center O, where C2 is the center of the object A being measured. The pixel distance L2 from the starting point S2 to the ending point E2 is calculated. Based on the deviation distance h, the pixel distance L2, and the focal length D1, the first angle θ1 and the second angle θ2 can be calculated. Specifically, the first angle θ1 and the second angle θ2 can be calculated using the following trigonometric geometric formulas:
[0058]
[0059] Then, calculate the sum of the first angle θ1 and the second angle θ2:
[0060] α=θ1+θ2
[0061] Determine whether |cosθ1|>|cosα| holds true. If true, calculate the physical diameter using the following formula:
[0062]
[0063] Where r is the physical radius, the physical diameter D = 2r, and s is the physical distance, s = D CF θ1 is the first angle, and α is the sum of the first angle θ1 and the second angle θ2.
[0064] This invention provides a handheld size measuring device with a TOF sensor. This device combines camera intrinsic parameters and mathematical geometry principles to calculate the outer dimensions or inner diameter of agricultural products. This handheld size measuring device does not require the generation of 3D images, the calculation is simple, and it does not require an internet connection.
[0065] In some embodiments, the handheld dimensional measuring device further includes different forms of program storage units and data storage units, such as read-only memory (ROM) and random access memory (RAM), capable of storing various data files used for computer processing and / or communication, as well as possible program instructions executed by the processor. The processor executes these instructions to implement the main part of the method. The results of the processor processing are transmitted to the interactive module via a communication port and displayed on the interactive module. The handheld dimensional measuring device also includes an internal communication bus and a communication port. The internal communication bus enables data communication between components of the handheld dimensional measuring device. The communication port enables data communication between the handheld dimensional measuring device and external devices. The handheld dimensional measuring device also includes a power supply module. The power supply module is used to supply power to the handheld dimensional measuring device.
[0066] Figure 8 This is a flowchart of a Time-of-Flight (TOF) based dimensional measurement method according to an embodiment of the present invention. Figure 8 As shown, the dimension measurement method includes the following steps:
[0067] Step S81: Acquire an image of the object to be tested using a camera, and obtain the physical distance between the camera and the object to be tested based on TOF technology.
[0068] The camera can be an RGB camera, which captures color images of the object under test.
[0069] Time-of-Flight (TOF) technology is a technique that uses emitted light pulses to receive the reflected pulse signals from an object, and then calculates the time of flight of the light pulses to determine the distance to the target object. A TOF sensor can be placed near a camera to obtain the physical distance between the camera and the object being measured.
[0070] Step S82: Identify the target image of the object to be tested from the image.
[0071] Optionally, identifying the object to be tested from the image includes inputting the image into a pre-trained semantic segmentation model and outputting the target image pixels and background region pixels; importing the target image pixels into a new layer to obtain the target image.
[0072] Semantic segmentation models can be pre-trained. Taking the scenario of measuring the size of agricultural and livestock products as an example, a camera is used to take photos of different agricultural and livestock products. During the shooting, a single object is taken as the main subject, occupying more than 50% of the frame. For example, an apple is counted as a single apple, a banana as a single banana or a bunch of bananas, and pigs, cows, and sheep as a single animal. After shooting, annotation tools are used to segment and label the main target, distinguishing between the main subject and the background pixels. For example, the main subject is enclosed in a polygon; pixels inside the closed frame are considered main subject pixels, and pixels outside the frame are considered background pixels. The labeled data is then input into an untrained semantic segmentation model for training, resulting in a model capable of segmenting the main agricultural and livestock products from the image.
[0073] Step S83: Determine the starting point and ending point of the measurement of the object to be measured based on the user operation on the target image, and calculate the pixel distance from the starting point to the ending point.
[0074] Optionally, determining the starting and ending points of the measurement of the object to be measured based on user operations on the target image includes acquiring a distance measuring line on the target image; and determining the starting and ending points based on the intersection of the distance measuring line and the boundary of the target image.
[0075] Step S84: Obtain the calculation mode, which includes the length calculation mode and the diameter calculation mode.
[0076] Users can select a calculation mode through the interactive module, which receives the selected mode. The length calculation mode calculates the physical length of the object being measured. The diameter calculation mode calculates the physical diameter of the object being measured.
[0077] Step S85: Calculate the physical dimensions of the object to be measured based on the image's focal length, pixel distance, physical distance, and calculation mode.
[0078] Optionally, step S85 includes, when the calculation mode is length calculation mode, calculating the physical length of the object to be measured based on the ratio of physical distance to focal length and pixel distance. The physical length can be calculated using the following formula:
[0079]
[0080] Where P1 is the physical length, L1 is the pixel distance, D2 is the physical distance, and D1 is the focal length.
[0081] Optionally, step S85 includes, when the calculation mode is diameter calculation mode, obtaining the deviation distance between the midpoint of the starting point and the end point and the camera's photosensitive center, and calculating the physical diameter of the cross-section of the object under test at the starting point and the end point based on the focal length, physical distance, deviation distance, and pixel distance. For specific calculation methods, please refer to... Figure 7 ,
[0082] First, calculate the first angle θ1 and the second angle θ2 based on the focal length D1, the offset distance h, and the pixel distance L2. The first angle θ1 and the second angle θ2 can be calculated using the following trigonometric geometric formulas:
[0083]
[0084] Then, calculate the sum of the first angle θ1 and the second angle θ2:
[0085] α=θ1+θ2
[0086] Determine whether |cosθ1|≥|cosα| holds true. If true, calculate the physical diameter using the following formula:
[0087]
[0088] Where r is the physical radius, the physical diameter D = 2r, and s is the physical distance, s = D CF θ1 is the first angle, and α is the sum of the first angle θ1 and the second angle θ2.
[0089] The basic concepts have been described above. Obviously, for those skilled in the art, the above disclosure is merely illustrative and does not constitute a limitation of this application. Although not explicitly stated herein, those skilled in the art may make various modifications, improvements, and corrections to this application. Such modifications, improvements, and corrections are suggested in this application, and therefore remain within the spirit and scope of the exemplary embodiments of this application.
[0090] Furthermore, this application uses specific terms to describe embodiments of the application. For example, "an embodiment," "one embodiment," and / or "some embodiments" refer to a particular feature, structure, or characteristic related to at least one embodiment of the application. Therefore, it should be emphasized and noted that "an embodiment," "one embodiment," or "an alternative embodiment" mentioned twice or more in different locations in this specification do not necessarily refer to the same embodiment. In addition, certain features, structures, or characteristics in one or more embodiments of the application can be appropriately combined.
[0091] Some aspects of this application can be executed entirely by hardware, entirely by software (including firmware, resident software, microcode, etc.), or by a combination of hardware and software. The aforementioned hardware or software may be referred to as a "data block," "module," "engine," "unit," "component," or "system." The processor may be one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DAPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, or combinations thereof. Furthermore, aspects of this application may manifest as computer products residing in one or more computer-readable media, including computer-readable program code. For example, computer-readable media may include, but are not limited to, magnetic storage devices (e.g., hard disks, floppy disks, magnetic tapes, etc.), optical discs (e.g., compressed CDs, digital multifunction DVDs, etc.), smart cards, and flash memory devices (e.g., cards, sticks, key drives, etc.).
[0092] A computer-readable medium may contain a propagated data signal containing computer program code, for example, on baseband or as part of a carrier wave. This propagated signal may take various forms, including electromagnetic, optical, and so on, or suitable combinations thereof. A computer-readable medium can be any computer-readable medium other than a computer-readable storage medium, which can be connected to an instruction execution system, apparatus, or device to enable communication, propagation, or transmission of a program for use. The program code located on the computer-readable medium can be propagated through any suitable medium, including radio, cable, fiber optic cable, radio frequency signals, or similar media, or any combination of the above media.
[0093] Similarly, it should be noted that, in order to simplify the description of the present application and thus aid in the understanding of one or more embodiments of the invention, the foregoing description of the embodiments of the present application sometimes combines multiple features into a single embodiment, drawing, or description thereof. However, this disclosure method does not imply that the subject matter of the application requires more features than those mentioned in the claims. In fact, the embodiments contain fewer features than all the features of the single embodiments disclosed above.
[0094] In some embodiments, numbers describing the quantity of components and attributes are used. It should be understood that such numbers used in the description of embodiments are modified in some examples with the terms "approximately," "approximately," or "generally." Unless otherwise stated, "approximately," "approximately," or "generally" indicates that the numbers are allowed to vary by ±20%. Accordingly, in some embodiments, the numerical parameters used in the specification and claims are approximate values, which may be changed depending on the characteristics required by individual embodiments. In some embodiments, numerical parameters should take into account specified significant digits and employ a general method of digit reservation. Although the numerical ranges and parameters used to confirm their breadth of scope in some embodiments of this application are approximate values, in specific embodiments, such values are set as precisely as feasible.
[0095] Although this application has been described with reference to specific embodiments, those skilled in the art should recognize that the above embodiments are only used to illustrate this application, and various equivalent changes or substitutions can be made without departing from the spirit of this application. Therefore, any changes or modifications to the above embodiments within the essential spirit of this application will fall within the scope of the claims of this application.
Claims
1. A handheld dimensional measuring device, characterized in that, include: A camera is used to capture images of the object being tested. A TOF sensor is used to obtain the physical distance between the camera and the object under test; An interaction module is used to determine the starting point and ending point of the measurement of the object under test based on user operations on the target image of the object under test, and to obtain the calculation mode, which includes a length calculation mode and a diameter calculation mode. The processor is configured to identify the target image of the object under test from the image and send it to the interaction module, and to calculate the pixel distance from the starting point to the ending point, and to calculate the physical size of the object under test based on the focal length of the image, the pixel distance, the physical distance and the calculation mode; The processor is further configured to: when the calculation mode is the diameter calculation mode, obtain the deviation distance between the midpoint of the starting point and the ending point and the light-sensitive center of the camera, and calculate the physical diameter of the object under test in the cross section where the starting point and the ending point are located based on the focal length, the physical distance, the deviation distance and the pixel distance.
2. The device as described in claim 1, characterized in that, The processor is also used for: When the calculation mode is the length calculation mode, the physical length of the object to be measured is calculated based on the ratio of the physical distance to the focal length and the pixel distance.
3. The device as described in claim 2, characterized in that, The processor is also configured to calculate the physical length using the following formula: in, The physical length, The pixel distance, The physical distance, The focal length is denoted as .
4. The device as described in claim 1, characterized in that, The processor is also configured to calculate the physical diameter using the following formula: Where r is the physical radius, the physical diameter is 2r, and s is the physical distance. From the first angle, This is from the third perspective.
5. The device as described in any one of claims 1 to 4, characterized in that, The processor includes: a semantic segmentation model for performing semantic segmentation on the image and outputting target image pixels and background area pixels; wherein the processor is also used to import the target image pixels into a new layer to obtain the target image.
6. The device according to any one of claims 1 to 4, characterized in that, The interaction module is also used for: Obtain the ranging line on the target image; The starting point and the ending point are determined based on the intersection of the ranging line and the boundary of the target image.
7. A method for measuring dimensions, characterized in that, include: The image of the object to be tested is acquired by a camera, and the physical distance from the camera to the object to be tested is obtained based on TOF technology. Identify the target image of the object to be tested from the image; The starting point and ending point of the measurement of the object under test are determined based on the user operation on the target image, and the pixel distance from the starting point to the ending point is calculated. Obtain the calculation mode, which includes a length calculation mode and a diameter calculation mode; The physical dimensions of the object under test are calculated based on the focal length of the image, the pixel distance, the physical distance, and the calculation mode. The calculation of the physical size of the object under test based on the focal length of the image, the pixel distance, the physical distance, and the calculation mode includes: when the calculation mode is the diameter calculation mode, obtaining the deviation distance between the midpoint of the starting point and the ending point and the light-sensitive center of the camera, and calculating the physical diameter of the object under test in the cross section where the starting point and the ending point are located based on the focal length, the physical distance, the deviation distance, and the pixel distance.
8. The method as described in claim 7, characterized in that, Calculating the physical dimensions of the object under test based on the focal length of the image, the pixel distance, the physical distance, and the calculation mode includes: When the calculation mode is the length calculation mode, the physical length of the object to be measured is calculated based on the ratio of the physical distance to the focal length and the pixel distance.
9. The method as described in claim 8, characterized in that, The physical length is calculated using the following formula: in, The physical length, The pixel distance, The physical distance, The focal length is denoted as .
10. The method as described in claim 7, characterized in that, The physical diameter is calculated using the following formula: Where r is the physical radius, the physical diameter is 2r, and s is the physical distance. From the first angle, This is from the third perspective.
11. The method as described in claim 7, characterized in that, Identifying the target image of the object to be tested from the image includes: The image is input into a pre-trained semantic segmentation model, which outputs the target image pixels and background region pixels. The target image pixels are imported into a new layer to obtain the target image.
12. The method as described in claim 7, characterized in that, Determining the start and end points of the measurement of the object under test based on user actions on the target image includes: Obtain the ranging line on the target image; The starting point and the ending point are determined based on the intersection of the ranging line and the boundary of the target image.