CN102819743A - Detection method for quickly identifying straight-line segments in digital image - Google Patents

Detection method for quickly identifying straight-line segments in digital image Download PDF

Info

Publication number
CN102819743A
CN102819743A CN2012102893990A CN201210289399A CN102819743A CN 102819743 A CN102819743 A CN 102819743A CN 2012102893990 A CN2012102893990 A CN 2012102893990A CN 201210289399 A CN201210289399 A CN 201210289399A CN 102819743 A CN102819743 A CN 102819743A
Authority
CN
China
Prior art keywords
line segment
direction value
pixel
straight
value
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
Application number
CN2012102893990A
Other languages
Chinese (zh)
Other versions
CN102819743B (en
Inventor
贾靓
闵革勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Qishuo Information Technology Co ltd
Original Assignee
Changzhou University
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Changzhou University filed Critical Changzhou University
Priority to CN201210289399.0A priority Critical patent/CN102819743B/en
Publication of CN102819743A publication Critical patent/CN102819743A/en
Application granted granted Critical
Publication of CN102819743B publication Critical patent/CN102819743B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Analysis (AREA)

Abstract

The invention relates to a calibration method for a specific pattern in an image, in particular to a detection method for quickly identifying straight-line segments in a digital image. The detection method comprises the following steps of: a, inputting a binary image with a unit pixel width; b, setting length parameters, variable parameters, pixel parameters and range parameters of the straight-line segments to be detected; c, obtaining rough straight-line segments; d, subdividing the detected straight-line segments; e, linking the straight-line segments, wherein a direction value difference between adjacent the straight-line segments and a current straight-line segment is smaller than a difference threshold and the direction value is used for quantifiably defining the direction of a neighbor domain of a foreground pixel, which is relative to the central position of the foreground pixel and the difference threshold means a threshold of the difference of direction values and is a quantitative criterion for judging whether the directions of two straight-line segments are identical or not; and f, returning the found straight-line segments. According to the detection method disclosed by the invention, the detection speed is superior to that of the known current TODIS (Two-Orthogonal Direction Image Scanning) with better precision; the detection precision is higher than that of KHT (Kernel-based Hough Transform) and EDlines (Edge Drawing Algorithm); and the precision is not lower than that of TOIDS.

Description

A kind of quick identification digital picture line segment detection method
Technical field
The present invention relates to a kind of calibrating method particularly a kind of quick identification digital picture line segment detection method to special pattern in the image.
Background technology
In computer vision and machine vision subject, it is a kind of line detection method that can provide digital picture cathetus length and position simultaneously that straight-line segment detects.Its application is very extensive, for example: compression of images, material gap detection, stereoscopic vision, Road Detection, robot navigation etc.Simultaneously, it also is based on a kind of basic some characteristic that is used in the target identification method of graph theory.Therefore, line segment detects not only has application value realistic in commercial production, and is to constitute the more important foundation of complicated algorithm.
The line segment detecting method of current domestic and international main flow mainly contains three kinds: the line segment based on straight-line detection detects, detects based on the line segment detection of gradient information with based on the line segment that follow the tracks of on the border.
(1) the line segment detection based on straight-line detection is on the basis of straight-line detection, the straight line to having been discerned by straight-line detection in image, and the distribution according to the boundary pixel on it provides line segment.The advantage of this method is directly to use existing ripe line detection algorithm.Because line detection method was the earliest come out in 1962; Through years of development; The kind of this method and quantity are very surprising, but major part is all based on Hough transformation, and the operand of Hough transformation is very huge; Because the existence of quantization error causes the uncertainty of parameter and the ghost peak in the parameter space, its rapidity is relatively poor.To the problems referred to above of Hough transformation, nineteen nineties such as Xu have proposed randomized hough transform (randomized Hough transform is called for short RHT).Randomized hough transform adopts many to one mapping; Avoided standard Hough transformation (standard Hough transformm; Be called for short SHT) a huge calculated amount to many mappings, and randomized hough transform algorithm use dynamic link table structure, only to how to accumulate to the resulting parameter allocation units of a mapping; Reduce memory requirements, made randomized hough transform have characteristics such as parameter space infinity, any height of parameters precision simultaneously.Yet when the dealing with complicated image,, the performance of method is greatly reduced because stochastic sampling can be introduced a large amount of invalid sampling and accumulation.Though straight-line detection is innovated to some extent in recent years, for example Fernandes is in KHT algorithm (the Gaussian Kernel-based Hough Transform of proposition in 2008; Chinese name: the Hough transformation based on gaussian kernel, see L.A.F.Fernandes for details, M.M.Oliveira; " Real-time line detection through an improved Hough transform voting scheme ", Pattern Recognition, vol.41; No.1, the N point that pp.299-314.Jan.2008) proposed in 2009 with Mochizuki Hough algorithm at random (sees Y.Mochizuki for details, A.Torii; A.Imiya; " N-Point Hough transform for line detection ", Journal of Visual Communication and Image Representation, vol.20; No.4, pp.242-253.May.2009).Find that through analysing in depth though these new methods have adopted new Hough transformation form, these new transform methods more and more depend on the preprocessing process in early stage.Such as the KHT algorithm; Though used statistical binary gauss of distribution function to produce the straight line peak value; But the calculation of parameter of this statistical function link and the partitioning algorithm that Pope proposed in 1987 with Lowe in 1994 that place one's entire reliance upon in fact; The KHT algorithm has obtained the sample space of every straight line through the algorithm of Pope and Lowe, and then could use Gaussian function.With the KHT class of algorithms seemingly, the Hough algorithm is owing to use the point of combination at random to produce peak value at random for the N point, in order to reduce issuable combination sum, Mochizuki has also used Processing Algorithm in earlier stage.In fact these preprocessing process are equivalent to simple line segment and detect, because they provide the point set with better collinearity for follow-up Hough transformation, and the non-traditional discrete point that does not possess geometric meaning.Though precision and the efficient of new algorithm on straight-line detection had had raising more in the past, these algorithms do not consider that at the beginning of design line segment detects, so need post-processed process of extra interpolation, from detected straight line, are partitioned into line segment.And (see C.Akinlar for details, C.Topal, " EDLines:Areal-time line segment detector with a false detection control " in analysis in 2011 according to Akinlar; Pattern Recognition Letters, vol.32, no.13; Pp.1633-1642.Oct.2011); These algorithms can merge discontinuous line segment, produce a large amount of wrong testing results, application difficult in complicated graphs image detection comparatively.So, detect very difficult completion fast processing task based on the line segment of straight-line detection, thereby present this method of the less employing of line segment detection algorithm.
(2) basic principle that detects based on the line segment of gradient information is to come from line detection method (J.B.Burns, A.R.Hanson, the E.M.Riseman that Burns proposed in 1986; " Extracting straight lines "; IEEE Trans.Pattern Anal.Machine Intell., vol.8, no.4; Pp.425-455.1986), the key idea of this method is to use the gradient direction of the boundary pixel that is produced by the second-order differential operator to discern straight line.In decades, various line segment detecting methods based on gradient information constantly develop.In 2008, Gioi proposed a kind of quick line segment detection algorithm LSD (ALine Segment Detector, Chinese name: a kind of straight-line segment detection algorithm of exempting to regulate parameter; See G.v.Gioi for details; R.Jakubowicz, J.Morel, J.M.Randall; " LSD:A Line Segment detector with a false detection control "; CMLA.Centre de Mathematiques et de leurs Applications, Ecole Normale Superieure de Cachan (ENS-CACHAN), Germany.2008).LSD is at precision acceptable at that time, the fastest line segment detecting method.Yang proposed in 2011 the TODIS algorithm (A Line Segment Detector Using Two-orthogonal Direction Image Scanning, Chinese name: the straight-line segment detection algorithm based on biorthogonal image scanning, see K.Yang for details; S.S.Ge, H.He, " Robust line detection using two-orthogonal direction image scanning "; Computer Vision and Image Understanding, vol.115, no.8; Pp.1207-1222.Aug.2011); The precision of TODIS has surpassed LSD, can discern a plurality of line segments more accurately, but its speed is merely 1/8 of LSD.EDLines algorithm (the A Real-time Line Segment Detector with a False Detection Control Based on Edge Drawing Algorithm that Akinlar proposed in 2011; Chinese name: a kind of based on the edge rendering algorithm, the real-time straight-line segment detection algorithm that error-detecting is controlled) speed is near 10 times of LSD.The efficient of EDLines algorithm than before is improved largely, and has possessed the using value of fast detecting.Through analyzing EDLines, find to realize that the key of this efficiency of algorithm is that jointing edge detects and line segment detects, i.e. the input of EDLines is not a discrete point, but through pretreated point set with certain geological information.This and the KHT class of algorithms are seemingly; The pre-service of different is EDLines has adopted the edge detection algorithm of a kind of new Edge drawing by name that Topal proposed in 2010 (to see C.Topal for details; C.Akinlar, Y.Genc, " Edge drawing:a heuristic approach to robust real-time edge detection "; ICPR, to be published).Because input is the border of link, EDLines is as long as cut apart or merges it, adds that checking just can accomplish the line segment detection.
But, find that through analyzing there is following key issue in the EDLines detection method.
The first, detect for the specific line segment in the specific environment, the parameter regulation characteristic of exempting from of this method comes down to a kind of defective.In different application, to the line segment that will detect with detect in the interference that receives be different.In a kind of specific environment, arrive a more satisfactory detection effect, need test in a large number by detecting requirement in this environment, confirm could accomplish to the parameter of this environment and target thereof.Exempting from parameter regulation is a kind of pervasive character, runs counter to the optimization method of practical application.
The second, line segment detects and adopted thresholding is the least square method of 1 pixel, and fixing thresholding has reduced accuracy of detection.Because it exempts from parameter character; The thresholding of 1 pixel can not change; This has directly caused this algorithm can only detect curved transition being almost 0 ideal line, seeing that from its actual testing result the line segment with the non-zero curvature of small size variation often is split into a plurality of little line segments.If line segment to be detected requires certain length, this characteristic of cutting apart can significantly reduce accuracy of detection.
The 3rd, the proof procedure of this algorithm relies on gradient direction, and skips the checking to long line segment.In fact, owing to be input as the point set that Edge drawing produces by gradient direction, and proof procedure still uses gradient direction as foundation, has reduced the checking meaning.And adopt and only verify short line segment, long line segment is not done the strategy of checking, though reduced calculated amount, reduced verification the verifying results.Therefore, the precision of this algorithm is compared with LSD, is not greatly improved.
(3) notion that the line segment of following the tracks of based on the border detects proposed (A.Etemadi, " Robust segmentation ofedge data ", Conf.on Image Processing and its Applications by Etemadi the earliest in 1992; USA; 1992, pp.311-314), this method is used the frontier point information that is produced by rim detection; Move on border through forming along frontier point; Adjacent frontier point is linked as curve, according to certain criterion curve is cut apart again, thereby obtain line segment.The advantage of the algorithm of Etemadi is that simple shortcoming is that the line segment accuracy of detection is lower fast, and residual in result images have a more long short line segment of 5,6 pixels that only has.These years, though the Etemadi algorithm is applied in the various visual tasks morely, never what improve, and still rest on the level of the nineties in last century.
The development trend of line segment detection at present is to launch around gradient information basically; Though precision and efficient were greatly improved more in the past; But because algorithm in recent years too relies on gradient information; The geological information of having ignored border itself, and lack effective pre-processing and aftertreatment means, thereby innovation and room for improvement that line segment detects are still very big.And still pressing for the speed and the precision of line segment detecting method, practical applications is greatly improved.
Summary of the invention
The technical matters that the present invention will solve is: in order to overcome deficiency of the prior art; The present invention provides a kind of quick identification digital picture line segment detection method; This method has adopted and the habitual both at home and abroad in the past different theories based on the Hough transformation theoretical method; In conjunction with the gradient information and the geometric properties of pixel in the digital picture, the Statistics Application method has the straight-line segment of given geometrical characteristic rapidly and accurately in the detected image.Through analyzing and the more popular line segment detecting method and the computation complexity of this method; Its recognition speed and accuracy reach to a certain extent; Even surpassed present known international same class methods, thereby possessed industrial application value and academic theoretical value preferably.
(1) because present international mainstream line Segment Detection has generally adopted the printenv design; Reduced the manual intervention degree, this design has certain advantage in some aspects, but in the commercial production practical application; Because actual the requirement varies; The design of printenvization only detects according to its preset internal logic, can produce a large amount of garbages, can't satisfy the requirement of industrial scale applications to detection speed and accuracy.The present invention is through requiring artificial input or setting four parameters; Be line segment length, line segment curved transition degree, exploratory link pixel count and line segment range of fusion; Require and implementation condition according to the external world, change algorithm internal logic and calculated amount automatically, than the printenv design; To the straight-line segment that will detect have in the commercial Application of particular requirement, can provide result accurately with suitable speed.
(2) according to the theoretical classification of use, line Segment Detection commonly used at present roughly comprises based on three types of Hough transformation principle, gradient information and geological informations.Because the Hough transformation calculated amount is excessive, adopt the method inefficiency of this principle, precision is general, and more representational in recent years is the KHT method that was born in 2008.The gradient information method has than quantum jump on speed, but still little with traditional Hough transformation method difference on the precision, recent typical method is the EDLines method that occurs in 2011.The geological information method does not have big breakthrough throughout the year, still rests on the level of the nineties in last century, typical Etemadi method like birth in 1992.The present invention has combined gradient information and two kinds of methods of geometric properties; Evaded the EDLines method use single gradient information and integrated curing early stage boundary detection method mentality of designing; Detect with the later stage line segment through separating the early stage border detection, make the present invention to arrange in pairs or groups with any boundary detection method by Modularly, completion detection task; And the present invention does not rely on single gradient information; But, carry out the detection task targetedly according to given geometric parameter, in testing process, use statistical method that testing result is revised in real time.Through effect comparison and computational complexity analysis, speed of the present invention is apparently higher than KHT method and Etemadi method, a little less than the EDLines method; Its accuracy is higher than the EDLines method apparently higher than KHT method and Etemadi method.
The technical solution adopted for the present invention to solve the technical problems is: a kind of quick identification digital picture line segment detection method may further comprise the steps:
(a) input has the wide bianry image of unit picture element; Described bianry image is made up of foreground pixel and two kinds of pixels of background pixel; Foreground pixel refers to comprise the pixel of some graphical information; Background pixel refers to not comprise the pixel of graphical information: by rim detection bianry image is provided, re-uses the bone method and obtain having the wide bianry image of unit picture element;
(b) length parameter, running parameter, pixel parameter and the range parameter of setting straight-line segment to be detected: length parameter refers to can accept in the final detection result minimum length of straight-line segment; Running parameter refers to the tolerance to straight-line segment curved transition degree, and tolerance is big more, and then detected straight-line segment is more near segment of curve, and promptly straight-line segment is made up of the sub-line segment that several sections directions have notable difference; When the pixel parameter refers to that significant change takes place in straight-line segment local curvature, the number of pixels of exploratory link; Range parameter refers to line segment range of fusion parameter;
(c) obtain coarse straight-line segment;
(d) the detected straight-line segment of segmentation;
(e) difference of that close on and direction value current straight-line segment of link is less than the straight-line segment of difference threshold values: described direction value is that the territory of facing to foreground pixel quantizes definition with respect to the direction of its center; The threshold values of the difference of described difference threshold values finger direction value is used to judge the quantitative criteria that two straight-line segment directions are whether identical;
(f) return the straight-line segment that is found.
The concrete steps of described step (c) do
(c1) difference and the difference threshold values of definition direction value, direction value;
(c2) in certain sequence the bianry image of importing in the step (a) is scanned; Confirm the specific direction value according to the current images scanning sequency, described specific direction value refer to be no more than the difference threshold values with the difference of representing the direction value of direction of scanning all point to the not direction value of scanning area;
(c3) when finding foreground pixel; Suspending scanning, is the center with the foreground pixel, only detect the specific direction value described in the step (c2) pointed face the territory; If discovery foreground pixel; Then continue to detect the territory of facing that the specific direction value described in the step (c2) points to, repeat this process, in facing the territory, do not find foreground pixel or arrive at till the image boundary;
(c4) exploratory link: confirm the initial direction value; Described initial direction value is after removing the specific direction value described in the step (c2); Close on the direction of scanning but point to the not direction of scanning area, described closing on is meant in image space between 2 pixels not other pixel at interval; Last foreground pixel to find in the step (c3) is a starting point, and inspection initial direction value is pointed faces the territory and whether have foreground pixel; If find new foreground pixel, it is background pixel that old foreground pixel then is set, and writes down its direction value and the new foreground pixel of exploratory link; Repeat this process and equal the pixel parameter, or before sum does not reach the pixel parameter, do not find new foreground pixel until the foreground pixel sum that is linked;
(c5) in exploratory link process; Set up an ephemeral data structure and a permanent data structure that is used for permanent preservation; Described permanent data structure comprises temporary realm and permanent area; Write down the pixel count of each direction value and dynamically obtain maximum direction value at current time; The pixel count of described direction value refers to get the foreground pixel number of this direction value, and described maximum direction value refers to have the direction value of maximum foreground pixel numbers: the pixel count of each direction value that all produce in exploratory link process is recorded in the ephemeral data structure after the initialization;
In each exploratory connection; If the number of the foreground pixel that has linked is not found new foreground pixel around reaching pixel parameter and current pixel, check then whether the number of the foreground pixel that in exploratory link process, is linked surpasses length parameter, if surpass; Then write down all pixels that linked; And they are designated the straight line section, if do not surpass, then abandon these pixels;
If still there is new foreground pixel in the number of the foreground pixel that has linked around reaching pixel parameter and current pixel; Then with the direction value record of the direction value of current pixel and last exploratory link in the temporary realm of permanent data structure; And beginning poor according to the direction value of waiting to link foreground pixel and maximum direction value, judge whether to continue to link;
(c6) if the difference of maximum direction value and the direction value of waiting to link foreground pixel less than the difference threshold values, then links this pixel and in the temporary realm of permanent data structure its direction value of record, otherwise start exploratory link once more in the current pixel position;
(c7) when exploratory link finishes, calculate the poor of maximum direction value and the maximum direction value in the permanent data structure temporary realm in the ephemeral data structure:
If difference is less than the difference threshold values; Then foreground pixel of being preserved by exploratory link in the ephemeral data structure and corresponding direction value are kept in the temporary realm of permanent data structure; Repeating step (c6) is till not finding new foreground pixel, arriving at image boundary; And then judge whether the foreground pixel in the permanent data structure temporary realm is saved to permanent area and reinitializes the ephemeral data structure according to length parameter;
If difference greater than the difference threshold values, is then ended link, judge whether the foreground pixel in the permanent data structure temporary realm is saved to permanent area and reinitializes the ephemeral data structure according to length parameter.
Foreground pixel and background pixel are defined as respectively has non-0 value pixel and 0 value pixel, perhaps respectively the value of being defined as be 255 pixel with value less than 255 pixel.
In the described step (c2), image scanning by from top to bottom, is carried out in proper order from left to right.
The definition of direction value is produced by filter window and direction linear module in the described step (c1), after the definition of the difference of completion direction value and direction value, defines the difference threshold values again.
In the described step (c1), as filter window, the filter window size is 3 * 3 with the number of the discrete value of employed two-dimensional filtering function in the digital picture and distribution shape thereof, and the direction value can be defined by round values, also can be angle value or radian value.After the definition direction value; Just can quantize the difference between the different directions, promptly come the poor of calculated direction value according to the difference criterion, described difference criterion is meant that two rectilinear direction deviations are in the difference threshold values; Promptly regard straight line as with equidirectional; For example, calculate less or bigger angle between the both direction, getting one of them is the poor of direction value.
Usually; When the direction value is angle value or radian value; Corresponding difference threshold values can be 45 ° or promptly when the difference of the direction value of two straight lines during less than 45 ° or
Figure BDA00002006976200072
, these two straight-line segments are regarded as has identical direction.
The direction value is defined by round values, and define as follows: the direction value of establishing x axle positive dirction is 0, and by counterclockwise, every direction value at a distance from 45 ° is followed successively by 1,2,3,4,5,6,7; The difference of direction value is provided by following formula:
if|dir1-dir2|>4then?difference=8-|dir1-dir2|;else?difference=|dir1-dir2|.
Wherein dir1 and dir2 represent the direction value of two straight-line segments respectively, and difference represents the difference of dir1 and dir2; The difference threshold values is defined as 2.Promptly when the difference of the direction value of two straight-line segments less than 2 the time, these two straight-line segments are regarded as the straight-line segment with equidirectional value.
In the described step (c2), the specific direction value is 6,7 and 0.
Through moving the experimental arrangement of developing and adopted step of the present invention (c) method based on Visual Studio on computers; The direction value information of every straight-line segment in the permanent data structure permanent area that great amount of images is handled and generated by step (c) by inquiry; Find that the direction value information that slightly changes the ideal line section of curvature generally has gaussian distribution characteristic, it is maximum direction value that an obvious peak value and this peak value are promptly only arranged; Segment of curve then has plural at least peak value.
According to this discovery; The pairing direction value information of every straight-line segment that is stored in the permanent data structure permanent area all can be to be detected; When the ratio of its maximum direction value and time general orientation value surpasses the running parameter of artificial input, both thought that this line segment was segment of curve and begins to cut apart.Therefore, the concrete steps of described step (d) do
(d1) the pairing direction value information of every the straight-line segment of detection of stored in permanent data structure permanent area, when the ratio of the maximum direction value of straight-line segment and time general orientation value surpassed running parameter, then this straight-line segment was segment of curve and cuts apart;
(d2) for the segment of curve of finding in the step (d1); Begin from its any end points; Check record direction value in the direction value of each pixel and the ephemeral data structure after initialization one by one; If the difference of any direction value that has write down in this direction value and the ephemeral data structure is greater than the difference threshold values, then this pixel of mark is potential cut-point and initialization ephemeral data structure; Repeat above-mentioned steps, on segment of curve have a few all tested;
(d3) distance between per two the potential cut-points of calculating if distance is not less than length parameter, is then cut apart this segment of curve at these two potential cut-points.
Detection through step (c) and step (d) with cut apart; Possibly exist the direction value difference different in the image less than the difference threshold values; And distance is less than the straight-line segment of length parameter between end points, and current subroutine can attempt to merge many straight-line segments with these characteristics, makes it to form single straight-line segment.The maximum difficult point of step (e) is how to walk always to explore near the straight-line segment it substantially by current straight-line segment.Through moving the experimental arrangement of developing and adopted step of the present invention (c) and step (d) method based on Visual Studio on computers; Great amount of images is handled and operation result by inquiry; It is less to find that straight-line segment curvature is put near intensity of variation therein, and promptly near the pixel orientation value the mid point has reflected the trend substantially of straight-line segment basically.
Therefore; The concrete steps of described step (e) be get with mid point or near mid point, be no more than 50% length parameter the zone in be the center a bit, satisfy the sub-line segment of length parameter, be sample with its direction value; Respectively from two end points of current straight-line segment; Search for for trend by sample, if the difference of the direction value of discovery and current straight-line segment then merges these two straight-line segments less than the straight-line segment of difference threshold values; Repeated multiple times is till no longer existing the straight-line segment that can merge.
In the described step (e), the mid point of getting with current straight-line segment is the center, satisfies the sub-line segment of length parameter, with the direction value of this sub-line segment as sample.
Described in the present invention to face the territory identical with definition known in those skilled in the art, promptly be meant to be in the filter window at center, the set that all pixels except that current pixel are formed with the current pixel.
The invention has the beneficial effects as follows, a kind of quick identification digital picture of the present invention line segment detection method,
(1) because the present invention implements with computer program, mainly be detection speed to be assessed through the computation complexity of routine analyzer.On computation complexity; Step of the present invention (c) is required calculated amount the best part because this part carries out indiscriminate projection unlike the Hough transformation that kind to each pixel, this part only to non-zero pixels and with it adjacent pixels analyze; Therefore its computation complexity is O (ls); Wherein l is the length of long straight-line segment, and s is the total number of line segment, and the computation complexity of Hough transformation is O (n 2), n is the one dimension of image.
Further analyze and show close relationship between l and the s.If the l of expression line segment length is very big, represent that so the s of line segment sum will be very little.Because line segment is long more, its occupied image space is just many more, and usually, this can cause the decline of line segment sum.On the contrary, if the line segment sum is a lot, the length of nose section just can not be big so.Therefore, the relation that between l and s, has a kind of mutual balance.Therefore, the required calculated amount of step of the present invention (c) is much smaller than O (n 2).
The complexity of step (d) is Max (O (s), O (ld)), and wherein d representative has the segment of curve sum that the search of O (s) complexity is found through execution.Because d can not be greater than s, the computation complexity of step (d) is the same with step (c), is O (ls).
The complexity of step (e) is O (s).
To sum up, the computation complexity of the computer program that the present invention was suitable for is O (ls), and according at document " Robust Line Detection Using Two-orthogonal Direction Image Scanning " (K.Yang; S.S.Ge, H.He, Computer Vision and Image Understanding; Vol.115, no.8, pp.1207-1222; Aug.2011.) to the analysis of BU-Scan process, the complexity of TODIS is O (n at least in 2).On analysis of complexity, detection speed of the present invention is to be superior to the known TODIS with better accuracy of detection at present.
(2) precision of the present invention intuitively is embodied in the digital picture line segment detection result contrast.Through a large amount of contrast, draw accuracy of detection of the present invention and be higher than KHT and EDLines, and precision of the present invention is not less than TOIDS, and TODIS is the known the highest line Segment Detection of precision at present.
Description of drawings
Below in conjunction with accompanying drawing and embodiment the present invention is further specified.
Fig. 1 is a main UML activity diagram of the present invention.
Fig. 2 is the definition figure of direction value in the specific embodiment of the present invention.
Fig. 3 is the UML activity diagram of step among the present invention (c).
Fig. 4 is the UML activity diagram of m pixel of exploratory link among Fig. 3.
Fig. 5 is the UML activity diagram that in 3 interim tabulations, writes down the relevant information of current pixel among Fig. 3.
Fig. 6 is the UML activity diagram that calculates searchDir among Fig. 3.
Fig. 7 is the UML activity diagram that writes down according to length of straigh line among Fig. 3.
Fig. 8 is the UML activity diagram of step among the present invention (d).
Fig. 9 is the UML activity diagram of step among the present invention (e).
Figure 10 is the UML activity diagram of link endpoints among Fig. 9.
Figure 11 is the UML activity diagram that finds end points among Figure 10.
Figure 12 is the comparison diagram of KHT and testing result of the present invention.
Figure 13 is the comparison diagram of EDLines and testing result of the present invention.
Figure 14 is the comparison diagram of TODIS and testing result of the present invention.
Figure 15 is the bianry image that indicates the direction value.
Figure 16 is the bianry image that indicates direction value and path.
Embodiment
Combine accompanying drawing that the present invention is done further detailed explanation now.
Fig. 1 has provided main UML activity diagram of the present invention.The present invention includes following steps:
(a) input has the wide bianry image of unit picture element; Described bianry image is made up of foreground pixel and two kinds of pixels of background pixel; Foreground pixel refers to comprise the pixel of some graphical information; Background pixel refers to not comprise the pixel of graphical information: by rim detection bianry image is provided, re-uses the bone method and obtain having the wide bianry image of unit picture element;
(b) length parameter, running parameter, pixel parameter and the range parameter of setting straight-line segment to be detected: length parameter refers to can accept in the final detection result minimum length of straight-line segment; Running parameter refers to the tolerance to straight-line segment curved transition degree, and tolerance is big more, and then detected straight-line segment is more near segment of curve, and promptly straight-line segment is made up of the sub-line segment that several sections directions have notable difference; When the pixel parameter refers to that significant change takes place in straight-line segment local curvature, the number of pixels of exploratory link; Range parameter refers to line segment range of fusion parameter;
(c) obtain coarse straight-line segment;
(d) the detected straight-line segment of segmentation;
(e) link closes on the straight-line segment with similarity direction value;
(f) return the straight-line segment that is found.
Below in conjunction with the UML activity diagram of Fig. 3 to Figure 11, respectively step among the present invention (c), step (d), step (e) are launched to describe.
Here be given under the specific precondition a kind of embodiment of the present invention.Specific precondition comprise following some: image scanning is carried out in proper order by from top to bottom from left to right; The filter window size is 3 * 3.The direction value is defined by Fig. 2; The difference of direction value is provided by following formula:
if|dir1-dir2|>4then?difference=8-|dir1-dir2|;else?difference=|dir1-dir2|.
Wherein dir1 and dir2 represent the direction value of two straight-line segments respectively, and difference represents its difference; The difference threshold values is defined as 2; Foreground pixel and background pixel are defined as the pixel with non-0 value and 0 value respectively.
The UML activity diagram of step (c) comprises Fig. 3 to Fig. 7.Variable m remarked pixel parameter among Fig. 3, variable minLength representes length parameter, and variable nextDirection preserves 3 * 3 search starting point direction values of facing in the territory, and length is 8 array.When program need check current pixel face the territory time; That can be in this array confirms that first will check faces the territory pixel, then be starting point, check by the direction opposite with current direction of scanning; In this embodiment, program will be in the search starting point by inspection counterclockwise.The corresponding current pixel direction of the index of nextDirection value; Such as current pixel value is dir; Then starting point is kept among the array member nextDirection [dir] that index is dir, and the search starting point is represented by variable searchDir that in Fig. 3 its value is provided by following formula:
if?dir?is?even,then?searchDir=(dir+7)mod?8;else?searchDir=(dir+6)mod?8.
Wherein even represents even number, and mod represents modulo operation.According to following formula, the corresponding starting point of all direction values can be calculated before program run, is kept at then in the nextDirection array.Press the order of index 0 to index 7, nextDirection member's value is followed successively by 7,7, and 1,1,3,3,5,5.Variables D ifference is 8 * 8 matrixes among Fig. 3; The direction value of each member's value is corresponding a pair of index value with it has identical numerical value poor; For example has index (3; 5) member Difference [3,5] preserves is poor between direction value 3 and the direction value 5, and this difference formula that differs from by the direction value of preceding text provides.Because the number of direction value is fixed as 8 amounts, so the difference between them can be calculated in advance, be kept at then in 8 * 8 the Difference matrix, save follow-up double counting, then Difference is provided by following formula:
Difference = 0 1 2 2 4 3 2 1 1 0 1 2 3 4 3 2 2 1 0 1 2 3 4 3 3 2 3 0 1 2 3 4 4 3 2 1 0 1 2 3 3 4 3 2 1 0 1 2 2 3 4 3 2 1 0 1
Variables L istOfStrings and ListOfDirections are the basis with the index among Fig. 3; The pixel coordinate and its pixel orientation value of line correspondence section have been preserved respectively; For example; Current detection goes out n bar straight-line segment, and the member ListOfStrings [i] and the ListOfDirections [i] that then have same index i have preserved the coordinate information and the direction value information of straight line pixel that section comprises respectively.Fig. 3 variables L istOfOccurences has preserved every straight-line segment all directions to be worth pairing pixel count.With bianry image shown in Figure 15 is example, its direction value of the numeral on the foreground pixel among the figure, and table 1 has provided ListOfStrings in the pairing bianry image of Figure 15, ListOfDirections and the corresponding value of three variablees of ListOfOccurences.
Left side line segment among index 0 corresponding Figure 15 of three variablees, index 1 corresponding right side line segment.Left side line segment comprises 9 pixels, and the right side comprises 8 pixels.The value of 8 ListOfStrings [1] has been preserved from top to bottom each pixel with respect to the side-play amount of position, Figure 15 upper left corner, and the 9th the member ListOfStrings [0] [8] of ListOfStrings [1] is empty, because the right side line segment has only 8 pixels.ListOfDirections [1] has preserved the direction value of each pixel; The 9th member of ListOfDirections [0] is corresponding also to be empty; Its member's order is consistent with ListOfStrings [1], and what promptly ListOfStrings [1] [i] and ListOfDirections [1] [i] were corresponding is the same pixel in the right line segment.Therefore the preservation order of the value among the ListOfDirections [1] is consistent with the pairing pixel order of ListOfStrings [1], i.e. left line segment direction value sign order from top to bottom among Figure 15.Preceding 8 members of ListOfOccurences [1] have preserved the pixel count of 0 to 7 direction value respectively; Its 9th member preserved under current state, has the direction value of maximum pixel counts, observes Figure 15; As far as the right side line segment; This value obviously is 7, and its corresponding pixel count is 5, and promptly the direction value of 5 pixels is arranged altogether is 7 to the right side line segment.
Fig. 3 also comprises following variable: dir, tempString, tempDirections and tempOccurences.Variable dir representes the direction value of current pixel; This variable is initialized to 7; Be that first found foreground pixel is endowed direction value 7 on the straight-line segment; The direction value of the foreground pixel of then finding is by its determining positions in the territory of facing in last pixel, and after current pixel was updated to new foreground pixel, the value of dir also was updated to the direction value of new pixel.Variable tempString; TempDirections and tempOccurences have respectively and variables L istOfStrings; ListOfDirections and ListOfOccurences identical functions; The difference be that former three can be reinitialized as required, then the three only initialization once permanently preserve data.
The flow process of Fig. 3 is done concise and to the point description at present.After program run, after initializing variable was accomplished, the three layers of pixel of outermost that can establish image were background pixel, begin line by line individual element ground scan image then.After finding foreground pixel, the image scanning meeting suspends, and program can be checked the territory of facing of foreground pixel by the direction of scanning, promptly is the center with the current pixel; Have the territory of facing of 6,7,0 direction value, found new foreground pixel in the territory if face; Program can continue to check 6,7,0 direction of new pixel, sees whether also to have foreground pixel; This process lasts till that always 6,7,0 direction is not found till the new foreground pixel.Because 6,7,0 direction is the lower right corner of current pixel, in fact this process is searching the low order end point of line segment.
After finding low order end point, exploratory link shown in Figure 4 brings into operation.This link is actually the direction of not considering m pixel, links these pixels exploratoryly, checks then whether the maximum direction value of m the pixel that is linked is identical with the exploratory maximum direction value that begins preceding line segment that links.Variable same meaning of the same name among Fig. 4 among variable searchDir and Fig. 3 is represented the search starting point.Variable length representes counting of exploratory link.Variable suspiciousDirs only uses in that Fig. 4 is inner, and ListOfOccurences is identical among its effect and Fig. 3.Because variable tempString, tempDirections and tempOccurences have write down the partial pixel in the line segment in Fig. 3, and these pixels might finally become the part of line segment; But it is still uncertain when exploratory link; Data in three variablees can not be kept at variables L istOfStrings, among ListOfDirections and the ListOfOccurences, can not remove again; So initialization suspiciousDirs be used for adding up distribution situation in exploratory link pixel orientation value; And still using tempString, tempDirections continues to add the point that exploratory link is found under the condition that legacy data is not removed.If the point that is found does not have m; Or the difference of suspiciousDirs [8] and tempOccurences [8] is more than or equal to 2; The difference that is the direction value that the line segment that links had maximum pixel counts before the direction value with maximum pixel counts and the exploratory link of exploratory link began is greater than 45 °, and then exploratory link is failed, tempString; The exploratory link pixel coordinate and the direction value of being preserved among the tempDirections will be deleted according to the value of length.If exploratory the link successfully; TempString and tempDirections remain unchanged; And will be the suspiciousDirs member's 8 value and the value addition with tempOccurences member of same index except that index, be kept among the tempOccurences.
Fig. 3 promptly begins normal link after exploratory link for the first time successfully finishes.With exploratory link different; Normal, chain is connected on when finding new foreground pixel; Can calculate direction value poor of new pixel and tempOccurences [8], check promptly whether the direction of new pixel is consistent with the trend substantially of line segment, if this differs from less than 2; Then in three interim tabulations, preserve new Pixel Information, and continue normal link; If difference then begins exploratory link mentioned above more than or equal to 2, link successfully; Then continue normal link, the link failure, check that then exploratory link begins before; The line segment length that is found greater than minLength, just is saved in ListOfStrings respectively with the data in three interim tabulations; Among ListOfDirections and the ListOfOccurences,, then reinitialize three interim tabulations less than minlength.After once link finishes; All foreground pixels that found in the current link can be set to background pixel, and the image scanning meeting of time-out continues scanning in the original pixel of suspending, till finding new foreground pixel; Can repeat above-mentioned link process then; After last pixel in having scanned image, algorithm shown in Figure 3 just can stop, and step shown in Figure 8 (d) brings into operation.
The UML activity diagram of step (d) is Fig. 8.The primary variables of Fig. 8 definition has thresholdRatio, length, strings ToRemove, firstDir; SecondDir, possibleSplitPositions, actualSplitPositions; GroupsOfSimilarDirs, curStr, curDirs and curOccurs.Variable thresholdRatio representes the running parameter of artificial input, and in Fig. 8, this value is predetermined to be 0.1.The straight-line segment sum that has found in the variable length presentation graphs 3.Variable stringsToRemove is used to write down the index of divided line segment.Variable firstDir and variable secondDir represent the maximum direction value and time general orientation value of a line segment respectively.The split position that variable possibleSplitPositions expresses possibility.Variable actualSplitPositions representes fixed split position.Variable groupsOfSimilarDirs representes to have the aggregate list of similarity direction value.Variable curStr, curDirs and curOccurs represent that respectively the line segment of current present is tabulation ListOfStrings, pairing member among ListOfDirections and the ListOfOccurences.
Program shown in Figure 8 with current straight-line segment at ListOfStrings; Quoting of pairing member passes to curStr respectively among ListOfDirections and the ListOfOccurences; CurDirs and curOccurs find firstDir and secondDir then in curOccurs.If the difference of firstDir and secondDir, explains that most point all has identical direction value, necessity of not cutting apart on the straight-line segment less than 2; If difference more than or equal to 2 and both ratio surpassed thresholdRatio; Then show and comprised 2 sections sub-line segments in the straight-line segment at least with obvious direction difference; Program begins to check curDirs and initializing variable possibleSplitPositions and groupsOfSimilarDirs; Add indexing among the possibleSplitPositions of first point of curStr, check successively then on the line segment except that first with last pixel, the direction value of other pixel.Because the direction value of first pixel always is set to 7 in Fig. 3, and before the exploratory often link end of last pixel, the maximum point of direction value fluctuation is so remove this two points.Newly in groupsOfSimilarDirs add a group and the direction value of second point is added to group.Check the next member of curDirs, and last all direction values that group comprised of adding among its value and the groupsOfSimilarDirs are compared,, then this value is added and give group if group does not comprise this value and it is poor less than 2; If group comprises this value and it is poor less than 2, do not do any action; If poor, then in groupsOfSimilarDirs, add a new group and give new group, and in possibleSplitPositions, write down the index of current pixel in curStr this value interpolation more than or equal to 2.Each pixel is repeated above-mentioned steps, till the penult pixel.Index with last point of curStr adds to possibleSplitPositions at last.
After finishing the inspection of curDirs, initializing variable actualSplitPositions.Calculate possibleSplitPositions straight-line segment poor between per two members successively, if certain two member's difference more than or equal to minLength, is then added these two members to actualSplitPositions.After the inspection to all members of possibleSplitPositions finishes; If the actualSplitPositions non-NULL according to the member of actualSplitPositions, is cut apart curStr and curDirs; In ListOfStrings and ListOfDirections, preserve the sub-line segment that is partitioned into; Calculating is also preserved corresponding ListOfOccurences member, at ListOfStrings, preserves divided line segment among ListOfDirections and the ListOfOccurences; If actualSplitPositions is empty, do not do any action.Every the straight-line segment that is found by Fig. 3 among the ListOfStrings is repeated above-mentioned Fig. 8 step, till the straight-line segment of all Fig. 3 all was examined.So far step (d) finishes, and step (e) brings into operation.
The UML activity diagram of step (e) comprises Fig. 9 to Figure 11, and related primary variables has detectRadius, curIndex, curStr, maxDir; IsLeftConnected, isRightConnected, leftIndices, leftTerminals; RightIndice, rightTerminals, leftPattern, rightPattern; NodesOfConnection, segments, nodeCollection, segmentCollection and stringsToRemove.Variable detectRadius has preserved the value of the range parameter of artificial input, and this value is predetermined to be 8 in Fig. 9.Variable curIndex representes the index value of straight-line segment in ListOfStrings in pre-treatment.Variable same meaning of the same name in variable curStr and stringsToRemove and the step (d).Variable maxDir representes to have the maximum direction value of the straight-line segment of index curIndex.Variable i sLeftConnected and isRightConnected represent the left and right sides end points of curStr respectively, and whether the end points corresponding with other straight-line segment links together.Variable leftIndices, rightTerminals, rightIndice and leftTerminals represent to be positioned at the straight-line segment index and the right endpoint thereof in curStr left side respectively, and the straight-line segment index and its left end point that are positioned at its right side.Variable leftPattern and rightPattern represent respectively near the mid point of repetition or negate curStr, the path of minLength direction value.Variable nodesOfConnection preserves the left end point or the right endpoint of the line segment of confirming that will merge.Variable segments has preserved the active path that arrives the end points that nodesOfConnection preserved from certain end points of curStr.Variable nodeCollection and segmentCollection comprise member and the segments of all nodesOfConnection that program shown in circular flow Figure 10 produces among Fig. 9 respectively.
The on-link mode (OLM) of image scanning order and step (c) can cause the first last member of curStr and the opposite situation of left and right sides end points of actual line segment; Suppose among Figure 15 that left side and right side line segment have index 0 and 1 respectively; Press from top to bottom so, scan mode from left to right, line segment uppermost right endpoint in left side comes to light at first; So be the first member among the ListOfStrings [0]; And its left end point comes to light at last, also be last member among the ListOfStrings [0] therefore, and the first last member of right side straight-line segment is consistent with left and right sides end points among Figure 15.Hypothesis will link the right endpoint of the left side line segment among Figure 15 and the left end point of right side line segment now; The first half of the straight-line segment after merging so comprises the member among the ListOfStrings [0] that backward arranges, and later half part comprises the member among the tactic ListOfStrings [1].In conjunction with the direction value of Fig. 2, can use program shown in Figure 11 that the first last member of curStr is divided into left and right sides end points.
Fig. 9 has at first moved link endpoints program shown in Figure 10.Variable detectRadius has determined to wait to merge the scope of straight-line segment; Promptly to curStr; The program of Figure 10 only detects among the ListOfStrings index value and is positioned at the interval [curIndex-detectRadius in a left side; CurIndex-1] and right interval [curIndex+1, curIndex+detectRadius] in straight-line segment, see to have the straight-line segment that can merge with curStr.The maximum direction value that can merge straight-line segment is identical with curStr, or fully opposite, is 4 such as the maximum direction value of curStr, and the maximum direction value that can merge straight-line segment so can only be 4 or 0.Attention in Fig. 2,0 and 4 in fact the expression all be the straight-line segment of horizontal direction.If straight-line segment has all been found in the both sides of curStr, the straight-line segment that has only a side can be merged by program afterwards.All there is the straight-line segment that can merge though find the curStr both sides; But fusion process can not be carried out at once; Because in case merge; Just must from ListOfStrings, delete Fused three straight-line segments, therefore destroy the order of ListOfStrings index, thereby make Fused line segment lose the possibility that is merged by other line segment.Therefore, at first program only checks whether the left end point of every straight line can merge with the right endpoint of other straight line, if can; Just write down this left end point and right endpoint; Wait all line segments all to check and be over, disposable according to end points that is write down and line segment information, merge.
At leftIndices and rightIndice is not that program shown in Figure 10 begins to attempt merging curStr and corresponding straight-line segment under the prerequisite of sky.Method is that getting with ListOfDirections [curIndex] mid point is the center; About the direction value of each long minLength/2 be the path; 3 * 3 of each point face the territory on the inspection path, see whether be kept at the end points that can merge straight-line segment among rightTerminals and the leftTerminals exists.According to the maximum direction value of curStr, the path of two end points has opposite direction value, the path of variable leftPattern and rightPattern corresponding left end point of difference and right endpoint.With Figure 16 is example; Its core is a straight-line segment that 7 pixels are arranged, and straight-line segment center use numerical value is 5 light color square sign, and the right ends point is the darkened boxes that indicates numerical value 5 and 7; The grey square in left end point left side is left path, and the grey square on right endpoint right side is the right wing footpath.Suppose that minLength is 5, leftPattern comprises direction value [5,3 successively; 5,4,4]; In fact by from right to left order, repeated with the mid point is the center to leftPattern, is the direction value of each point on the straight-line segment of length with 5; And the path of straight-line segment left end point is starting point with the left end point, launches as moving direction according to member's among the leftPattern value.Variable rightPattern is at first with member order negate among the leftPattern, i.e. [4,4,5,3,5] are then according to its value obtained by the direction value negate of Fig. 2.In Fig. 2, direction value 3,4 and 5 contrary be followed successively by 7,0 and 1, so last rightPattern is [0,0,1,7,1].
After confirming the path; When isLeftConnected is true; Program can be checked the right endpoint whether territory comprises merged with the line segment that writes down among the rightTerminals that faces of each point among the leftPattern; Or when isRightConnected be very, then can check the facing the territory and whether have the end points among the leftTerminals of each point of rightPattern.If in the path, found to merge the end points of line segment; The index of then that it is corresponding line segment; End points, the end points that curIndex and curStr are corresponding is kept among the nodesOfConnection, for example when the facing the territory and comprise the end points among the rightTerminals of certain point among the leftPattern; Program can be with the line segment index among the pairing leftIndices of this end points; This end points, the left end point of curIndex and curStr is preserved as the element of a four-dimensional vector successively, and this vector then is kept among the nodesOfConnection.The order of noting element in this vector is the index of line segment α all the time; The right endpoint of line segment α; The index of line segment β; The left end point of line segment β is so for the end points among the leftTerminals, can save as four-dimensional vector according to the order of end points among the right endpoint of curIndex, curStr, line segment index and the leftTerminals among the rightIndices.After this process finishes; If nodesOfConnection non-NULL; Then can be kept at the segments from starting point to touching the part that can merge the line segment end points in the path; Last program shown in Figure 10 can be returned nodesOfConnection and segments, and " link endpoints " process finishes, and program is returned Fig. 9.
After variable nodeCollection and segmentCollection had preserved the member and segments of the nodesOfConnection that Figure 10 program generates respectively, Fig. 9 program can repeat Figure 10 program, all members in traveling through ListOfStrings.Because the fusion end points of preserving with four-dimensional vector that nodeCollection has stored that preceding text mention and the information of straight-line segment thereof; Program will write down the index that is merged line segment in stringsToRemove; Then according to the member of nodeCollection; In order two line segments are connected with the corresponding member among the segmentCollection; To ListOfStrings, ListOfDirections and ListOfOccurences add the new line segment information that merges, and according to two original line segment information of the deletion of the index information among the stringsToRemove.Repeat this process, till all members of traversal nodeCollection.Step (e) just is through with.
So far, variables L istOfStrings, the in store respectively straight-line segment that finds of ListOfDirections and ListOfOccurences, its direction value record and direction primary system meter information.
Figure 12, Figure 13 and Figure 14 have showed KHT, EDLines respectively; The comparison diagram of TODIS and testing result of the present invention, wherein, what first row all showed is untreated image; What secondary series showed is the result of existing method, and what the 3rd row showed is testing result of the present invention.In Figure 12, can find obviously that F02 testing result of the present invention has successfully detected the linear edge of image left wire bar and power transformation device, and KHT does not detect.F22 testing result of the present invention has successfully detected the coboundary of dish-shaped buildings in the image, and KHT does not then have.F32 testing result of the present invention has successfully detected the enclosure wall coboundary of lower right corner building in the image, and KHT does not then have.Detected all straight-line segments of KHT through observing picture, can find that the present invention has detected all.Therefore, accuracy of detection of the present invention is higher than KHT.
In Figure 13, G12 and G22 have shown that respectively the present invention has successfully detected among slit and the G20 figure between the ceramic tile of the top of buildings in the G10 image linearity separatrix of high light and low light on woman's arm.These are not all detected by EDLines, and through observing, detected all straight-line segments of EDLines have basically all been detected by the present invention.
In Figure 14; Because TODIS is the present known the highest line Segment Detection of precision, the present invention's gap with it is little, but on the testing result that H22 showed; Can find that still the present invention has successfully detected the high-end glass slit of skyscraper, TODIS does not then have.Through observing, all are by the detected straight-line segment of TODIS basically, and the present invention has detected.Therefore, in a sense, precision of the present invention is not less than TOIDS, but detection speed of the present invention is then apparently higher than TODIS.
With above-mentioned foundation desirable embodiment of the present invention is enlightenment, and through above-mentioned description, the related work personnel can carry out various change and modification fully in the scope that does not depart from this invention technological thought.The technical scope of this invention is not limited to the content on the instructions, must confirm its technical scope according to the claim scope.
Table 1

Claims (12)

1. a quick identification digital picture line segment detection method is characterized in that, may further comprise the steps:
(a) input has the wide bianry image of unit picture element; Described bianry image is made up of foreground pixel and two kinds of pixels of background pixel; Foreground pixel refers to comprise the pixel of graphical information; Background pixel refers to not comprise the pixel of graphical information: by rim detection bianry image is provided, re-uses the bone method and obtain having the wide bianry image of unit picture element;
(b) length parameter, running parameter, pixel parameter and the range parameter of setting straight-line segment to be detected: length parameter refers to can accept in the final detection result minimum length of straight-line segment; Running parameter refers to the tolerance to straight-line segment curved transition degree, and tolerance is big more, and then detected straight-line segment is more near segment of curve, and promptly straight-line segment is made up of the sub-line segment that several sections directions have notable difference; When the pixel parameter refers to that significant change takes place in straight-line segment local curvature, the number of pixels that scanning area is not carried out exploratory link; Range parameter refers to line segment range of fusion parameter;
(c) obtain coarse straight-line segment;
(d) the detected straight-line segment of segmentation;
(e) difference of that close on and direction value current straight-line segment of link is less than the straight-line segment of difference threshold values: described direction value is that the territory of facing to foreground pixel quantizes definition with respect to the direction of its center; The threshold values of the difference of described difference threshold values finger direction value is used to judge the quantitative criteria that two straight-line segment directions are whether identical;
(f) return the straight-line segment that is found.
2. a kind of quick identification digital picture line segment detection method as claimed in claim 1, it is characterized in that: the concrete steps of described step (c) do
(c1) difference and the difference threshold values of definition direction value, direction value;
(c2) in certain sequence the bianry image of importing in the step (a) is scanned; Confirm the specific direction value according to the current images scanning sequency, described specific direction value refer to be no more than the difference threshold values with the difference of representing the direction value of direction of scanning all point to the not direction value of scanning area;
(c3) when finding foreground pixel; Suspending scanning, is the center with the foreground pixel, only detect the specific direction value described in the step (c2) pointed face the territory; If discovery foreground pixel; Then continue to detect the territory of facing that the specific direction value described in the step (c2) points to, repeat this process, in facing the territory, do not find foreground pixel or arrive at till the image boundary;
(c4) exploratory link: confirm the initial direction value; Described initial direction value is after removing the specific direction value described in the step (c2); Close on the direction of scanning but point to the not direction of scanning area, described closing on is meant in image space between 2 pixels not other pixel at interval; Last foreground pixel to find in the step (c3) is a starting point, and inspection initial direction value is pointed faces the territory and whether have foreground pixel; If find new foreground pixel, it is background pixel that old foreground pixel then is set, and writes down its direction value and the new foreground pixel of exploratory link; Repeat this process and equal the pixel parameter, or before sum does not reach the pixel parameter, do not find new foreground pixel until the foreground pixel sum that is linked;
(c5) in exploratory link process; Set up an ephemeral data structure and a permanent data structure that is used for permanent preservation; Described permanent data structure comprises temporary realm and permanent area; Write down the pixel count of each direction value and dynamically obtain maximum direction value at current time; The pixel count of described direction value refers to get the foreground pixel number of this direction value, and described maximum direction value refers to have the direction value of maximum foreground pixel numbers: the pixel count of each direction value that all produce in exploratory link process is recorded in the ephemeral data structure after the initialization;
In each exploratory connection; If the number of the foreground pixel that has linked is not found new foreground pixel around reaching pixel parameter and current pixel, check then whether the number of the foreground pixel that in exploratory link process, is linked surpasses length parameter, if surpass; Then write down all pixels that linked; And they are designated the straight line section, if do not surpass, then abandon these pixels;
If still there is new foreground pixel in the number of the foreground pixel that has linked around reaching pixel parameter and current pixel; Then with the direction value record of the direction value of current pixel and last exploratory link in the temporary realm of permanent data structure; And beginning poor according to the direction value of waiting to link foreground pixel and maximum direction value, judge whether to continue to link;
(c6) if the difference of maximum direction value and the direction value of waiting to link foreground pixel less than the difference threshold values, then links this pixel and in the temporary realm of permanent data structure its direction value of record, otherwise start exploratory link once more in the current pixel position;
(c7) when exploratory link finishes, calculate the poor of maximum direction value and the maximum direction value in the permanent data structure temporary realm in the ephemeral data structure:
If difference is less than the difference threshold values; Then foreground pixel of being preserved by exploratory link in the ephemeral data structure and corresponding direction value are kept in the temporary realm of permanent data structure; Repeating step (c6) is till not finding new foreground pixel, arriving at image boundary; And then judge whether the foreground pixel in the permanent data structure temporary realm is saved to permanent area and reinitializes the ephemeral data structure according to length parameter;
If difference greater than the difference threshold values, is then ended link, judge whether the foreground pixel in the permanent data structure temporary realm is saved to permanent area and reinitializes the ephemeral data structure according to length parameter.
3. a kind of quick identification digital picture line segment detection method as claimed in claim 2; It is characterized in that: foreground pixel and background pixel are defined as respectively has non-0 value pixel and 0 value pixel, perhaps respectively the value of being defined as be 255 pixel with value less than 255 pixel.
4. a kind of quick identification digital picture line segment detection method as claimed in claim 2 is characterized in that: in the described step (c2), image scanning by from top to bottom, is carried out in proper order from left to right.
5. a kind of quick identification digital picture line segment detection method as claimed in claim 2; It is characterized in that: the definition of direction value is produced by filter window and direction linear module in the described step (c1); After the definition of the difference of completion direction value and direction value, define the difference threshold values again.
6. a kind of quick identification digital picture line segment detection method as claimed in claim 5; It is characterized in that: in the described step (c1); With the number of the discrete value of employed two-dimensional filtering function in the digital picture and distribution shape thereof as filter window; The filter window size is 3 * 3, and the direction value can be defined by round values, also can be angle value or radian value.
7. a kind of quick identification digital picture line segment detection method as claimed in claim 6; It is characterized in that: when the direction value is angle value or radian value, corresponding difference threshold values be 45 ° or
Figure FDA00002006976100031
promptly when the difference of the direction value of two straight lines less than 45 ° or the time
Figure FDA00002006976100032
these two straight-line segments be regarded as and have identical direction.
8. a kind of quick identification digital picture line segment detection method as claimed in claim 6; It is characterized in that: the direction value is defined by round values; Define as follows: the direction value of establishing x axle positive dirction is 0, and by counterclockwise, every direction value at a distance from 45 ° is followed successively by 1,2,3,4,5,6,7; The difference of direction value is provided by following formula:
if|dir1-dir2|>4then?difference=8-|dir1-dir2|;else?difference=|dir1-dir2|.
Wherein dir1 and dir2 represent the direction value of two straight-line segments respectively, and difference represents the difference of dir1 and dir2; The difference threshold values is defined as 2.
9. a kind of quick identification digital picture line segment detection method as claimed in claim 8, it is characterized in that: in the described step (c2), the specific direction value is 6,7 and 0.
10. a kind of quick identification digital picture line segment detection method as claimed in claim 1, it is characterized in that: the concrete steps of described step (d) do
(d1) the pairing direction value information of every the straight-line segment of detection of stored in permanent data structure permanent area, when the ratio of the maximum direction value of straight-line segment and time general orientation value surpassed running parameter, then this straight-line segment was segment of curve and cuts apart;
(d2) for the segment of curve of finding in the step (d1); Begin from its any end points; Check record direction value in the direction value of each pixel and the ephemeral data structure after initialization one by one; If the difference of any direction value that has write down in this direction value and the ephemeral data structure is greater than the difference threshold values, then this pixel of mark is potential cut-point and initialization ephemeral data structure; Repeat above-mentioned steps, on segment of curve have a few all tested;
(d3) distance between per two the potential cut-points of calculating if distance is not less than length parameter, is then cut apart this segment of curve at these two potential cut-points.
11. a kind of quick identification digital picture line segment detection method as claimed in claim 1, it is characterized in that: the concrete steps of described step (e) do
Get with the mid point of current straight-line segment or near mid point, to be no more than in the zone of 50% length parameter a bit be the center; Satisfy the sub-line segment of length parameter; With its direction value is sample, respectively from two end points of current straight-line segment, searches for for trend by sample; If the difference of the direction value of discovery and current straight-line segment then merges these two straight-line segments less than the straight-line segment of difference threshold values; Repeated multiple times is till no longer existing the straight-line segment that can merge.
12. a kind of quick identification digital picture line segment detection method as claimed in claim 11; It is characterized in that: in the described step (e); The mid point of getting with current straight-line segment is the center, satisfies the sub-line segment of length parameter, with the direction value of this sub-line segment as sample.
CN201210289399.0A 2012-08-14 2012-08-14 Detection method for quickly identifying straight-line segments in digital image Expired - Fee Related CN102819743B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210289399.0A CN102819743B (en) 2012-08-14 2012-08-14 Detection method for quickly identifying straight-line segments in digital image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210289399.0A CN102819743B (en) 2012-08-14 2012-08-14 Detection method for quickly identifying straight-line segments in digital image

Publications (2)

Publication Number Publication Date
CN102819743A true CN102819743A (en) 2012-12-12
CN102819743B CN102819743B (en) 2015-03-11

Family

ID=47303851

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210289399.0A Expired - Fee Related CN102819743B (en) 2012-08-14 2012-08-14 Detection method for quickly identifying straight-line segments in digital image

Country Status (1)

Country Link
CN (1) CN102819743B (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102508627A (en) * 2010-09-28 2012-06-20 微软公司 Multiple image buffer simulation
CN103245667A (en) * 2013-04-08 2013-08-14 上海华力微电子有限公司 Method and system for automatically detecting mechanical scratches
CN104200196A (en) * 2014-08-12 2014-12-10 侯志勇 Method for automatically identifying position of guide pin in X-ray perspective image
CN104751177A (en) * 2015-03-26 2015-07-01 常州大学 Method for identifying given blurred digital straight-line segment in digital image
CN105513044A (en) * 2015-11-20 2016-04-20 常州大学 Digital straight segment recognition method based on statistical measurement of straight line features
CN107748887A (en) * 2017-09-30 2018-03-02 五邑大学 It is a kind of based on dominant with recessive Line segment detection planar document perspective image antidote
CN108377391A (en) * 2013-05-08 2018-08-07 杨立发 A kind of data transfer device
CN108985143A (en) * 2018-05-10 2018-12-11 国电南瑞科技股份有限公司 A method of based on unmanned plane image recognition iron towers of overhead power transmission lines structure
CN110569845A (en) * 2019-09-12 2019-12-13 苏州大学 test paper image correction method and related device
CN115661453A (en) * 2022-10-25 2023-01-31 腾晖科技建筑智能(深圳)有限公司 Tower crane hanging object detection and segmentation method and system based on downward viewing angle camera

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070022329A1 (en) * 2003-04-03 2007-01-25 Thomas Adamek Shape matching method for indexing and retrieving multimedia data
CN102156884A (en) * 2011-04-25 2011-08-17 中国科学院自动化研究所 Straight segment detecting and extracting method
CN102270299A (en) * 2011-08-24 2011-12-07 复旦大学 Edge connection algorithm realized in parallel based on breakpoints

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070022329A1 (en) * 2003-04-03 2007-01-25 Thomas Adamek Shape matching method for indexing and retrieving multimedia data
CN102156884A (en) * 2011-04-25 2011-08-17 中国科学院自动化研究所 Straight segment detecting and extracting method
CN102270299A (en) * 2011-08-24 2011-12-07 复旦大学 Edge connection algorithm realized in parallel based on breakpoints

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102508627A (en) * 2010-09-28 2012-06-20 微软公司 Multiple image buffer simulation
CN103245667A (en) * 2013-04-08 2013-08-14 上海华力微电子有限公司 Method and system for automatically detecting mechanical scratches
CN108377391B (en) * 2013-05-08 2019-05-31 雅居乐雅生活服务股份有限公司 One kind is with the symmetrical coefficient in transform domain quantization device of codomain intermediate value
CN108377391A (en) * 2013-05-08 2018-08-07 杨立发 A kind of data transfer device
CN104200196A (en) * 2014-08-12 2014-12-10 侯志勇 Method for automatically identifying position of guide pin in X-ray perspective image
CN104200196B (en) * 2014-08-12 2017-09-01 侯志勇 Guide pin position automatic identifying method in a kind of radioscopy image
CN104751177A (en) * 2015-03-26 2015-07-01 常州大学 Method for identifying given blurred digital straight-line segment in digital image
CN104751177B (en) * 2015-03-26 2018-01-12 常州大学 A kind of method for being used in reference numbers image give fuzzy digit straightway
CN105513044B (en) * 2015-11-20 2018-07-17 常州大学 A kind of digital direct straight line segments recognition method based on statistical measures linear feature
CN105513044A (en) * 2015-11-20 2016-04-20 常州大学 Digital straight segment recognition method based on statistical measurement of straight line features
CN107748887A (en) * 2017-09-30 2018-03-02 五邑大学 It is a kind of based on dominant with recessive Line segment detection planar document perspective image antidote
CN108985143A (en) * 2018-05-10 2018-12-11 国电南瑞科技股份有限公司 A method of based on unmanned plane image recognition iron towers of overhead power transmission lines structure
CN108985143B (en) * 2018-05-10 2022-03-29 国电南瑞科技股份有限公司 Method for identifying iron tower structure of overhead transmission line based on unmanned aerial vehicle image
CN110569845A (en) * 2019-09-12 2019-12-13 苏州大学 test paper image correction method and related device
CN115661453A (en) * 2022-10-25 2023-01-31 腾晖科技建筑智能(深圳)有限公司 Tower crane hanging object detection and segmentation method and system based on downward viewing angle camera
CN115661453B (en) * 2022-10-25 2023-08-04 腾晖科技建筑智能(深圳)有限公司 Tower crane object detection and segmentation method and system based on downward view camera

Also Published As

Publication number Publication date
CN102819743B (en) 2015-03-11

Similar Documents

Publication Publication Date Title
CN102819743A (en) Detection method for quickly identifying straight-line segments in digital image
Kalfarisi et al. Crack detection and segmentation using deep learning with 3D reality mesh model for quantitative assessment and integrated visualization
Ochmann et al. Automatic reconstruction of fully volumetric 3D building models from oriented point clouds
Mura et al. Piecewise‐planar reconstruction of multi‐room interiors with arbitrary wall arrangements
Gamba et al. Improving urban road extraction in high-resolution images exploiting directional filtering, perceptual grouping, and simple topological concepts
WO2024077812A1 (en) Single building three-dimensional reconstruction method based on point cloud semantic segmentation and structure fitting
Becker Generation and application of rules for quality dependent façade reconstruction
Baillard et al. A plane-sweep strategy for the 3D reconstruction of buildings from multiple images
Oesau et al. Planar shape detection and regularization in tandem
CN109447994A (en) In conjunction with the remote sensing image segmentation method of complete residual error and Fusion Features
CN105761308A (en) Ground LiDAR and image data fused occlusion region building facade reconstruction method
Previtali et al. A flexible methodology for outdoor/indoor building reconstruction from occluded point clouds
Canaz Sevgen et al. An improved RANSAC algorithm for extracting roof planes from airborne lidar data
Saglam et al. Boundary constrained voxel segmentation for 3D point clouds using local geometric differences
Friedman et al. Online detection of repeated structures in point clouds of urban scenes for compression and registration
CN104408772A (en) Grid projection-based three-dimensional reconstructing method for free-form surface
CN113838005B (en) Intelligent identification and three-dimensional reconstruction method and system for rock mass fracture based on dimension conversion
Tarsha Kurdi et al. Automatic filtering and 2D modeling of airborne laser scanning building point cloud
Yang et al. A skeleton-based hierarchical method for detecting 3-D pole-like objects from mobile LiDAR point clouds
Cotella From 3D point clouds to HBIM: application of artificial intelligence in cultural heritage
Fernández-García et al. A new thresholding approach for automatic generation of polygonal approximations
CN114612659A (en) Power equipment segmentation method and system based on fusion mode contrast learning
Pellis et al. 2D to 3D Label propagation for the semantic segmentation of Heritage building point clouds
Kang et al. Characterizing and controlling approximation in hierarchical perceptual grouping
Sithole et al. 3D Object Segmentation of point clouds using profiling techniques

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20210827

Address after: 215222 Room 401, building 23, No. 1188, West 2nd Ring Road, Shengze Town, Wujiang District, Suzhou City, Jiangsu Province

Patentee after: Suzhou qishuo Information Technology Co.,Ltd.

Address before: Gehu Lake Road Wujin District 213164 Jiangsu city of Changzhou province No. 1

Patentee before: CHANGZHOU University

CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20150311