CN108629786A - Method for detecting image edge and device - Google Patents
Method for detecting image edge and device Download PDFInfo
- Publication number
- CN108629786A CN108629786A CN201710180247.XA CN201710180247A CN108629786A CN 108629786 A CN108629786 A CN 108629786A CN 201710180247 A CN201710180247 A CN 201710180247A CN 108629786 A CN108629786 A CN 108629786A
- Authority
- CN
- China
- Prior art keywords
- matrix
- numerical value
- similarity
- intensity
- edge
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Landscapes
- Image Analysis (AREA)
Abstract
A kind of method for detecting image edge and device, the method includes:Obtain the original image of input;Horizontal input matrix and vertical input matrix are chosen from the original image;The horizontal input matrix and vertical input matrix are respectively divided into corresponding multiple block of pixels;It partly overlaps between the multiple pixel adjacent pixel blocks in the block;Based on the similarity information between adjacent pixel blocks in the horizontal input matrix and vertical input matrix, the fringe region of the original image is determined.Above-mentioned scheme can improve the accuracy of Image Edge-Detection, improve the image quality of mobile terminal.
Description
Technical field
The present invention relates to technical field of image processing, more particularly to a kind of method for detecting image edge and device.
Background technology
Edge detection is always one of study on classics project of image processing field, is used to find in image about shape
The information of shape and reflection or transmittance.Edge detection is image procossing, image analysis, pattern-recognition, computer vision and people
One of the basic step of class vision.The correctness and reliability of the result of edge detection will directly influence NI Vision Builder for Automated Inspection pair
The understanding of objective world.
With the development of science and technology the popularity rate of mobile terminal is higher and higher, while people are to mobile terminal function requirement
It is higher and higher, especially to the imaging effect of its camera.
But existing method for detecting image edge has detection accuracy difference, affects mobile terminal
Image quality.
Invention content
The technical issues of embodiment of the present invention solves is how to improve the accuracy of Image Edge-Detection, improves mobile terminal
Image quality.
To solve the above problems, an embodiment of the present invention provides a kind of method for detecting image edge, the method includes:It obtains
Take the original image of input;Horizontal input matrix and vertical input matrix are chosen from the original image;The level is defeated
Enter matrix and vertical input matrix is respectively divided into corresponding multiple block of pixels;The multiple pixel adjacent pixel blocks in the block it
Between partly overlap;Based on the similarity information between adjacent pixel blocks in the horizontal input matrix and vertical input matrix, really
The fringe region of the fixed original image.
Optionally, the similarity based between adjacent pixel blocks in the horizontal input matrix and vertical input matrix
Information determines the fringe region of the original image, including:It calculates separately adjacent in horizontal direction in the horizontal input matrix
The similarity numerical value of vertically adjacent block of pixels in the similarity numerical value of block of pixels and the vertical input matrix, obtains pair
The horizontal direction similarity matrix and vertical direction similarity matrix answered;By the horizontal direction similarity matrix being calculated and hang down
Each similarity numerical value of the histogram into similarity matrix is compared with corresponding intensity threshold respectively;According to horizontal direction phase
Like degree matrix and vertical direction similarity matrix in each similarity numerical value respectively with the comparison result of corresponding intensity threshold,
Corresponding horizontal intensity matrix and vertical intensity matrix are generated respectively;Based on the horizontal intensity matrix and the vertical intensity square
Battle array, generates corresponding image border intensity matrix;Believe from the edge extracted in described image edge strength matrix on corresponding direction
Breath.
Optionally, adjacent pixel blocks in horizontal direction are calculated separately in the horizontal input matrix using following formula
The similarity numerical value of vertically adjacent block of pixels in similarity numerical value and the vertical input matrix:D=∑s | vblock1
[i]-vblock2[i]|;Wherein, i indicates pixel ith pixel point in the block, adjacent in D expression horizontal directions or vertical direction
Similarity numerical value in block of pixels between ith pixel point, block1, block2 are indicated respectively in horizontal direction or vertical direction
Adjacent pixel blocks, and in adjacent pixel blocks ith pixel point be with channel pixel, vblock1[i]、vblock2[i] difference
Indicate the pixel value of ith pixel point in adjacent pixel blocks.
Optionally, each similar number of degrees according in horizontal direction similarity matrix and vertical direction similarity matrix
Value generates corresponding horizontal intensity matrix and vertical intensity matrix respectively respectively with the comparison result of corresponding intensity threshold, wraps
It includes:It, will be corresponding strong in corresponding intensity matrix when the similarity numerical value is less than or equal to preset first intensity threshold
Number of degrees value is denoted as the first numerical value;When the similarity numerical value is more than first intensity threshold and is less than or equal to preset second
When intensity threshold, corresponding strength values in corresponding intensity matrix are denoted as second value;The second value is more than described
First numerical value;When the similarity numerical value is more than second intensity threshold and is less than or equal to preset third intensity threshold
When, corresponding strength values in corresponding intensity matrix are denoted as third value;The third value is more than the second value;
When the similarity numerical value is more than the third intensity threshold, corresponding strength values in corresponding intensity matrix are denoted as the
Four numerical value;4th numerical value is more than the third value.
Optionally, described to be based on the horizontal intensity matrix and the vertical intensity matrix, generate corresponding image border
Intensity matrix, including:
Wherein, flag_stri,jIndicate the edge strength numerical value that the i-th row jth arranges in the intensity matrix of image border, hi,jDescribed in expression
The strength values that the i-th row jth arranges in horizontal intensity matrix, vi,jIndicate the intensity that the i-th row jth arranges in the vertical intensity matrix
Numerical value, N indicate the line number and columns of the horizontal similarity matrix and vertical similarity matrix.
Optionally, the marginal information on corresponding direction is extracted in the edge strength matrix from described image, including:It obtains
Edge strength numerical value in described image edge strength matrix in respective direction;When determine in the respective direction be more than it is preset
When the quantity of the edge strength numerical value of edge strength threshold value is more than preset amount threshold, determine that the respective direction is edge side
To;The sum of the edge strength numerical value in the edge direction is calculated;Based on the edge strength numerical value in the edge direction
The sum of, judge edge power.
Optionally, the marginal information on corresponding direction is extracted in the edge strength matrix from described image, further includes:When
There is only unique edge direction or identified edge direction be it is more than two and not on the same line when, determine described in
The pixel center of horizontal input matrix and vertical input matrix point is angle point.
The embodiment of the present invention additionally provides a kind of Image Edge-Detection device, including:Acquiring unit is suitable for obtaining input
Original image;Selection unit, suitable for choosing horizontal input matrix and vertical input matrix from the original image;It divides single
Member, suitable for the horizontal input matrix and vertical input matrix are respectively divided into corresponding multiple block of pixels;The multiple picture
It partly overlaps between element adjacent pixel blocks in the block;Detection unit is suitable for based on the horizontal input matrix and vertical input square
Similarity information in battle array between adjacent pixel blocks, determines the fringe region of the original image.
Optionally, the detection unit, suitable for calculating separately in the horizontal input matrix adjacent pixel in horizontal direction
The similarity numerical value of vertically adjacent block of pixels, obtains corresponding in the similarity numerical value of block and the vertical input matrix
Horizontal direction similarity matrix and vertical direction similarity matrix;The horizontal direction similarity matrix and Vertical Square that will be calculated
Each similarity numerical value into similarity matrix is compared with corresponding intensity threshold respectively;According to horizontal direction similarity
Each similarity numerical value in matrix and vertical direction similarity matrix is distinguished respectively with the comparison result of corresponding intensity threshold
Generate corresponding horizontal intensity matrix and vertical intensity matrix;Based on the horizontal intensity matrix and the vertical intensity matrix,
Generate corresponding image border intensity matrix;From the marginal information extracted in described image edge strength matrix on corresponding direction.
Optionally, the detection unit, it is horizontal in the horizontal input matrix suitable for being calculated separately using following formula
On direction in the similarity numerical value of adjacent pixel blocks and the vertical input matrix vertically adjacent block of pixels similarity
Numerical value:D=∑s | vblock1[i]-vblock2[i]|;Wherein, i indicate pixel ith pixel point in the block, D indicate horizontal direction or
Similarity numerical value in adjacent pixel blocks in vertical direction between ith pixel point, block1, block2 indicate horizontal respectively
Adjacent pixel blocks on direction or vertical direction, and ith pixel point is the pixel with channel, v in adjacent pixel blocksblock1
[i]、vblock2[i] indicates the pixel value of ith pixel point in adjacent pixel blocks respectively.
Optionally, the detection unit is suitable for being less than or equal to preset first intensity threshold when the similarity numerical value
When, corresponding strength values in corresponding intensity matrix are denoted as the first numerical value;When the similarity numerical value is more than described first
Intensity threshold and less than or equal to preset second intensity threshold when, corresponding strength values in corresponding intensity matrix are denoted as
Second value;The second value is more than first numerical value;When the similarity numerical value be more than second intensity threshold and
When less than or equal to preset third intensity threshold, corresponding strength values in corresponding intensity matrix are denoted as third value;
The third value is more than the second value;It, will be corresponding when the similarity numerical value is more than the third intensity threshold
Corresponding strength values are denoted as the 4th numerical value in intensity matrix;4th numerical value is more than the third value.
Optionally, the detection unit, be suitable for using following by the way of based on the horizontal intensity matrix and it is described vertically
Intensity matrix generates corresponding image border intensity matrix:
Wherein, flag_stri,jIndicate the edge strength numerical value that the i-th row jth arranges in the intensity matrix of image border, hi,jDescribed in expression
The strength values that the i-th row jth arranges in horizontal intensity matrix, vi,jIndicate the intensity that the i-th row jth arranges in the vertical intensity matrix
Numerical value, N indicate the line number and columns of the horizontal similarity matrix and vertical similarity matrix.
Optionally, the detection unit, the edge for being suitable for obtaining in described image edge strength matrix in respective direction are strong
Number of degrees value;It is preset when the quantity for determining the edge strength numerical value in the respective direction more than preset edge strength threshold value is more than
Amount threshold when, determine the respective direction be edge direction;The edge strength numerical value in the edge direction is calculated
The sum of;Based on the sum of the edge strength numerical value in the edge direction, edge power is judged.
Optionally, the detection unit, be further adapted for be when there is only unique edge directions or identified edge direction
It is more than two and not on the same line when, determine that the pixel center point of the horizontal input matrix and vertical input matrix is angle
Point.
Compared with prior art, technical scheme of the present invention has the following advantages that:
Above-mentioned scheme passes through adjacent pixel in selected horizontal input matrix in original image and vertical input matrix
Similarity between block can determine corresponding image border, can reduce the operation complexity of Image Edge-Detection, and can
To take into account the accuracy of edge detection.
It further, can be right in the edge direction according to being calculated when it is edge direction to determine respective direction
The sum of edge strength numerical value answered accurately distinguishes the edge power in respective direction, and then can improve at image
The quality of reason.
Further, when being more than two there is only unique edge direction or identified edge direction and non-be located at
When same straight line, determines that corresponding pixel center point is angle point, the angle point information in image can be accurately determined, in image
The information for retaining angle point when processing, to improve the image quality of image.
Description of the drawings
Fig. 1 is a kind of flow chart of method for detecting image edge in the embodiment of the present invention;
Fig. 2 is the flow chart of another method for detecting image edge in the embodiment of the present invention;
Fig. 3 is the schematic diagram of the raw image data in the embodiment of the present invention;
Fig. 4 is the position relationship schematic diagram of the horizontal input matrix and adjacent pixel blocks therein in the embodiment of the present invention;
Fig. 5 is the position relationship schematic diagram of the vertical input matrix and adjacent pixel blocks therein in the embodiment of the present invention;
Fig. 6 is the schematic diagram of all directions in the image border intensity matrix in the embodiment of the present invention;
Fig. 7 is the structural schematic diagram of the Image Edge-Detection device in the embodiment of the present invention.
Specific implementation mode
As described in the background art, method for detecting image edge in the prior art carries out side by the similitude between pixel
Edge detects, and there is a problem that speed is slow and accuracy is low.
To solve the above problems, the technical solution in the embodiment of the present invention passes through horizontal input selected in original image
Similarity in matrix and vertical input matrix between adjacent pixel blocks, can determine corresponding image border, can reduce
The operation complexity of Image Edge-Detection, and the accuracy of edge detection can be improved.
To make the above purposes, features and advantages of the invention more obvious and understandable, below in conjunction with the accompanying drawings to the present invention
Specific embodiment be described in detail.
Fig. 1 shows a kind of flow chart of method for detecting image edge in the embodiment of the present invention.Image as shown in Figure 1
Edge detection method may include:
Step S101:Obtain the original image of input.
In specific implementation, the size of the original image of input can be configured according to the actual needs, e.g., Ke Yishe
It is set to 9*9,13*13 or 15*15 etc..
Step S102:Horizontal input matrix and vertical input matrix are chosen from the original image.
In specific implementation, the size of the horizontal input matrix and vertical input matrix chosen from original image, can be with
It is determined according to the needs of subsequent similarity calculation.
Step S103:The horizontal input matrix and vertical input matrix are respectively divided into corresponding multiple block of pixels.
In specific implementation, horizontal input matrix and vertical input matrix can be drawn respectively according to the actual needs
It is divided into corresponding multiple equal-sized block of pixels.Meanwhile it is adjacent in multiple block of pixels for dividing of horizontal input matrix
Block of pixels between partly overlap, partly weighed between adjacent block of pixels in multiple block of pixels that vertical input matrix divides
It is folded.Wherein, in the lap in horizontal input matrix between adjacent pixel blocks, and vertical input matrix adjacent pixel blocks it
Between lap, can set on demand.For example, the superposition image in horizontal input matrix with a row between adjacent pixel blocks
Element, the overlaid pixel with a line in adjacent pixel blocks in vertical input matrix.
Step S104:Based on the similarity letter between adjacent pixel blocks in the horizontal input matrix and vertical input matrix
Breath, determines the fringe region of the original image.
In specific implementation, it is respectively divided and is corresponded to when by horizontal input matrix in original image and vertical input matrix
Multiple block of pixels when, the similarity in horizontal input matrix and vertical input matrix between adjacent pixel blocks can be utilized to believe
Breath, determines the fringe region of original image, compared with carrying out edge detection using the similarity between pixel, adjacent pixel blocks
In pixel edge region there is the discrimination of bigger, thus the accuracy of Image Edge-Detection can be improved, and can be with
Calculation amount is reduced simultaneously, improves the speed of edge detection.
Above-mentioned scheme passes through adjacent pixel in selected horizontal input matrix in original image and vertical input matrix
Similarity between block can determine corresponding image border, can reduce the operation complexity of Image Edge-Detection, and can
To improve the accuracy of edge detection.
Further detailed description will be done to the method for detecting image edge in the embodiment of the present invention below.
Fig. 2 shows the flow charts of another method for detecting image edge in the embodiment of the present invention.Referring to Fig. 2, this hair
A kind of method for detecting image edge in bright embodiment, the edge suitable for the original image to input are detected, specifically can be with
It is realized using following operation:
Step S201:Obtain the original image of input.
In specific implementation, the pixel in the original image of input can carry out table with corresponding channel components respectively
Show and is intervally arranged.
Referring to Fig. 3, by taking the size of the original image of input is 13*13 as an example, the corresponding channel components of each pixel can
Think one of G components, R component or B component, and in vertical direction with channel that in horizontal direction, neighbor pixel is taken
Pixel component it is different.
Step S202:Horizontal input matrix and vertical input matrix are chosen from the original image.
It in specific implementation, can basis when choosing horizontal input matrix and vertical input matrix from original image
The size of the similarity matrix generated is needed to be chosen in subsequent step.
Referring to Fig. 4 and Fig. 5, equally by taking the size of the original image of input is 13*13 as an example, when the phase for finally needing to generate
When size like degree matrix is 5*5, corresponding horizontal input matrix includes the part in frame a, i.e., horizontal direction includes 2~12
Row vertically includes 2~12 rows, and the size of each block of pixels is 3*3, and has one-row pixels between adjacent block of pixels
Overlapping;Corresponding vertical input matrix includes the part in frame b, i.e. 0~12 row of horizontal direction, and the 2~12 of vertical direction
Row, and the size of each block of pixels is 3*3, and there is row pixel overlapping between adjacent block of pixels.
Step S203:The horizontal input matrix and vertical input matrix are respectively divided into corresponding multiple block of pixels.
In specific implementation, it is divided in the quantity for the block of pixels for dividing horizontal input matrix and vertical input matrix
In lap and vertical input matrix in the quantity of obtained block of pixels and horizontal input matrix between adjacent pixel blocks
Lap between adjacent pixel blocks is related to the size for the similarity matrix being subsequently generated.
It is similar when finally needing to generate when the size of the original image of input is 13*13 with continued reference to Fig. 4 and Fig. 5
When the size for spending matrix is 5*5, need horizontally and vertically respectively the presence of corresponding 5 pairs of adjacent pixel blocks, at this point it is possible to
The size of block of pixels in horizontal input matrix and vertical input matrix is set as 3*3, and adjacent picture in horizontal input matrix
Plain block, between there is row pixel overlapping, there is in vertical input matrix the overlapping of one-row pixels point between adjacent pixel blocks.Its
In, adjacent pixel blocks are please respectively referring to dotted line frame in Fig. 4 and Fig. 5 and corresponding in horizontal input matrix and vertical input matrix
Filling region.
Step S204:Calculate separately in the horizontal input matrix in horizontal direction the similarity numerical value of adjacent pixel blocks and
The similarity numerical value of vertically adjacent block of pixels in the vertical input matrix, obtains corresponding horizontal direction similarity moment
Battle array and vertical direction similarity matrix.
In an embodiment of the present invention, it is calculated separately in the horizontal input matrix in horizontal direction using following formula
The similarity numerical value of vertically adjacent block of pixels in the similarity numerical value of adjacent pixel blocks and the vertical input matrix:
D=∑s | vblock1[i]-vblock2[i]| (1)
Wherein, i indicates that pixel ith pixel point in the block, D indicate the adjacent pixel blocks in horizontal direction or vertical direction
Similarity numerical value between middle ith pixel point, block1, block2 indicate adjacent in horizontal direction or vertical direction respectively
Block of pixels, and ith pixel point is the pixel with channel, v in adjacent pixel blocksblock1[i]、vblock2[i] indicates phase respectively
The pixel value of ith pixel point in adjacent block of pixels.
Step S205:By each phase in the horizontal direction similarity matrix and vertical direction similarity matrix that are calculated
It is compared respectively with corresponding intensity threshold like number of degrees value, and according to comparison result, generates corresponding horizontal intensity square respectively
Battle array and vertical intensity matrix.
In specific implementation, when corresponding horizontal direction similarity matrix and vertical direction similarity matrix is calculated
When, it can be corresponding by each similarity numerical generation in horizontal direction similarity matrix and vertical direction similarity matrix
Horizontal intensity matrix and vertical intensity matrix.
In an embodiment of the present invention, corresponding horizontal intensity matrix and vertical intensity square are determined by the way of following
Battle array:
It, will be corresponding strong when the similarity numerical value is less than or equal to preset first intensity threshold str_thresh0
Corresponding strength values are denoted as the first numerical value in degree matrix flag_strength [i, j], and such as 0;
When the similarity numerical value is more than first intensity threshold and is less than or equal to preset second intensity threshold
When str_thresh1, corresponding strength values flag_strength [i, j] in corresponding intensity matrix is denoted as second value,
And the second value is more than first numerical value, such as 1;
When the similarity numerical value is more than second intensity threshold and is less than or equal to preset third intensity threshold
When str_thresh2, corresponding strength values flag_strength [i, j] in corresponding intensity matrix is denoted as third value,
And the third value is more than the second value, such as 2;
It, will be in corresponding intensity matrix when the similarity numerical value is more than the third intensity threshold str_thresh3
Corresponding strength values are denoted as the 4th numerical value, and the 4th numerical value is more than the third value, such as 3.
Wherein, the first intensity threshold str_thresh0, the second intensity threshold str_thresh1, third intensity threshold str_
The numerical value of thresh3 can carry out value according to the actual needs.
Step S206:Based on the horizontal intensity matrix and the vertical intensity matrix, it is strong to generate corresponding image border
Spend matrix.
In an embodiment of the present invention, it when generating corresponding horizontal intensity matrix and vertical intensity matrix respectively, is based on
The horizontal intensity matrix and the vertical intensity matrix, can be from generating corresponding image border intensity by the way of following
Matrix, including:
Wherein, flag_stri,jIndicate the edge strength numerical value that the i-th row jth arranges in the intensity matrix of image border, hi,jIt indicates
The strength values that the i-th row jth arranges in the horizontal intensity matrix, vi,jIndicate the i-th row jth row in the vertical intensity matrix
Strength values, N indicate the line number and columns of the horizontal similarity matrix and vertical similarity matrix.
Step S207:From the marginal information extracted in described image edge strength matrix on corresponding direction.
It in specific implementation, can be according to image border intensity matrix when obtaining corresponding image border intensity matrix
In edge strength numerical value, extract corresponding direction on marginal information.
Referring to Fig. 6, the direction in the intensity matrix of image border includes 0 degree of direction, 45 degree of directions, 90 degree of directions, 135 degree of sides
To, 180 degree direction, 225 degree of directions, 270 degree of directions and 315 degree of directions.It extracts and corresponds to from described image edge strength matrix
Marginal information on direction, namely by the edge strength numerical value in the intensity matrix respective direction of image border, determine corresponding
Direction whether be image edge.
In an embodiment of the present invention, it when whether determine corresponding direction is edge direction, can obtain first described
Edge strength numerical value in the intensity matrix of image border in respective direction, and judge in the intensity matrix of image border in respective direction
Edge strength numerical value in be more than preset edge strength threshold value edge strength numerical value quantity numDWhether it is more than preset
Amount threshold num_thresh;When determining the edge strength numerical value in the respective direction more than preset edge strength threshold value
Quantity numDWhen more than preset amount threshold num_thresh, it can determine that the respective direction is edge direction;Conversely,
It is edge direction that then can determine respective direction not.
In specific implementation, when it is edge direction to determine corresponding direction, the edge side can be obtained by calculation
The sum of upward edge strength numerical value, and based on the sum of the edge strength numerical value in the edge direction, judge edge power.
Wherein, it is two in the edge direction determined by above-mentioned mode, and identified two edge directions are same
On straight line, it may be determined that identified edge direction is the edge direction of image.But when identified edge direction
Only one, obtain determined by edge direction be two or more, and identified edge direction not on the same line when,
The central pixel point of horizontal input matrix and vertical input matrix determined by before can determining is angle point, and is being carried out subsequently
Image procossing when, as possible retain angle point information, to prevent in the pixel value of angle till point mistake update, so as to improve image
Handle quality.
The above-mentioned method for detecting image edge in the embodiment of the present invention is described in detail, below will be to above-mentioned
The corresponding device of method is introduced.
Fig. 7 shows a kind of structure of Image Edge-Detection device in the embodiment of the present invention.Referring to Fig. 7, the present invention is real
It may include acquiring unit 701, selection unit 702,703 and of division unit to apply a kind of Image Edge-Detection device 700 in example
Detection unit 704, wherein:
The acquiring unit 701 is suitable for obtaining the original image of input.
The selection unit 702, suitable for choosing horizontal input matrix and vertical input matrix from the original image.
The division unit 703, it is corresponding suitable for the horizontal input matrix and vertical input matrix to be respectively divided into
Multiple block of pixels;It partly overlaps between the multiple pixel adjacent pixel blocks in the block.
The detection unit 704, be suitable for based on adjacent pixel blocks in the horizontal input matrix and vertical input matrix it
Between similarity information, determine the fringe region of the original image.
In an embodiment of the present invention, the detection unit 704, it is horizontal in the horizontal input matrix suitable for calculating separately
On direction in the similarity numerical value of adjacent pixel blocks and the vertical input matrix vertically adjacent block of pixels similarity
Numerical value obtains corresponding horizontal direction similarity matrix and vertical direction similarity matrix;The horizontal direction phase that will be calculated
It is compared respectively with corresponding intensity threshold like each similarity numerical value in degree matrix and vertical direction similarity matrix;Root
According to each similarity numerical value in horizontal direction similarity matrix and vertical direction similarity matrix respectively with corresponding intensity threshold
The comparison result of value generates corresponding horizontal intensity matrix and vertical intensity matrix respectively;Based on the horizontal intensity matrix and
The vertical intensity matrix generates corresponding image border intensity matrix;It extracts and corresponds to from described image edge strength matrix
Marginal information on direction.
In an embodiment of the present invention, the detection unit 704, suitable for calculating separately the level using following formula
It is vertically adjacent in the similarity numerical value of adjacent pixel blocks and the vertical input matrix in horizontal direction in input matrix
The similarity numerical value of block of pixels:D=∑s | vblock1[i]-vblock2[i]|;Wherein, i indicates pixel ith pixel point in the block, D
Similarity numerical value in adjacent pixel blocks in expression horizontal direction or vertical direction between ith pixel point, block1,
Block2 indicates the adjacent pixel blocks in horizontal direction or vertical direction respectively, and ith pixel point is same in adjacent pixel blocks
The pixel in channel, vblock1[i]、vblock2[i] indicates the pixel value of ith pixel point in adjacent pixel blocks respectively.
In an embodiment of the present invention, the detection unit 704 is suitable for presetting when the similarity numerical value is less than or equal to
The first intensity threshold when, corresponding strength values in corresponding intensity matrix are denoted as the first numerical value;When the similar number of degrees
Value, will be corresponding in corresponding intensity matrix more than first intensity threshold and when being less than or equal to preset second intensity threshold
Strength values be denoted as second value;The second value is more than first numerical value;Described in being more than when the similarity numerical value
Second intensity threshold and less than or equal to preset third intensity threshold when, by corresponding strength values in corresponding intensity matrix
It is denoted as third value;The third value is more than the second value;When the similarity numerical value is more than the third intensity threshold
When value, corresponding strength values in corresponding intensity matrix are denoted as the 4th numerical value;4th numerical value is more than the third number
Value.
In an embodiment of the present invention, the detection unit 704 is suitable for being based on the horizontal intensity by the way of following
Matrix and the vertical intensity matrix, generate corresponding image border intensity matrix:
Wherein, flag_stri,jIndicate the edge strength numerical value that the i-th row jth arranges in the intensity matrix of image border, hi,jIt indicates
The strength values that the i-th row jth arranges in the horizontal intensity matrix, vi,jIndicate the i-th row jth row in the vertical intensity matrix
Strength values, N indicate the line number and columns of the horizontal similarity matrix and vertical similarity matrix.
In an embodiment of the present invention, the detection unit 704 is suitable for obtaining corresponding in described image edge strength matrix
Edge strength numerical value on direction;When determine in the respective direction be more than preset edge strength threshold value edge strength numerical value
Quantity be more than preset amount threshold when, determine the respective direction be edge direction;It is calculated in the edge direction
The sum of edge strength numerical value;Based on the sum of the edge strength numerical value in the edge direction, edge power is judged.
In an embodiment of the present invention, the detection unit 704 is further adapted for when there is only unique edge direction or institutes
Determining edge direction be it is more than two and not on the same line when, determine the horizontal input matrix and vertical input matrix
Pixel center point be angle point.
Using the said program in the embodiment of the present invention, by horizontal input matrix selected in original image and vertically
Similarity in input matrix between adjacent pixel blocks can determine corresponding image border, can reduce image border inspection
The operation complexity of survey, and the accuracy of edge detection can be improved.
It further, can be right in the edge direction according to being calculated when it is edge direction to determine respective direction
The sum of edge strength numerical value answered accurately distinguishes the edge power in respective direction, and then can improve at image
The quality of reason.
Further, when being more than two there is only unique edge direction or identified edge direction and non-be located at
When same straight line, determines that corresponding pixel center point is angle point, the angle point information in image can be accurately determined, in image
The information for retaining angle point when processing, to improve the image quality of image.
One of ordinary skill in the art will appreciate that all or part of step in the various methods of above-described embodiment is can
It is completed with instructing relevant hardware by program, which can be stored in computer readable storage medium, and storage is situated between
Matter may include:ROM, RAM, disk or CD etc..
The method and system of the embodiment of the present invention are had been described in detail above, the present invention is not limited thereto.Any
Field technology personnel can make various changes or modifications without departing from the spirit and scope of the present invention, therefore the guarantor of the present invention
Shield range should be subject to claim limited range.
Claims (14)
1. a kind of method for detecting image edge, which is characterized in that including:
Obtain the original image of input;
Horizontal input matrix and vertical input matrix are chosen from the original image;
The horizontal input matrix and vertical input matrix are respectively divided into corresponding multiple block of pixels;The multiple block of pixels
In adjacent pixel blocks between partly overlap;
Based on the similarity information between adjacent pixel blocks in the horizontal input matrix and vertical input matrix, the original is determined
The fringe region of beginning image.
2. method for detecting image edge according to claim 1, which is characterized in that described to be based on the horizontal input matrix
And the similarity information in vertical input matrix between adjacent pixel blocks, determine the fringe region of the original image, including:
Calculate separately the similarity numerical value of adjacent pixel blocks and the vertical input in horizontal direction in the horizontal input matrix
The similarity numerical value of vertically adjacent block of pixels in matrix, obtains corresponding horizontal direction similarity matrix and vertical direction
Similarity matrix;
By each similarity numerical value difference in the horizontal direction similarity matrix and vertical direction similarity matrix that are calculated
It is compared with corresponding intensity threshold;
According to each similarity numerical value in horizontal direction similarity matrix and vertical direction similarity matrix respectively with it is corresponding
The comparison result of intensity threshold generates corresponding horizontal intensity matrix and vertical intensity matrix respectively;
Based on the horizontal intensity matrix and the vertical intensity matrix, corresponding image border intensity matrix is generated;
From the marginal information extracted in described image edge strength matrix on corresponding direction.
3. method for detecting image edge according to claim 2, which is characterized in that calculate separately institute using following formula
State adjacent pixel blocks in horizontal direction in horizontal input matrix similarity numerical value and the vertical input matrix in vertical direction
The similarity numerical value of upper adjacent pixel blocks:
D=∑s | vblock1[i]-vblock2[i]|;
Wherein, i indicates pixel ith pixel point in the block, and D indicates in the adjacent pixel blocks in horizontal direction or vertical direction the
Similarity numerical value between i pixel, block1, block2 indicate the adjacent pixel in horizontal direction or vertical direction respectively
Block, and ith pixel point is the pixel with channel, v in adjacent pixel blocksblock1[i]、vblock2[i] indicates adjacent picture respectively
The pixel value of ith pixel point in plain block.
4. method for detecting image edge according to claim 2, which is characterized in that described according to horizontal direction similarity moment
Each similarity numerical value in battle array and vertical direction similarity matrix is given birth to respectively respectively with the comparison result of corresponding intensity threshold
At corresponding horizontal intensity matrix and vertical intensity matrix, including:
It, will be corresponding strong in corresponding intensity matrix when the similarity numerical value is less than or equal to preset first intensity threshold
Number of degrees value is denoted as the first numerical value;
It, will be right when the similarity numerical value is more than first intensity threshold and is less than or equal to preset second intensity threshold
Corresponding strength values are denoted as second value in the intensity matrix answered;The second value is more than first numerical value;
It, will be right when the similarity numerical value is more than second intensity threshold and is less than or equal to preset third intensity threshold
Corresponding strength values are denoted as third value in the intensity matrix answered;The third value is more than the second value;
When the similarity numerical value is more than the third intensity threshold, corresponding strength values in corresponding intensity matrix are remembered
For the 4th numerical value;4th numerical value is more than the third value.
5. method for detecting image edge according to claim 2, which is characterized in that described to be based on the horizontal intensity matrix
With the vertical intensity matrix, corresponding image border intensity matrix is generated, including:
Wherein, flag_stri,jIndicate the edge strength numerical value that the i-th row jth arranges in the intensity matrix of image border, hi,jDescribed in expression
The strength values that the i-th row jth arranges in horizontal intensity matrix, vi,jIndicate the intensity that the i-th row jth arranges in the vertical intensity matrix
Numerical value, N indicate the line number and columns of the horizontal similarity matrix and vertical similarity matrix.
6. according to claim 2-5 any one of them method for detecting image edge, which is characterized in that described from described image side
The marginal information on corresponding direction is extracted in edge intensity matrix, including:
Obtain the edge strength numerical value in respective direction in described image edge strength matrix;
When determine in the respective direction more than preset edge strength threshold value edge strength numerical value quantity be more than it is preset
When amount threshold, determine that the respective direction is edge direction;
The sum of the edge strength numerical value in the edge direction is calculated;
Based on the sum of the edge strength numerical value in the edge direction, edge power is judged.
7. method for detecting image edge according to claim 6, which is characterized in that described from described image edge strength square
The marginal information on corresponding direction is extracted in battle array, further includes:
When there is only unique edge direction or identified edge direction be it is more than two and not on the same line when, really
The pixel center point of the fixed horizontal input matrix and vertical input matrix is angle point.
8. a kind of Image Edge-Detection device, which is characterized in that including:
Acquiring unit is suitable for obtaining the original image of input;
Selection unit, suitable for choosing horizontal input matrix and vertical input matrix from the original image;
Division unit, suitable for the horizontal input matrix and vertical input matrix are respectively divided into corresponding multiple block of pixels;
It partly overlaps between the multiple pixel adjacent pixel blocks in the block;
Detection unit is suitable for based on the similarity letter between adjacent pixel blocks in the horizontal input matrix and vertical input matrix
Breath, determines the fringe region of the original image.
9. Image Edge-Detection device according to claim 8, which is characterized in that the detection unit, suitable for counting respectively
It calculates in the horizontal input matrix vertical in the similarity numerical value of adjacent pixel blocks and the vertical input matrix in horizontal direction
The similarity numerical value of adjacent pixel blocks on direction, obtains corresponding horizontal direction similarity matrix and vertical direction similarity moment
Battle array;By each similarity numerical value in the horizontal direction similarity matrix and vertical direction similarity matrix that are calculated respectively with
Corresponding intensity threshold is compared;According to each similar in horizontal direction similarity matrix and vertical direction similarity matrix
Number of degrees value with the comparison result of corresponding intensity threshold, generates corresponding horizontal intensity matrix and vertical intensity square respectively respectively
Battle array;Based on the horizontal intensity matrix and the vertical intensity matrix, corresponding image border intensity matrix is generated;From the figure
As extracting the marginal information on corresponding direction in edge strength matrix.
10. Image Edge-Detection device according to claim 9, which is characterized in that the detection unit is suitable for using such as
Under formula calculate separately in the horizontal input matrix in horizontal direction the similarity numerical value of adjacent pixel blocks and described vertical
The similarity numerical value of vertically adjacent block of pixels in input matrix:
D=∑s | vblock1[i]-vblock2[i]|;
Wherein, i indicates pixel ith pixel point in the block, and D indicates in the adjacent pixel blocks in horizontal direction or vertical direction the
Similarity numerical value between i pixel, block1, block2 indicate the adjacent pixel in horizontal direction or vertical direction respectively
Block, and ith pixel point is the pixel with channel, v in adjacent pixel blocksblock1[i]、vblock2[i] indicates adjacent picture respectively
The pixel value of ith pixel point in plain block.
11. Image Edge-Detection device according to claim 9, which is characterized in that the detection unit is suitable for when described
When similarity numerical value is less than or equal to preset first intensity threshold, corresponding strength values in corresponding intensity matrix are denoted as
First numerical value;When the similarity numerical value is more than first intensity threshold and is less than or equal to preset second intensity threshold
When, corresponding strength values in corresponding intensity matrix are denoted as second value;The second value is more than first numerical value;
It, will be corresponding when the similarity numerical value is more than second intensity threshold and is less than or equal to preset third intensity threshold
Corresponding strength values are denoted as third value in intensity matrix;The third value is more than the second value;When described similar
When number of degrees value is more than the third intensity threshold, corresponding strength values in corresponding intensity matrix are denoted as the 4th numerical value;Institute
It states the 4th numerical value and is more than the third value.
12. Image Edge-Detection device according to claim 9, which is characterized in that the detection unit is suitable for using such as
Under mode be based on the horizontal intensity matrix and the vertical intensity matrix, generate corresponding image border intensity matrix:
Wherein, flag_stri,jIndicate the edge strength numerical value that the i-th row jth arranges in the intensity matrix of image border, hi,jDescribed in expression
The strength values that the i-th row jth arranges in horizontal intensity matrix, vi,jIndicate the intensity that the i-th row jth arranges in the vertical intensity matrix
Numerical value, N indicate the line number and columns of the horizontal similarity matrix and vertical similarity matrix.
13. according to claim 9-12 any one of them Image Edge-Detection devices, which is characterized in that the detection unit,
Suitable for obtaining the edge strength numerical value in described image edge strength matrix in respective direction;It is big in the respective direction when determining
When the quantity of the edge strength numerical value of preset edge strength threshold value is more than preset amount threshold, the respective direction is determined
For edge direction;The sum of the edge strength numerical value in the edge direction is calculated;Based on the edge in the edge direction
The sum of strength values judge edge power.
14. Image Edge-Detection device according to claim 13, which is characterized in that the detection unit is further adapted for working as
There is only unique edge direction or identified edge direction be it is more than two and not on the same line when, determine described in
The pixel center of horizontal input matrix and vertical input matrix point is angle point.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710180247.XA CN108629786B (en) | 2017-03-23 | 2017-03-23 | Image edge detection method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710180247.XA CN108629786B (en) | 2017-03-23 | 2017-03-23 | Image edge detection method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108629786A true CN108629786A (en) | 2018-10-09 |
CN108629786B CN108629786B (en) | 2020-07-21 |
Family
ID=63707480
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710180247.XA Active CN108629786B (en) | 2017-03-23 | 2017-03-23 | Image edge detection method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108629786B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110766028A (en) * | 2019-10-23 | 2020-02-07 | 紫光展讯通信(惠州)有限公司 | Pixel type determination method and device |
CN113870297A (en) * | 2021-12-02 | 2021-12-31 | 暨南大学 | Image edge detection method and device and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101354783A (en) * | 2008-08-21 | 2009-01-28 | 华为技术有限公司 | Method and apparatus for detecting edge |
CN101430789A (en) * | 2008-11-19 | 2009-05-13 | 西安电子科技大学 | Image edge detection method based on Fast Slant Stack transformation |
CN102044071A (en) * | 2010-12-28 | 2011-05-04 | 上海大学 | Single-pixel margin detection method based on FPGA |
CN104200442A (en) * | 2014-09-19 | 2014-12-10 | 西安电子科技大学 | Improved canny edge detection based non-local means MRI (magnetic resonance image) denoising method |
CN104867160A (en) * | 2015-06-17 | 2015-08-26 | 合肥工业大学 | Directional calibration target for camera inner and outer parameter calibration |
CN105303566A (en) * | 2015-10-15 | 2016-02-03 | 电子科技大学 | Target contour clipping-based SAR image target azimuth estimation method |
-
2017
- 2017-03-23 CN CN201710180247.XA patent/CN108629786B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101354783A (en) * | 2008-08-21 | 2009-01-28 | 华为技术有限公司 | Method and apparatus for detecting edge |
CN101430789A (en) * | 2008-11-19 | 2009-05-13 | 西安电子科技大学 | Image edge detection method based on Fast Slant Stack transformation |
CN102044071A (en) * | 2010-12-28 | 2011-05-04 | 上海大学 | Single-pixel margin detection method based on FPGA |
CN104200442A (en) * | 2014-09-19 | 2014-12-10 | 西安电子科技大学 | Improved canny edge detection based non-local means MRI (magnetic resonance image) denoising method |
CN104867160A (en) * | 2015-06-17 | 2015-08-26 | 合肥工业大学 | Directional calibration target for camera inner and outer parameter calibration |
CN105303566A (en) * | 2015-10-15 | 2016-02-03 | 电子科技大学 | Target contour clipping-based SAR image target azimuth estimation method |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110766028A (en) * | 2019-10-23 | 2020-02-07 | 紫光展讯通信(惠州)有限公司 | Pixel type determination method and device |
CN113870297A (en) * | 2021-12-02 | 2021-12-31 | 暨南大学 | Image edge detection method and device and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN108629786B (en) | 2020-07-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109508681B (en) | Method and device for generating human body key point detection model | |
US11747898B2 (en) | Method and apparatus with gaze estimation | |
WO2018177379A1 (en) | Gesture recognition, gesture control and neural network training methods and apparatuses, and electronic device | |
CN104424482B (en) | Image processing equipment and image processing method | |
EP2864933B1 (en) | Method, apparatus and computer program product for human-face features extraction | |
JP2022526548A (en) | Target detection methods, devices, electronic devices and computer readable storage media | |
US20180005014A1 (en) | Fingerprint identification system, fingerprint identification method, and electronic equipment | |
CN106504276A (en) | The combinations matches cost algorithms of non local Stereo Matching Algorithm and parallax joint filling algorithm | |
CN104867225B (en) | A kind of bank note towards recognition methods and device | |
CN106530271B (en) | A kind of infrared image conspicuousness detection method | |
CN103605716B (en) | Data processing method and device used for webpage click display | |
CN106412573A (en) | Method and device for detecting lens stain | |
CN109376631A (en) | A kind of winding detection method and device neural network based | |
CN111641822B (en) | Method for evaluating quality of repositioning stereo image | |
EP3074844B1 (en) | Estimating gaze from un-calibrated eye measurement points | |
WO2016026238A1 (en) | Image border recognition method, device and display panel | |
CN111325107A (en) | Detection model training method and device, electronic equipment and readable storage medium | |
CN103761011B (en) | A kind of method of virtual touch screen, system and the equipment of calculating | |
CN103226824A (en) | Video retargeting system for maintaining visual saliency | |
CN110879131A (en) | Imaging quality testing method and imaging quality testing device for visual optical system, and electronic apparatus | |
CN108629786A (en) | Method for detecting image edge and device | |
CN109753958A (en) | Image character recognition methods | |
TW201523459A (en) | Object tracking method and electronic apparatus | |
US12100212B2 (en) | Method, system and computer readable media for object detection coverage estimation | |
CN105530505B (en) | 3-D view conversion method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |