Summary of the invention
The present invention is directed to solve at least some of the technical problems in related technologies.For this purpose, of the invention
One purpose is to provide a kind of image focal length mark point intelligent selecting method, device and equipment, so as to image focal length mark point
Selection it is more reasonable.
The technical scheme adopted by the invention is that: a kind of image focal length mark point intelligent selecting method, including
Obtain image border and the color information of target object image;
Mark point is chosen according to described image edge, the color information;
According to mark point density degree, mark point is deleted or increased.
As a further improvement of the foregoing solution, the color information includes the shades of gray, the acquisition image border
It is specifically included with color information:
The image border of target object image is extracted by Edge extraction algorithm;
By handling to obtain grayscale image to object image gray processing, the gray value of grayscale image is extracted, the grey depth is obtained
Degree.
As a further improvement of the foregoing solution, the mark point includes edge labelling point and central marks point, and described
It chooses mark point according to described image edge, the color information and specifically includes:
According to image border, several edge labelling points are chosen on described image edge according to the first selection rule;
According to the shades of gray, region is entreated to choose several central marks points in the picture according to the second selection rule.
As a further improvement of the foregoing solution, first selection rule is between the two neighboring mark point chosen
Spacing distance is fixed value;Second selection rule is default gray value threshold value, when pixel gray value is greater than gray value threshold
When value, it is chosen for mark point.
As a further improvement of the foregoing solution, described according to mark point density degree, it deletes or increase mark point is specific
Include:
Spacing distance Low threshold and spacing distance high threshold between default adjacent marker point, judge that each mark point is adjacent thereto
Whether the spacing distance between mark point is greater than spacing distance Low threshold and is less than spacing distance high threshold;
If the spacing distance between mark point mark point adjacent thereto is greater than spacing distance Low threshold and is less than spacing distance
High threshold then retains the mark point;
If the spacing distance between mark point mark point adjacent thereto is less than spacing distance Low threshold, the mark point is deleted;
If the spacing distance between mark point mark point adjacent thereto is higher than spacing distance high threshold, in the mark point and its
Increase mark point between adjacent marker point.
A kind of image focal length mark point intelligence selecting device is intelligently chosen for implementing above-mentioned image focal length mark point such as
Method, comprising:
Module is obtained, for obtaining image border and the color information of target object image;
Module is chosen, for choosing mark point according to described image edge, the color information;
Judgment module, for deleting or increasing mark point according to mark point density degree.
As a further improvement of the foregoing solution, the acquisition module includes:
Image border acquiring unit, for extracting the image border of target object image by Edge extraction algorithm;
Acquiring color information unit, for extracting grayscale image by handling object image gray processing to obtain grayscale image
Gray value, obtain gray scale weight.
As a further improvement of the foregoing solution, the selection module includes:
First selection unit is used for according to image border, if choosing on described image edge according to the first selection rule
Dry edge labelling point;
Second selection unit is used for according to the shades of gray, if entreating region to choose in the picture according to the second selection rule
Dry central marks point.
As a further improvement of the foregoing solution, the judgment module includes:
Judging unit, for presetting spacing distance Low threshold and spacing distance high threshold between adjacent marker point, judgement is each
Whether the spacing distance between mark point mark point adjacent thereto is greater than spacing distance Low threshold and is less than spacing distance high threshold;
Stick unit, if for the spacing distance between mark point mark point adjacent thereto be greater than spacing distance Low threshold and
Less than spacing distance high threshold, then retain the mark point;
Unit is deleted, if being less than spacing distance Low threshold for the spacing distance between mark point mark point adjacent thereto,
Delete the mark point;
Adding unit, if being higher than spacing distance high threshold for the spacing distance between mark point mark point adjacent thereto,
Increase mark point between mark point mark point adjacent thereto.
A kind of image focal length mark point intelligence selected equipment, comprising:
At least one processor;And the memory being connect at least one described processor communication;Wherein,
The memory is stored with the instruction that can be executed by least one described processor, and described instruction is by described at least one
A processor executes, so that at least one described processor is able to carry out image focal length mark point intelligence as mentioned selection side
Method.
The beneficial effects of the present invention are:
A kind of image focal length mark point intelligent selecting method, device and equipment pass through the image side for obtaining target object image
Edge and color information choose mark point according to image border, color information, and according to mark point density degree, delete or increase
Mark point marks image focal length compared with randomly selecting mark point or simple mathematical operation selection mark point in the prior art
The selection of point is more reasonable, avoids the subsequent unsharp problem of line-scan digital camera scan image.
Specific embodiment
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phase
Mutually combination.
Fig. 1 is a kind of flow diagram of image focal length mark point intelligent selecting method of the present invention, referring to Fig.1, Yi Zhongtu
As focal length mark point intelligent selecting method, including step S1 to S3:
S1 obtains image border and the color information of target object image.Wherein, object figure is obtained using area array cameras
Picture.
In the present embodiment, object is pathological section.Color information includes the shades of gray, it is clear that, it is also possible to face
Color depth either shallow.
Specifically, extracting the image border of target object image by Edge extraction algorithm in the present embodiment;By right
Object image gray processing handles to obtain grayscale image, extracts the gray value of grayscale image, obtains the shades of gray.
In the present embodiment, Edge extraction algorithm uses Canny Boundary extracting algorithm, specifically includes:
S101 carries out gray processing to target object image, and the method for usual gray processing mainly has mean value method:
Gray=(R+G+B)/3 (1)
And weighted mean method:
Gray=0.99R+0.587G+0.114B (2)
Wherein R, G, B respectively indicate the color in three channels of red, green, blue.
S102 carries out gaussian filtering to image,
Wherein, σ indicates standard deviation, x2+y2Indicate the distance of pixel and central pixel point.
S103 calculates amplitude and the direction of gradient with the finite difference of single order local derviation, and the convolution that Canny operator uses is calculated
Son is as follows:
The calculating of gradient magnitude and gradient direction is as follows:
P [i, j]=/ 2 (5) (f [i, j+1]-f [i, j]+f [i+1, j+1]-f [i+1, j])
Q [i, j]=/ 2 (6) (f [i, j]-f [i+1, j]+f [i, j+1]-f [i+1, j+1])
θ [i, j]=arctan (Q [i, j]/P [i, j]) (8)
Wherein P indicates that the direction x first-order partial derivative matrix, Q indicate that the direction y first-order partial derivative matrix, M indicate gradient magnitude, θ
Indicate gradient direction.
S104 carries out non-maxima suppression to gradient magnitude, traverses M, the gradient direction at edge be divided into four kinds (it is horizontal,
Vertically, 45 degree of directions, 135 degree of directions), all directions are compared with different neighborhood pixels, to determine local maximum, if
The gray value of some pixel is not the largest compared with the gray value of former and later two pixels on its gradient direction, then this pixel
Value is 0, i.e., is not edge.
High-low threshold value is arranged in S105, traverses M, and all edges that is set as greater than high threshold are all to be set as less than Low threshold
Non-edge, if testing result be greater than Low threshold but be less than high threshold, judge in the adjacent pixels of this pixel either with or without
More than the edge pixel of high threshold, if there is being then set as edge, otherwise, it is set as non-edge.
In the present embodiment, object image gray processing is handled to obtain grayscale image, extracts the gray value of grayscale image, obtain ash
Color depth either shallow, gray processing processing are specifically included weighted mean method, are weighted to tri- components of R, G, B with different weights flat
, grayscale image is obtained;Or mean value method is used, and the average value of tri- components of R, G, B of each pixel is found out, it then will be former
Average value in beginning color image assigns the component of these three pixels;Or maximum value process is used, it will be in original color image
R, gray value of the maximum value of tri- component intensities of G, B as grayscale image.
S2 chooses mark point according to image border, color information.
In the present embodiment, step S2 is specifically included according to image border, is selected on image border according to the first selection rule
Take several edge labelling points;According to the shades of gray, region is entreated to choose in several in the picture according to the second selection rule
Entreat mark point.Wherein, it is fixed value that the first selection rule, which is the spacing distance between the two neighboring mark point chosen,;Second choosing
Rule is taken to be chosen for mark point when pixel gray value is greater than gray value threshold value for default gray value threshold value.
According to the first selection rule, several edge labelling points, the adjacent edge of any two are chosen on image border
Spacing distance between mark point is fixed value d.According to the second selection rule, region is entreated to choose several center marks in the picture
Remember point, it is assumed that the intensity value ranges of grayscale image are 0-255, and presetting gray value threshold value is 133, then when the image middle section pixel
When point gray value is greater than 133, it is chosen for mark point.
S3 deletes or increases mark point according to mark point density degree.
In the present embodiment, step S3 is specifically included:
Spacing distance Low threshold and spacing distance high threshold between default adjacent marker point, judge each mark point and adjacent mark
Whether the spacing distance between note point is greater than spacing distance Low threshold and is less than spacing distance high threshold;
If the spacing distance between mark point mark point adjacent thereto is greater than spacing distance Low threshold and is less than spacing distance
High threshold then retains the mark point;
If the spacing distance between mark point mark point adjacent thereto is less than spacing distance Low threshold, the mark point is deleted;
If the spacing distance between mark point mark point adjacent thereto is higher than spacing distance high threshold, in the mark point and its
Increase mark point between adjacent marker point.
Spacing distance range between default adjacent marker point is (a, b), between judging between each mark point and adjacent marker point
Whether gauge is from the spacing distance range (a, b), if so, retaining the mark point, if mark point and one adjacent marker point
Between spacing distance be less than a, then delete the mark point, if the spacing distance between mark point and one adjacent marker point be greater than b,
Increase mark point between the mark point and its this adjacent marker point.
Image focal length mark point intelligent selecting method of the invention, by the image border and the color that obtain target object image
Information chooses mark point according to image border, color information, and according to mark point density degree, deletes or increase mark point, with
Mark point or simple mathematical operation are randomly selected in the prior art choose mark point and compare, more to the selection of image focal length mark point
Adduction reason, avoids the subsequent unsharp problem of line-scan digital camera scan image.
Fig. 2 is a kind of structural block diagram of image focal length mark point intelligence selecting device of the present invention, referring to Fig. 2, a kind of image
Focal length mark point intelligence selecting device, for image focal length mark point intelligent selecting method above-mentioned in real time, which includes:
Module is obtained, for obtaining image border and the color information of target object image;
Module is chosen, for choosing mark point according to image border, color information;
Judgment module, for deleting or increasing mark point according to mark point density degree.
In the present embodiment, obtaining module includes:
Image border acquiring unit, for extracting the image border of target object image by Edge extraction algorithm;
Acquiring color information unit, for extracting grayscale image by handling object image gray processing to obtain grayscale image
Gray value, obtain gray scale weight.
In the present embodiment, choosing module includes:
First selection unit, for choosing several on image border according to the first selection rule according to image border
Edge labelling point;
Second selection unit, for entreating region to choose in the picture according to the second selection rule several according to image border
A central marks point.
Wherein, it is fixed value that the first selection rule, which is the spacing distance between the two neighboring mark point chosen,;Second choosing
Rule is taken to be chosen for mark point when pixel gray value is greater than gray value threshold value for default gray value threshold value.
In the present embodiment, judgment module includes:
Judging unit, for presetting spacing distance Low threshold and spacing distance high threshold between adjacent marker point, judgement is each
Whether the spacing distance between mark point mark point adjacent thereto is greater than spacing distance Low threshold and is less than spacing distance high threshold;
Stick unit, if for the spacing distance between mark point mark point adjacent thereto be greater than spacing distance Low threshold and
Less than spacing distance high threshold, then retain the mark point;
Unit is deleted, if being less than spacing distance Low threshold for the spacing distance between mark point mark point adjacent thereto,
Delete the mark point;
Adding unit, if being higher than spacing distance high threshold for the spacing distance between mark point mark point adjacent thereto,
Increase mark point between mark point mark point adjacent thereto.
The present embodiment also provides a kind of image focal length mark point intelligence selected equipment, including at least one processor, and,
The memory being connect at least one described processor communication;Wherein, be stored with can be by described at least one for the memory
The instruction that device executes is managed, described instruction is executed by least one described processor, so that at least one described processor can be held
The row method.
Image focal length mark point intelligent selecting method, device and equipment provided by the invention, by obtaining target object image
Image border and color information, mark point is chosen according to image border, color information, and according to mark point density degree, is deleted
Mark point is removed or increases, compared with randomly selecting mark point or simple mathematical operation selection mark point in the prior art, to image
The selection of focal length mark point is more reasonable, avoids the subsequent unsharp problem of line-scan digital camera scan image.
It is to be illustrated to preferable implementation of the invention, but the invention is not limited to the implementation above
Example, those skilled in the art can also make various equivalent variations on the premise of without prejudice to spirit of the invention or replace
It changes, these equivalent deformations or replacement are all included in the scope defined by the claims of the present application.