Background
The linear array scanning camera collects at a high speed, moves to the next unit length after collecting one line each time, and continues to collect the next line, so that a two-dimensional picture is spliced after a period of time, and the two-dimensional picture is similar to the picture collected by the area array camera. In the working process of the existing linear array camera scanning system, because the surface of a target object is uneven, and a carrier for placing the target object (a shot object/a scanned object) is inclined, the overall focus of the target object may be greatly changed, so that before the target object is scanned, a plurality of mark points are generally required to be selected in an area to be scanned for focusing.
In the prior art, the focusing process of the mark points is generally an all-focusing process, however, the change of the focal positions of adjacent mark points is small, and if all the mark points are all focused, the problem of low focusing efficiency exists. Therefore, the inventors propose an idea of performing a half-focusing process on adjacent ones of the focused mark points to improve focusing efficiency. However, in the prior art, the focusing sequence of the plurality of marking points is often manually selected, random or simple from left to right, and the automatic focusing sequence selection assumed above cannot be realized.
Disclosure of Invention
The present invention is directed to solving, at least to some extent, one of the technical problems in the related art. Therefore, an object of the present invention is to provide a method and an apparatus for processing a focusing sequence of a mark point of a multi-mark-point target object, which can improve the processing efficiency.
The technical scheme adopted by the invention is as follows: a processing method for focusing sequence of target object mark points with multiple mark points comprises the following steps:
s1, acquiring all mark points to be focused in the target object;
s2, determining a first mark point, and starting focusing the first mark point according to a full focusing mode;
s3, selecting the next mark point according to the first constraint condition, and focusing the mark point according to the semi-focusing mode;
s4, repeatedly executing the step S3;
the first constraint includes:
c1, the distance from the last marked point is the smallest.
As a further improvement of the above scheme, the first constraint further includes: and C0, the distance between the last marker point and the last marker point is less than a preset distance threshold.
As a further improvement of the above scheme, the first constraint further includes: c2, located in the same communication area as the last marker.
As a further improvement of the above scheme, step S4 specifically includes: repeatedly executing the step S3 until a second constraint condition is satisfied, where the second constraint condition is: the distance between the mark point and the last mark point is larger than a preset distance threshold value.
As a further improvement of the above solution, the method further includes step S5, focusing the mark points to be focused in the target object in an all-focusing manner from the mark point to be focused at the leftmost end to the mark point to be focused at the rightmost end.
As a further improvement of the above scheme, the full focusing mode includes a primary focusing process and a secondary focusing process;
the primary focusing process specifically comprises the following steps: shooting a target object at a plurality of first shooting height positions by utilizing a shooting component, obtaining reference images of the corresponding first shooting height positions, and selecting the first shooting height position corresponding to the reference image with the highest definition as a first focus position;
the secondary focusing process specifically comprises the following steps: and selecting the first focus position as a second center position, acquiring reference images of a plurality of second shooting height positions with the second center position as the center by using the shooting component, and selecting the second shooting height position corresponding to the reference image with the highest definition as the second focus position.
As a further improvement of the above scheme, the semi-focusing mode specifically includes: and executing a secondary focusing process by taking the focus position of the previous mark point as a second center position.
A multi-marker object focusing order processing apparatus for performing the above multi-marker object focusing order processing method, the apparatus comprising:
the acquisition module is used for acquiring all mark points to be focused in the target object;
the determining module is used for determining the first marking point and starting focusing the first marking point according to a full focusing mode;
the first selection module is used for selecting the next marking point according to the first constraint condition and focusing the marking point in a semi-focusing mode;
the repeated execution module is used for repeatedly executing the selection of the next marking point according to the first constraint condition and focusing the marking point in a semi-focusing mode;
the first constraint includes:
c1, the distance from the last marked point is minimum.
As a further improvement of the foregoing solution, the repeated execution module is specifically configured to repeatedly execute selecting a next marker point according to a first constraint condition, and perform focusing on the next marker point according to a semi-focusing manner until a second constraint condition is satisfied, where the second constraint condition is: the distance between the mark point and the last mark point is larger than a preset distance threshold value.
As a further improvement of the above scheme, the apparatus further includes a second selection module, configured to focus the mark point to be focused from the leftmost end to the rightmost end of the target object in an all-focus manner.
The invention has the beneficial effects that:
the invention relates to a processing method and a device for focusing sequence of mark points of a multi-mark-point target object, which are used for acquiring all mark points to be focused in the target object, determining that the first mark point starts focusing, and selecting the next mark point for focusing according to the condition of minimum distance from the previous mark point, thereby improving the processing efficiency.
Detailed Description
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
Fig. 1 is a flowchart of steps of a method for processing a focusing sequence of a multi-marker object marker according to the present invention, and referring to fig. 1, a method for processing a focusing sequence of a multi-marker object marker includes steps S1 to S4.
S1, acquiring all mark points to be focused in the target object;
and S2, determining the first mark point, and starting focusing the first mark point according to the full focusing mode.
In a specific embodiment, any mark point to be focused on the edge of the target object is selected as a first mark point, which may be the first mark point at the leftmost end or the rightmost end or the topmost end or the bottommost end of the target object, and after the first mark point is determined, focusing on the first mark point in an all-focus manner is started.
Fig. 2 is a schematic view of a full focusing mode of a multi-mark point target mark point focusing sequence of the present invention, referring to fig. 2, the full focusing process includes a primary focusing process and a secondary focusing process, and the primary focusing process specifically includes: the method comprises the steps of shooting a target object at a plurality of first shooting height positions by utilizing a shooting component, obtaining reference images of the corresponding first shooting height positions, and selecting the first shooting height position corresponding to the reference image with the highest definition as a first focus position.
The plurality of first shooting height positions are located between a preset first starting height position 101 and a first ending height position 102, the line camera and/or the objective lens moves from the first starting height position 101 to the first ending height position 102 along a vertical axis 104 according to a first preset stepping distance 103 to form the plurality of first shooting height positions, a reference image of the corresponding first shooting height position is obtained, and finally the first shooting height position corresponding to the focus where the image with the highest definition is selected from the images shot and obtained by the line camera at the first starting height position 101 and the first ending height position 102 is defined as a first focus position 105.
The secondary focusing process specifically comprises the following steps: the first focus position 105 is selected as a second center position, the reference images of a plurality of second shooting height positions centered on the second center position are acquired by the shooting means, and the second shooting height position corresponding to the reference image with the highest sharpness is selected as the second focus position.
The plurality of second shooting height positions refers to a plurality of second shooting height positions formed by moving the line camera and/or the objective lens from the second starting height position 201 to the second ending height position 202 along the vertical axis 204 by a second preset stepping distance 203, centered at the second center position, between a preset second starting height position 201 and a second ending height position 202. The second preset step distance 203 is smaller than the first preset step distance 103, and finally, a second shooting height position corresponding to the focus where the image with the highest definition is selected from the images shot and acquired by the line camera at the second starting height position 201 and the second ending height position 202 is defined as a second focus position 205.
And S3, selecting the next marking point according to the first constraint condition, and focusing the next marking point according to the semi-focusing mode.
In a particular embodiment, the first constraint includes:
c0, the distance between the last mark point and the last mark point is less than a preset distance threshold;
c1, the distance from the last marking point is minimum;
c2, located in the same communication area as the last marker.
And presetting a distance threshold d, selecting a mark point to be focused, the distance between which and the previous mark point is less than the preset distance threshold d, selecting the mark point to be focused, the distance between which and the previous mark point is the smallest, from the selected mark points to be focused meeting the condition of C0, judging whether the mark point and the previous mark point are positioned in the same communication area, if the mark point to be focused is positioned in the same communication area, selecting the mark point to be focused as the next mark point, focusing the mark point to be focused according to a semi-focusing mode, and if the mark point is not positioned in the same communication area, searching the next mark point to be focused, the mark point to be focused meeting the first constraint condition, and taking the next mark point as the next mark point.
In this embodiment, whether the mark points to be focused and the previous mark point are located in the same communication area is determined, specifically, by obtaining an original image of a target object, converting the original image into a gray image, performing threshold filtering on the gray image, converting the gray image into a binary image, calculating the communication area for the binary image, and determining whether the currently selected mark point to be focused and the previous mark point are located in the same communication area.
In this embodiment, the semi-focusing method specifically includes: and executing a secondary focusing process by taking the focus position of the previous mark point as a second center position. In step S2, the first mark point is focused in a full focus manner, i.e., the first mark point is focused once and then focused twice, and the next mark point is selected according to the first constraint condition and focused in a half focus manner, i.e., the next mark point is focused twice.
S4, step S3 is repeatedly executed.
In an embodiment, step S4 is to repeatedly execute step S3 until a second constraint condition is satisfied, where the second constraint condition is: the distance between the mark point and the last mark point is larger than a preset distance threshold value. In this embodiment, the method further includes step S5: focusing the mark points to be focused in the target object from the mark point to be focused at the leftmost end to the mark point to be focused at the rightmost end according to a full focusing mode. After the steps S1 to S4 are executed, the target object may have unfocused mark points, and step S5 is added to perform focusing on the mark points to be focused in the target object in an all-focusing manner, so as to avoid a situation that an image after focusing is unclear due to a large difference in focal length caused by a too long distance between two adjacent front and rear focused mark points.
The invention relates to a processing method of a focusing sequence of mark points of a multi-mark-point target object, which is used for acquiring all mark points to be focused in the target object, determining that the first mark point starts to be focused, selecting the next mark point to be focused according to the condition of the minimum distance from the previous mark point, improving the processing efficiency, and respectively focusing the mark points selected by different selection modes by adopting a full focusing mode or a half focusing mode so as to enable the acquired image to be clearer.
Fig. 3 is a schematic diagram showing the configuration of a multi-marker target object focusing order processing device according to the present invention, and referring to fig. 3, the multi-marker target object focusing order processing device for performing the above-mentioned multi-marker target object focusing order processing method includes:
the acquisition module is used for acquiring all mark points to be focused in the target object;
the determining module is used for determining the first marking point and starting focusing the first marking point according to a full focusing mode;
the first selection module is used for selecting the next marking point according to the first constraint condition and focusing the marking point in a semi-focusing mode;
and the repeated execution module is used for repeatedly executing the selection of the next marking point according to the first constraint condition and focusing the marking point in a semi-focusing mode.
In this embodiment, the repeated execution module is specifically configured to repeatedly execute selecting a next mark point according to the first constraint condition, and perform focusing on the next mark point according to a semi-focusing manner until the second constraint condition is satisfied.
Wherein the first constraint condition comprises:
c0, the distance between the last mark point and the last mark point is less than a preset distance threshold;
c1, the distance from the last marking point is minimum;
c2, located in the same communication area as the last marker.
The second constraint condition is that the distance between the marker point and the last marker point is larger than a preset distance threshold value.
In this embodiment, the full focusing method includes a primary focusing process and a secondary focusing process; the primary focusing process specifically comprises the following steps: shooting a target object at a plurality of first shooting height positions by utilizing a shooting component, obtaining reference images of the corresponding first shooting height positions, and selecting the first shooting height position corresponding to the reference image with the highest definition as a first focus position; the secondary focusing process specifically comprises the following steps: and selecting the first focus position as a second center position, acquiring reference images of a plurality of second shooting height positions with the second center position as the center by using the shooting component, and selecting the second shooting height position corresponding to the reference image with the highest definition as the second focus position. The semi-focusing mode specifically comprises the following steps: and executing a secondary focusing process by taking the focus position of the previous mark point as a second center position.
In this embodiment, the apparatus further includes a storage module, configured to store the first constraint condition, the second constraint condition, the all-focusing mode and the semi-focusing mode.
The invention relates to a processing device for marking a focusing sequence of a multi-marking-point target object, which is used for acquiring all marking points to be focused in the target object, determining that the first marking point starts focusing, selecting the next marking point for focusing according to the condition that the distance between the next marking point and the last marking point is minimum, improving the processing efficiency, and respectively adopting a full focusing mode or a half focusing mode to focus the marking points selected in different selection modes to enable the acquired image to be clearer.
While the preferred embodiments of the present invention have been illustrated and described, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.