Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The two small-sized precision measuring tools, namely the vernier caliper and the screw micrometer, have small sizes and are convenient to carry, and the measuring precision can reach +/-0.02 mm and +/-0.01 mm respectively; the measuring requirements under the ordinary condition can be met, but under the condition that the shape of a workpiece or a part to be measured is peculiar and the area to be measured cannot be measured by the two tools, a large-scale measuring instrument such as a two-dimensional image measuring instrument is generally needed.
The method and the device have the advantages that the secondary image measurement technology is combined into the mobile terminal, the secondary image measurement technology is integrated, the measurement accuracy is high, the measurement mode is flexible, and the mobile terminal is convenient to carry.
Referring to the schematic flow chart of the measurement method shown in fig. 1, a first embodiment of the present invention provides a two-dimensional image measurement method based on a mobile terminal, wherein the mobile terminal includes but is not limited to a mobile terminal such as a smart phone and a tablet computer; the mobile terminal supports operating systems such as IOS and android, and has camera shooting and touch display functions; the measuring method specifically comprises the following steps:
step 101, calling a camera unit to obtain a preview image of an object to be detected;
in general, the called camera unit is a rear camera of the mobile terminal, but calling the front camera is not excluded, or a switching module is provided for switching the front camera and the rear camera. The high-definition preview image of the object to be detected can be formed by means of the high pixel and extremely high magnification of the existing mobile terminal and the function that the special macro camera can magnify the workpiece to be detected by dozens of times or even dozens of times.
Specifically, the camera comprises a plurality of lenses inside, and the imaging of the image is realized by utilizing the principle of lens imaging; images are recorded and transmitted by the photosensitive chip and associated circuitry. Theoretically, the lens can be composed of only one lens, but for optical reasons, imaging of a single lens inevitably has a series of aberration problems such as chromatic aberration, spherical aberration, coma, astigmatism and the like, and particularly in the edge portion, imaging is poor. The combination of the plurality of lenses can correct aberrations to some extent.
Secondly, many lenses are also focused by changing the position of the lens. The general mobile phone camera changes the focal length by controlling the whole lens to move back and forth through the VCM, and is mainly divided into the following three types:
1. standard lens: taking the interchangeable lens suitable for a 35mm single-lens reflex camera as an example (36 x 24mm photosensitive element), the standard lens generally refers to a photographic lens with a focal length between 40 and 55 mm, which is the most basic one of all lenses.
2. Wide-angle lens: the focal length is shorter than that of the standard lens, and the visual angle is larger than that of the standard lens. The wide-angle lens is basically characterized in that: the visual angle of the lens is large, and the visual field is wide. The distance sensing camera has the characteristics of exaggeration of distance, wide focusing range and the like. When the wide-angle camera is used, objects in front of eyes can be enlarged, objects at far away can be reduced, and images around the camera are easy to distort. The method is widely applied to shooting of large-scene landscape photographic works, and can increase the spatial depth of photographic pictures.
3. Telephoto lens: long focal length, looking far away. The long focal length lens is generally classified into three stages, and 135mm or less is called a middle focal length, which is often used to capture a human image. 135mm and 500mm are called long focal length. The super-long focal length of 500mm or more is suitable for photographing a distant scene. Such as close-up on the court and shooting of wild animals, the ultra-long focal length lens is very useful because the lens cannot be close to the shot object.
The flow chart of the image pickup unit for generating the preview image is shown in fig. 2, light enters the lens, and the image is displayed on the display screen after a series of conversion by the sensor, the analog-to-digital converter, the ISP and the image processor.
It should be noted that, after the camera unit is started, that is, the camera is started, light supplement is performed based on the environment state where the camera is located, for example, when the environment is dim, an LED lighting lamp provided in the mobile terminal may be used for lighting, the camera pixels provided in the current mobile terminal (including but not limited to a mobile phone, a tablet computer, etc.) are higher and higher, the zoom capability is higher and higher, and after lighting by using ambient light or an LED provided in an electronic device, a high-definition real-time preview image of the object to be measured is obtained through a series of operations and steps such as a complicated zoom and a software compensation algorithm in the camera lens and displayed on the screen.
And 102, establishing an image coordinate system based on the preview image, and establishing a scale according to the imaging proportion between the preview image and the object to be measured.
Step 102 includes two aspects, the first aspect is to determine an origin and a reference direction of a coordinate system, specifically: the acquired two-dimensional high-definition preview image is displayed on a screen of the mobile terminal, a rectangular coordinate system is established, as one implementation manner of this embodiment, a fixed image coordinate system is established for a display area set on the screen of the mobile terminal, an origin of the fixed rectangular coordinate system is located at a lower left corner of the display screen, and the displayed high-definition preview image is completely located in a first quadrant of the coordinate system. And respectively acquiring coordinate parameters of points to be measured. As another implementation manner of this embodiment, the origin of the coordinate system may be set actively according to the measurement requirement, and in an implementation manner, the coordinate of the point to be measured that needs to be obtained may be used as the origin of the coordinate system, so as to obtain the coordinate parameters of other points.
And on the other hand, a scale is established according to the imaging proportion between the preview image and the object to be measured. In essence, the scale corresponds to the actual size of the object to be measured and is used to indicate the measurement unit of the current image coordinate system, for example, the measurement unit of the current scale is cm, the coordinates of the measurement point are (10, 20), i.e. the distance from the measurement point to the coordinate origin in the X-axis direction is 10cm, and the distance from the measurement point to the coordinate origin in the Y-axis direction is 20 cm. The mobile terminal screen displays the acquired high-definition preview image, the preview image needs to be further enlarged or reduced to acquire clear structural features, and the scale is synchronously adjusted corresponding to the enlarged or reduced preview image; that is, regardless of how many times the preview image is zoomed in or out, the scale of the scale at this moment is always 1: 1 reflects the actual size of the object to be measured. Specifically, the scale adaptively adjusts the measuring unit and the scale of the scale according to the imaging proportion between the preview image and the object to be measured, so that the scale displayed by the scale, the coordinate system, the provided data parameters and the size of the real object are kept consistent.
For example, when 1: when a workpiece with the length of 100mm is shot in a 1-scale (namely, an image is not enlarged or reduced), the graduated scale takes a cm scale as a measurement unit based on the influence of screen size factors, only numbers such as 1, 2, … … and the like are marked on an interface, the numbers represent 1cm, 2cm, … … and the like, only scales on the mm length have no numbers, and the situation that the reading is influenced by the excessively dense numbers is avoided; when the scale on the interface is enlarged, the display precision of the scale on the interface is improved, when the scale is large enough, the scale in mm is taken as a measurement unit, the numbers of 1, 2 and the like on the interface represent 1mm, 2mm, … … and the like, and only the scale on the length of dmm (silk meters) has no number.
And 103, acquiring and recording coordinate information of the first point to be measured and the second point to be measured on the object to be measured.
Generally, the dimension measurement of an object to be measured is not more than the measurement of the length, width, height and distance between two points of the object, and by utilizing a rectangular coordinate system established in a screen of a mobile terminal, after obtaining a first point coordinate to be measured and a second point coordinate to be measured of the object to be measured, distance information can be obtained through calculation of a corresponding algorithm.
The method comprises the following steps that a movable capturing cursor is further arranged in a screen, a point to be measured can be captured by the capturing cursor arranged on the screen, and when the capturing cursor is detected to be in an image coordinate system, coordinate information of the position where the current capturing cursor is located can be displayed in real time in the screen; preferably, the capture cursor is set as a cross cursor, the user receives a movement instruction acting on the capture cursor, the position of a required point to be measured is determined by moving the cross cursor on the screen of the mobile terminal, the coordinate information of the point to be measured is acquired, after the cross cursor acquires the coordinate information of the required point, the signal of the point is stored and the coordinate value of the point is displayed on the screen of the mobile terminal through coordinate confirmation, then the cross cursor is moved to the next measurement point and confirmed, and meanwhile the coordinate information of the point is displayed on the screen of the mobile terminal.
And 104, calculating the distance between the first point to be measured and the second point to be measured according to the coordinate information of the first point to be measured and the coordinate information of the second point to be measured.
Wherein calculating the distance between the first point to be measured and the second point to be measured comprises: calculating to obtain a first distance between the first point to be measured and the second point to be measured in the X-axis direction according to the X-axis coordinate of the first point to be measured and the X-axis coordinate of the second point to be measured; calculating according to the Y-axis coordinate of the first point to be measured and the Y-axis coordinate of the second point to be measured to obtain a second distance in the Y-axis direction; and calculating the linear distance between the first point to be measured and the second point to be measured according to the first distance and the second distance.
As one implementation manner in this embodiment, when coordinate parameters of a first point to be measured and a second point to be measured are acquired, the calculation module automatically processes the relevant coordinate data, and outputs distance information between the first point to be measured and the second point to be measured.
As another implementation manner in this embodiment, the user may obtain coordinate information of a plurality of points through the cross cursor, and during calculation, select a coordinate parameter of a desired coordinate point for calculation. For example, after a coordinate system is established, coordinate information of a point a, a point B, a point C, a point E is acquired, wherein the point a, the point B, the point C, the point D and the point E can be combined with each other to form a first point to be measured and a second point to be measured of a segment to be measured, a user can select the point a and the point B, and distance information between the point a and the point B is calculated and displayed; the method can also be suitable for the application needing to measure the size data simultaneously.
The following examples are used in the measurement of specific product dimensions:
as shown in the schematic application structure of fig. 3, a linear distance between the screw columns a and B in the workpiece needs to be measured. Adjusting the preview image to be detected to the optimal display proportion in the preview image, setting the center of a screw column A as a coordinate origin, determining the screw column A as a first point to be detected, setting the X, Y axis coordinate value of the screw column A as (0, 0), displaying the coordinate value of the screw column A on a screen of a mobile terminal, then moving a cross cursor, positioning the cross cursor at the center position of the screw column B, confirming that the position is a second point to be detected, displaying the coordinate (60, 80) of the screw column B on the screen by the mobile terminal, and automatically calculating the distance X between the screw column A (0, 0) and the screw column B (60, 80) in the X-axis direction
B-A60-0-60, and a distance Y in the Y-axis direction
B-A80-0-80; and the linear distance between the screw column A and the screw column B
And the above-mentioned X is reacted
B-A、Y
B-AAnd L
ABIs displayed on the screen of the mobile terminal, and at this time, the displayed vertical unit is the same as the measurement unit of the scale. If "-" appears in front of the coordinate value, it can be understood as being located in the opposite direction of the coordinate reference.
The application structure diagram shown in fig. 4 is used for measuring the linear distance AB between the plane of the point a and the plane of the point B, so as to better embody the advantages of the present patent technology compared with the conventional measuring tool. In this embodiment, the horizontal distance between the AB needs to be measured, not the diagonal distance; since the heights of the points AB and AB are different, the horizontal distance cannot be measured by a caliper, and if the height of the point B extends to the point A horizontally, the measured size is larger than the actual size due to the draft.
Firstly, amplifying an image point A to be measured to be large enough, and measuring the size of a first point to be measured: the coordinate system origin (0, 0) of the coordinate system of the X and Y coordinate values of the root of the angle R at the top end of the outer side of the surrounding bone;
balancing the image to a point B to be measured, positioning the Y axis of the cross cursor at the position (the root of the angle R outside the surrounding bone) of the point B to be measured, wherein the coordinate data is displayed as B (-123, -25), and the distance 25 in the Y axis direction is the horizontal distance of the two points AB to be measured; when the scale is measured in mm, the distance between AB is 25 mm.
In conclusion, compared with the prior art, the implementation of the scheme of the invention solves the requirement of high-precision dimension measurement of practitioners in the precision plastic and hardware industries, makes up the respective defects of small precision measuring tools such as vernier calipers and screw micrometers and large measuring instruments such as image measuring instruments, and can easily complete the measurement operation by means of one mobile terminal and meet the micron-grade precision requirement no matter how complex the shape of the workpiece is.
A second embodiment of the present invention provides a two-dimensional image measuring device based on a mobile terminal, which is used to implement the measuring method in the first embodiment, and as shown in the schematic structural diagram of the measuring device shown in fig. 5, the measuring device includes:
the acquisition module 51 is used for calling a camera unit to acquire a preview image of the object to be detected;
the establishing module 52 is configured to establish an image coordinate system based on the preview image, and establish a scale according to an imaging ratio between the preview image and the object to be measured; the scale is used for displaying a measurement unit of a current image coordinate system;
the recording module 53 is configured to acquire and record coordinate information of a first point to be measured and a second point to be measured on the object to be measured;
and the calculating module 54 is configured to calculate a distance between the first point to be measured and the second point to be measured according to the coordinate information of the first point to be measured and the coordinate information of the second point to be measured.
Specifically, the obtaining module 51 calls a camera unit, the camera unit is a camera assembly carried by the mobile terminal, after the camera unit is turned on, the camera unit performs light supplement based on an environmental condition and by using an lED lamp carried by the mobile terminal, and further performs focusing and lens compensation until a high-definition preview image of the object to be measured is obtained, and if the preview image is enlarged or reduced, focusing again is required.
The establishing module 52 is configured to display an image coordinate system, a ruler and a preview image on a screen of the mobile terminal, where the image coordinate system may be a fixed image coordinate system or an image coordinate system established according to a point to be measured, the screen of the mobile terminal is a touch-controllable display screen, and when the preview image is enlarged or reduced, the ruler is synchronously adjusted corresponding to the enlarged or reduced preview image; the scale regulation comprises the self-adaptive regulation of a metering unit and the self-adaptive regulation of a scale distance, and the corresponding coordinate coefficient value unit is the same as the scale unit, namely the scale displayed by the scale, the coordinate system and the provided data parameters are consistent with the size of a real object.
The recording module 53 is specifically configured to record coordinate information of a first point to be measured and the second point to be measured captured by a capture cursor, where the capture cursor is disposed on a screen of the mobile terminal and can move on the screen of the mobile terminal. It should be noted that, during the cursor moving process, the coordinate data of the current cursor point may be displayed on the screen of the mobile terminal in real time.
The calculating module 54 is specifically configured to calculate and obtain a first distance between the first point to be measured and the second point to be measured in the X-axis direction according to the obtained X-axis coordinate of the first point to be measured and the obtained X-axis coordinate of the second point to be measured; calculating according to the Y-axis coordinate of the first point to be measured and the Y-axis coordinate of the second point to be measured to obtain a second distance in the Y-axis direction; and calculating the linear distance between the first point to be measured and the second point to be measured according to the first distance and the second distance.
Compared with the prior art, the measuring device provided by the invention solves the requirement of high-precision size measurement of practitioners in the precision plastic and hardware industries, makes up the respective defects of small precision measuring tools such as vernier calipers and screw micrometers and large measuring instruments such as image measuring instruments, and can easily complete the measurement operation and meet the micron-grade precision requirement by means of a mobile terminal no matter how complex the shape of a workpiece is.
In the present invention, the terms "first", "second" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present invention, "a plurality" means two or more unless specifically defined otherwise.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.