Disclosure of Invention
In view of the above problems, the present invention provides a size measuring and calculating method, device, image detecting apparatus and readable storage medium to accurately and quickly measure and calculate the actual size of a target object, thereby improving the user experience.
In order to achieve the purpose, the invention adopts the following technical scheme:
a dimension measuring and calculating method is applied to image detection equipment provided with a preset number of laser emitting devices, and comprises the following steps:
controlling the laser emitting device to emit laser to a target object to form a laser pattern;
collecting a measurement and calculation image comprising the laser graph and the target object through the image detection equipment;
and calculating the actual size of the target object by using the measuring and calculating image through a preset algorithm.
Preferably, in the dimension measuring and calculating method, the laser emitting device includes at least two point-like laser emitters which emit light in parallel, and a distance sensor disposed on each of the point-like laser emitters, and the laser pattern is a laser spot.
Preferably, in the size measuring and calculating method, the calculating an actual size of the target object by a preset algorithm using the measurement image includes:
acquiring the projection distance between the point-shaped laser emitter and the corresponding laser point by using the distance sensor;
acquiring pixel distances between the laser points in the measurement and calculation image and pixel sizes of the target object in the measurement and calculation image;
and calculating the actual size of the target object by using the projection distance, the pixel size and the actual distance between the point-shaped laser emitters.
Preferably, in the dimension measuring and calculating method, the formula of the preset algorithm includes:
in the formula (I), the compound is shown in the specification,l is the actual size of the target object, L1Is the actual distance between the laser emitters, said LAFor the projection distance of the first point-shaped laser transmitter and the corresponding laser point, LBIs the projection distance of a second point-shaped laser emitter and a corresponding laser point, wherein W is the pixel size of the target object, and W is1Is the pixel distance between the laser spots.
Preferably, in the dimension measuring and calculating method, the laser emitting device includes a distance sensor and a laser line projector, and the laser pattern is a laser line segment.
Preferably, the dimension measuring and calculating method further includes:
acquiring a projection distance between the image detection device and the laser line segment by using the distance sensor;
and calculating the actual size of the target object by using the projection distance and the measuring and calculating image.
Preferably, in the sizing method, the calculating an actual size of the target object using the projection distance and the sizing image includes:
calculating the actual length of the laser line segment projected currently according to the projection distance and the distance amplification relation of the laser line segment;
acquiring the pixel length of the laser line segment in the measurement and calculation image and the pixel size of the target object in the measurement and calculation image;
and calculating the actual size of the target object by using the pixel length, the pixel size and the actual length of the current projection of the laser line segment.
The invention also provides a size measuring and calculating device, which is applied to image detection equipment provided with a preset number of laser emitting devices and comprises:
the laser pattern transmitting module is used for controlling the laser transmitting device to transmit laser to a target object to form a laser pattern;
the measuring and calculating image acquisition module is used for acquiring a measuring and calculating image comprising the laser graph and the target object through the image detection equipment;
and the object size calculating module is used for calculating the actual size of the target object by utilizing the measuring and calculating image through a preset algorithm.
The invention also provides an image detection device, which comprises a memory and a processor, wherein the memory stores a computer program, and the processor runs the computer program to enable the image detection device to execute the size measuring and calculating method.
The invention also provides a readable storage medium, which stores a computer program that, when run on a processor, performs the sizing method.
The present invention provides a dimension measuring and calculating method applied to an image detecting apparatus provided with a preset number of laser emitting devices, including: controlling the laser emitting device to emit laser to a target object to form a laser pattern; collecting a measurement and calculation image comprising the laser graph and the target object through the image detection equipment; and calculating the actual size of the target object by using the measuring and calculating image through a preset algorithm. According to the size measuring and calculating method, the actual size of the target object can be accurately and rapidly measured and calculated by utilizing the laser graph in the measured and calculated image and the pixel parameter of the target object through a preset algorithm, so that the user experience is improved.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments.
The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
Hereinafter, the terms "including", "having", and their derivatives, which may be used in various embodiments of the present invention, are only intended to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing, and should not be construed as first excluding the existence of, or adding to, one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing.
Furthermore, the terms "first," "second," "third," and the like are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which various embodiments of the present invention belong. The terms (such as those defined in commonly used dictionaries) should be interpreted as having a meaning that is consistent with their contextual meaning in the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein in various embodiments of the present invention.
Example 1
Fig. 1 is a flowchart of a dimension measuring and calculating method provided in embodiment 1 of the present invention, which is applied to an image detecting apparatus provided with a preset number of laser emitting devices, and includes the following steps:
step S11: and controlling the laser emitting device to emit laser to the target object to form a laser pattern.
In an embodiment of the present invention, the image detection device includes an intelligent device with a camera module, for example, a detection robot, a camera device, and the like, which is not limited herein. The image detection device is provided with a preset number of laser emitting devices in the same direction of image acquisition, so that when the size measuring and calculating function of the image detection device is started, the preset number of laser emitting devices can be controlled to emit laser in the direction of a target object of the image detection device, and a laser pattern is formed on the target object or a preset position of the target object.
Step S12: and collecting a measuring and calculating image comprising the laser graph and the target object through the image detection equipment.
In the embodiment of the invention, after the laser emitting device is started to form the laser pattern on the target object or the preset position of the target object, the camera module of the image detection equipment can acquire the measured image comprising the laser pattern and the target object. The measuring and calculating image comprises a preset number of pictures, and the clear measuring and calculating image can be screened out through picture preprocessing by the image detection equipment so as to improve the calculation precision of the actual size of the target object. Alternatively, the reckoning image may be a video. The target object includes an object or a part of the object, for example, a crack on a certain object, and then the actual length of the crack is calculated.
Step S13: and calculating the actual size of the target object by using the measuring and calculating image through a preset algorithm.
In the embodiment of the invention, after the measurement and calculation image comprising the target object and the laser pattern is obtained, the actual size of the target object can be calculated through a preset algorithm. The specific principle is that after the actual size parameter of the laser pattern is known, the relation between the actual size and the current pixel size can be calculated, so that the actual size of the target object can be calculated by utilizing the relation between the actual size and the current pixel size and the pixel size of the target object in the measured image. For example, two parallel laser emitters may be provided in the laser emitting device, and the actual size parameter is followed by the separation distance between the two laser emitters.
In the embodiment of the invention, an application program based on the preset algorithm can be arranged in the image detection device, and the measurement and calculation image can be input into the application program after being obtained, so that the actual size of the target object can be obtained. Through the steps, the actual size of the target object can be accurately and quickly measured by measuring and calculating the laser graph in the image and the pixel parameter of the target object through a preset algorithm, so that the user experience is improved.
Example 2
Fig. 2 is a flowchart of calculating the actual size of the target object according to embodiment 2 of the present invention.
In the embodiment of the invention, the laser emitting device comprises at least two point-shaped laser emitters which are parallel in light emitting and a distance sensor arranged on each point-shaped laser emitter, the laser pattern is a laser point, and the laser emitting device comprises the following steps:
step S21: and acquiring the projection distance between the point-shaped laser emitter and the corresponding laser point by using the distance sensor.
Step S22: and acquiring the pixel distance between the laser points in the measurement and calculation image and the pixel size of the target object in the measurement and calculation image.
In the embodiment of the invention, the laser emitting device comprises two or more than two point-shaped laser emitters which emit light in parallel pairwise, each point-shaped laser emitter is provided with a distance sensor in the emitting direction, the distance between every two point-shaped laser emitters is a fixed numerical value, and the distance of the fixed numerical value is stored in the image detection equipment in advance. After the measurement and calculation image is obtained, the pixel distance between the laser points and the pixel size of the target object can be calculated through the pixel points in the measurement and calculation image.
In the embodiment of the present invention, the process of measuring and calculating the image acquisition pixel distance and the pixel size may be implemented by using an algorithm or an application program, for example, a pixel length calculation application program may be provided in the image detection device, and the measured and calculated image is acquired and then input to the application program to obtain the pixel distance between the laser points and the pixel size of the target object.
Step S23: and calculating the actual size of the target object by using the projection distance, the pixel size and the actual distance between the point-shaped laser emitters.
In the embodiment of the present invention, the formula of the preset algorithm includes:
wherein L is the actual size of the target object, and L is1Is the actual distance between the laser emitters, said LAFor the projection distance of the first point-shaped laser transmitter and the corresponding laser point, LBIs the projection distance of a second point-shaped laser emitter and a corresponding laser point, wherein W is the pixel size of the target object, and W is1Is the pixel distance between the laser spots.
In the embodiment of the present invention, an application program based on the preset algorithm may be stored in the image detection device, and after the pixel distance between the laser points and the pixel size of the target object are obtained, the pixel distance, the pixel size, and the actual distance between the point-like laser emitters are calculated and input to the application program, so that the actual size of the target object can be calculated.
Example 3
Fig. 3 is a flowchart of a dimension measuring and calculating method according to embodiment 3 of the present invention, where the method is applied to an image detection device provided with a preset number of laser emitting devices, each laser emitting device includes a distance sensor and a laser line projector, and the laser graph is a laser line segment. The method comprises the following steps:
step S31: and controlling the laser emitting device to emit laser to the target object to form a laser pattern.
This step is identical to step S11 described above, and will not be described herein again.
Step S32: and collecting a measuring and calculating image comprising the laser graph and the target object through the image detection equipment.
This step is identical to step S12 described above, and will not be described herein again.
Step S33: and acquiring a projection distance between the image detection equipment and the laser line segment by using the distance sensor.
Step S34: and calculating the actual size of the target object by using the projection distance and the measuring and calculating image.
In the embodiment of the invention, the laser emitting device comprises a distance sensor and a laser line projector, wherein the laser line projector is used for projecting a laser line segment to an object, and a user of the distance sensor acquires the projection distance of the laser line segment.
In the embodiment of the invention, after the projection distance is obtained, the actual size of the target object can be calculated through the projection distance and the measured and calculated image comprising the laser line segment and the target object. Specifically, the actual length of the laser line segment can be calculated according to the current projection distance through the linear relation between the length of the laser line segment and the projection distance, and the actual size of the target object can be calculated by utilizing the actual length of the laser line segment, the pixel length and the pixel size of the target object.
Fig. 4 is a flowchart of calculating the actual size of the target object according to embodiment 3 of the present invention, including the following steps:
step S41: and calculating the actual length of the laser line segment projected currently according to the projection distance and the distance amplification relation of the laser line segment.
Step S42: and acquiring the pixel length of the laser line segment in the measurement and calculation image and the pixel size of the target object in the measurement and calculation image.
Step S43: and calculating the actual size of the target object by using the pixel length, the pixel size and the actual length of the current projection of the laser line segment.
In the embodiment of the present invention, the distance amplification relationship of the laser line segments may be a linear relationship, specifically determined by a prism system in the laser line-casting device, and the linear relationship may be obtained through a preliminary test of the laser line-casting device, and may be stored in the image detection device in advance. Or, a corresponding application program may be set in the image detection device based on the distance amplification relationship of the laser line segment, and the actual length of the laser line segment may be calculated by inputting the projection distance to the application program.
In the embodiment of the present invention, the calculation formula for calculating the actual size of the target object may be:
wherein L is the actual size of the target object, and L is2Is the actual length of the laser line segment, W is the pixel size of the target object, W is2Is the pixel length of the laser line segment.
In the embodiment of the present invention, the process of calculating the actual size of the target object may also be implemented by using an algorithm or an application program, for example, an application program for calculating the actual size of the target object may be set in the image detection device, and after the pixel length, the pixel size, and the actual length of the laser line segment currently projected are obtained, the pixel length, the pixel size, and the actual length are input to the application program to calculate the pixel size of the target object.
Example 4
Fig. 5 is a schematic structural diagram of a dimension measuring and calculating device provided in embodiment 4 of the present invention.
The sizing device 500 includes:
a laser pattern emitting module 510, configured to control the laser emitting device to emit laser to a target object to form a laser pattern;
a measurement and calculation image acquisition module 520, configured to acquire, by the image detection device, a measurement and calculation image including the laser pattern and the target object;
an object size calculating module 530, configured to calculate an actual size of the target object through a preset algorithm using the measurement and calculation image.
In the embodiment of the present invention, for more detailed description of functions of the modules, reference may be made to contents of corresponding parts in the foregoing embodiment, which are not described herein again.
Furthermore, the present invention also provides an image detection apparatus comprising a memory for storing a computer program and a processor for causing the image detection apparatus to execute the functions of the respective modules in the above method or the above size measuring and calculating device by executing the computer program.
The memory may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the image sensing apparatus, and the like. Further, the memory may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The embodiment also provides a readable storage medium for storing a computer program used in the image detection device.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative and, for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, each functional module or unit in each embodiment of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention or a part of the technical solution that contributes to the prior art in essence can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.