CN107368829A - The method and apparatus for determining the rectangular target areas in input picture - Google Patents

The method and apparatus for determining the rectangular target areas in input picture Download PDF

Info

Publication number
CN107368829A
CN107368829A CN201610307727.3A CN201610307727A CN107368829A CN 107368829 A CN107368829 A CN 107368829A CN 201610307727 A CN201610307727 A CN 201610307727A CN 107368829 A CN107368829 A CN 107368829A
Authority
CN
China
Prior art keywords
combination
width
line sections
ratio
height
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
CN201610307727.3A
Other languages
Chinese (zh)
Other versions
CN107368829B (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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to CN201610307727.3A priority Critical patent/CN107368829B/en
Publication of CN107368829A publication Critical patent/CN107368829A/en
Application granted granted Critical
Publication of CN107368829B publication Critical patent/CN107368829B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/25Determination of region of interest [ROI] or a volume of interest [VOI]

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

The invention discloses a kind of method and apparatus for determining the rectangular target areas in input picture.This method includes:Obtain the horizontal class line segment in input picture and vertical class line segment;Candidate line sections combination is generated, each candidate line sections combination includes two horizontal class line segments and two vertical class line segments, and the line segment or its extended line in each candidate line sections combination, which intersect, obtains four intersection points;The camera intrinsic parameter of four intersection points, predetermined reference the ratio of width to height, input picture according to corresponding to combining each candidate line sections, calculate the ratio of width to height of rectangular area after perspective correction corresponding to each candidate line sections combination;Based on the comparison of the ratio of width to height and predetermined reference the ratio of width to height corresponding to the combination of each candidate line sections, a candidate line sections combination is selected;And the region for surrounding four line segments in selected candidate line sections combination or its extended line is defined as rectangular target areas.

Description

The method and apparatus for determining the rectangular target areas in input picture
Technical field
This invention relates generally to image processing field.Specifically, can be multiple the present invention relates to one kind The rectangular target areas in input picture is determined under miscellaneous background to carry out the method and apparatus of perspective correction.
Background technology
In modern society, various certificates, card, document etc., such as identity card are there are, Business card, bank card, residence booklet, driver's license, passport, the residence management document etc. in local police station.Some lists These information are collected or achieved to position or individual demand frequently, it is necessary to by these certificates, card, document Deng retention soft copy.In addition to some special reading instruments, common electronic method is exactly to take pictures, Then storage image or identified information is stored after image is identified.
During retention of taking pictures, generally require solve the problems, such as perspective transform.Because:Due to The limitation of environment or equipment, when being shot to these certificates, card, document etc. (rectangular target), Be possible to be not face reference object surface shooting, but with the normal to a surface direction of reference object Between certain angle be present, the result that causes to take pictures is commonly known as by inclined influence, this inclination Perspective transform.For the identification and storage of next step, it is necessary to carry out perspective correction to image, then could Carry out the subsequent treatments such as printed page analysis, identification.
Traditional method is the image of analysis shooting, its edge and angle point is found out, with reference to the width of rectangular target Degree and elevation information, perspective transform formula is established, carry out perspective correction.
But traditional method requires accurate edge and corner location.Rectangular target in the input image Background complexity in the case of, it is difficult to be accurately positioned edge and corner location, traditional method is just no longer suitable With.
The present invention specifically addresses above mentioned problem, and it is accurate to be remained in the input image in the case of background complexity Rectangular target areas is determined, for perspective correction.
The content of the invention
The brief overview on the present invention is given below, to provide some sides on the present invention The basic comprehension in face.It should be appreciated that this general introduction is not the exhaustive general introduction on the present invention.It is simultaneously It is not intended to determine the key or pith of the present invention, nor is it intended to limit the scope of the present invention.Its Purpose only provides some concepts in simplified form, in this, as discussing later in greater detail Preamble.
The purpose of the present invention is to propose to a kind of method for determining the rectangular target areas in input picture and set It is standby.
To achieve these goals, according to an aspect of the invention, there is provided a kind of determine input picture In rectangular target areas method, this method includes:Obtain the horizontal class line segment in input picture and erect Straight class line segment;Generate candidate line sections combination, the combination of each candidate line sections include two horizontal class line segments with Two vertical class line segments, line segment or its extended line in each candidate line sections combination, which intersect, obtains four friendships Point;According to four intersection points, predetermined reference the ratio of width to height, input picture corresponding to the combination of each candidate line sections Camera intrinsic parameter, calculate the ratio of width to height of rectangular area after perspective correction corresponding to each candidate line sections combination; Based on the comparison of the ratio of width to height and predetermined reference the ratio of width to height corresponding to the combination of each candidate line sections, a time is selected Route selection section combines;And surround four line segments in selected candidate line sections combination or its extended line Region is defined as rectangular target areas.
According to another aspect of the present invention, there is provided a kind of rectangular target areas determined in input picture Equipment, the equipment includes:Line segment obtains device, is configured as:Obtain the horizontal class in input picture Line segment and vertical class line segment;Candidate line sections combination producing device, is configured as:Candidate line sections combination is generated, Each candidate line sections combination includes two horizontal class line segments and two vertical class line segments, each candidate line sections Line segment or its extended line in combination, which intersect, obtains four intersection points;The ratio of width to height computing device, is configured as: According to the camera of four intersection points, predetermined reference the ratio of width to height, input picture corresponding to the combination of each candidate line sections Intrinsic parameter, calculate the ratio of width to height of rectangular area after perspective correction corresponding to each candidate line sections combination;Selection Device, it is configured as:Based on the ratio of width to height corresponding to the combination of each candidate line sections and predetermined reference the ratio of width to height Compare, select a candidate line sections combination;And rectangular area determining device, it is configured as:By selected by The region that four line segments or its extended line in the candidate line sections combination selected surround is defined as rectangular target area Domain.
According to another aspect of the invention, there is provided a kind of message processing device.Described information processing equipment Including:Controller, it is configured as:Obtain the horizontal class line segment in input picture and vertical class line segment;It is raw Combined into candidate line sections, each candidate line sections combination includes two horizontal class line segments and two vertical class lines Section, line segment or its extended line in each candidate line sections combination, which intersect, obtains four intersection points;According to each time Four intersection points, predetermined reference the ratio of width to height, the camera intrinsic parameter of input picture corresponding to the combination of route selection section, meter Calculate the ratio of width to height of rectangular area after perspective correction corresponding to the combination of each candidate line sections;Based on each candidate line The comparison of the ratio of width to height corresponding to Duan Zuhe and predetermined reference the ratio of width to height, select a candidate line sections combination;With And the region for surrounding four line segments in selected candidate line sections combination or its extended line is defined as square Shape target area.
In addition, according to another aspect of the present invention, additionally provide a kind of storage medium.The storage medium It is described when performing described program code on message processing device including machine readable program code Program code causes described information processing equipment to perform the above method according to the present invention.
In addition, in accordance with a further aspect of the present invention, additionally provide a kind of program product.Described program product The instruction that can perform including machine, when performing the instruction on message processing device, the instruction makes Described information processing equipment is obtained to perform according to the above method of the invention.
It should be noted that:The present invention can solve the problem that conventional method can not handle the technology of the image of complex background and ask Topic, and the present invention can also handle the image of simple background.
Brief description of the drawings
With reference to below in conjunction with the accompanying drawings to the explanation of embodiments of the invention, the present invention can be more readily understood that Above and other objects, features and advantages.Part in accompanying drawing is intended merely to show the principle of the present invention. In the accompanying drawings, same or similar technical characteristic or part will using same or similar reference come Represent.In accompanying drawing:
Fig. 1 shows the side of the rectangular target areas in determination input picture according to an embodiment of the invention The flow chart of method.
Fig. 2 shows a kind of step S1 embodiment.
Fig. 3 shows a kind of step S3 embodiment.
Fig. 4 shows the example of input picture.
Fig. 5 shows all edge line segments detected.
The rectangular target areas that the method according to the invention that Fig. 6 shows is found.
Fig. 7 shows the result after carrying out perspective correction on the basis of the present invention.
Fig. 8 shows the block diagram of equipment according to an embodiment of the invention.
Fig. 9 shows the block diagram of the message processing device according to the present invention.
Figure 10 is shown available for the computer for implementing method and apparatus according to an embodiment of the invention Schematic block diagram.
Embodiment
The one exemplary embodiment of the present invention is described in detail hereinafter in connection with accompanying drawing.In order to clear For the sake of simplicity, all features of actual embodiment are not described in the description.However, should Solution, it must be made much specific to embodiment during any this actual embodiment is developed Determine, to realize the objectives of developer, for example, meeting those related to system and business Restrictive condition, and these restrictive conditions may change with the difference of embodiment.In addition, It will also be appreciated that although development is likely to be extremely complex and time-consuming, to having benefited from the disclosure For those skilled in the art of content, this development is only routine task.
Herein, it is also necessary to explanation is a bit, in order to avoid having obscured the present invention because of unnecessary details, It illustrate only in the accompanying drawings with being walked according to the closely related apparatus structure of the solution of the present invention and/or processing Suddenly, the other details little with relation of the present invention are eliminated.In addition, it may also be noted that at this Invention an accompanying drawing or a kind of embodiment described in element and feature can with it is one or more The element and feature shown in other accompanying drawings or embodiment is combined.
The rectangular target in determination input picture according to an embodiment of the invention is described below with reference to Fig. 1 The flow of the method in region.
Fig. 1 shows the side of the rectangular target areas in determination input picture according to an embodiment of the invention The flow chart of method.As shown in figure 1, method according to an embodiment of the invention comprises the following steps:Obtain Horizontal class line segment and vertical class line segment (step S1) in input picture;Candidate line sections combination is generated, often Individual candidate line sections combination includes two horizontal class line segments and two vertical class line segments, each candidate line sections group Line segment or its extended line in conjunction, which intersect, obtains four intersection points (step S2);According to each candidate line sections group The camera intrinsic parameter of four intersection points, predetermined reference the ratio of width to height, input picture corresponding to conjunction, calculate each wait The ratio of width to height (step S3) of rectangular area after perspective correction corresponding to the combination of route selection section;Based on each candidate The comparison of the ratio of width to height and predetermined reference the ratio of width to height corresponding to line segment combination, select a candidate line sections combination (step S4);And surround four line segments in selected candidate line sections combination or its extended line Region is defined as rectangular target areas (step S5).
In step sl, horizontal class line segment and the vertical class line segment in input picture are obtained.
Input picture is, for example, the image for including the rectangular targets such as certificate, card, document.
Fig. 4 shows the example of input picture, including rectangular target areas (card of lower section) and Complicated ambient interferences (the n times patch of top, it has two structures for being similar to rectangle), with biography When the method for system carries out perspective correction, it is easy to background is regarded as into rectangular target areas, and then mistakenly Carry out perspective correction.
First, for example, can be pre-processed to input picture, pretreatment includes but is not limited to removal and made an uproar Sound, scaling size, image enhaucament etc..
Then, as shown in Fig. 2 in the step s 21, obtaining the line segment in input picture.
Specifically, the edge in input picture is detected;And line segment is detected from edge.
The method at the edge in the detection image and method of detection of straight lines section is art technology from edge Known to personnel, for example, CANNY operators can be based on or detect edge based on gradient.From edge Line segment is detected such as can utilize Hough line detection algorithms.The invention is not restricted to this.
In step S22, acquired line segment is categorized as horizontal class line segment and vertical class line segment.
First, the line segment of all acquisitions is merged, will be consistent apart from close, slope or close to (such as Difference 5 degree within) line segment merge, merge into a line segment.Wherein, slope is inconsistent and not The distance between close line segment is defined as maximum.The method of merging is, for example, to be fitted multiple line segments, choosing The line segment in centre position is taken, is represented, clustered with G-bar.It should be noted that combining step is optional step Suddenly.
Then, the line segment after all merging is classified, according to its slope, be divided into horizontal class line segment and Vertical class line segment.
Horizontal class line segment be general horizontal line segment, such as and horizontal direction slope difference in preset range Interior line segment.Vertical class line segment is the line segment of general vertical, such as and vertical direction slope difference pre- Determine the line segment in scope.
Certainly, the step of above-mentioned merging line segment and line segment is categorized as horizontal class line segment and vertical class line segment The order of step can exchange.
Fig. 5 shows all edge line segments detected, including 7 that four sides of card, n times are pasted Side.
In step s 2, candidate line sections combination is generated, each candidate line sections combination includes two levels Class line segment and two vertical class line segments, line segment or its extended line in each candidate line sections combination, which intersect, to be obtained Four intersection points.It should be noted that candidate line sections combination here is, for example, exhaustive obtains.
Because target area is rectangle, rectangle includes two horizontal sides perpendicular to one another and two vertical Side, so candidate line sections combination should include two horizontal class line segments and two vertical class line segments.
Line segment or its extended line in each candidate line sections combination generated, which intersect, can obtain four friendships Point.If it should be noted that in four obtained intersection points at least one intersection point not in the range of input picture, Then give up such candidate line sections combination.
In step s3, four intersection points, the wide height of predetermined reference according to corresponding to the combination of each candidate line sections Than the camera intrinsic parameter of, input picture, rectangle after perspective correction corresponding to each candidate line sections combination is calculated The ratio of width to height in region.
Specifically, as shown in figure 3, in step S31, four according to corresponding to the combination of each candidate line sections Individual intersection point and predetermined reference the ratio of width to height, obtain the corresponding homography matrix for being used for perspective correction.
Assuming that the horizontal class line segment finally given is sh1、sh2Deng.Vertical class line segment is sv1,sv2Deng.Wait Route selection section combines (sh1、sh2、sv1,sv2) corresponding four intersection points are (sh1, sv1), (sh1, sv2), (sh2, sv1), (sh2, sv2) intersection point, be named as p1、p2、p3、p4
The present invention based on the assumption that:The ratio of width to height of known target, referred to as predetermined reference the ratio of width to height R.
Based on predetermined reference the ratio of width to height R, unit target rectangle can be built, its four apex coordinates are pm1(0,0)、pm2(1,0)、pm3(0,R)、pm4(1,R)。
Combined for each candidate line sections, there are four intersection point p1、p2、p3、p4.People in the art The homography matrix H of perspective correction is known to member:
Wherein, h33=1.
Correspondingly, perspective transform formula is:
h21xix+h22xiy+h23=(h31xix+h32xiy+h33)miy
h11xix+h12xiy+h13=(h31xix+h32xiy+h33)mix
Wherein, xix、xiyFor p1、p2、p3、p4Abscissa and ordinate, mix、miyFor pm1(0,0)、 pm2(1,0)、pm3(0,R)、pm4The abscissa and ordinate of (1, R).Therefore, 8 equations are obtained, Due to R, it is known that totally 8 unknown numbers, i.e. h11、h12、h13、h21、h22、h23、h31、h32.I.e. Homography matrix H can be solved.It should be noted that be corresponding to this homography matrix in projective space (i.e. After perspective transform) the unit target rectangle based on predetermined reference the ratio of width to height R, be not eventually for Carry out the homography matrix of perspective correction.Also, this homography matrix corresponds to a candidate line sections and combined. Therefore, each candidate line sections combination corresponds to a homography matrix H.
In addition, when (i.e. after perspective transform) the ratio of width to height r in projective space is unknown, same warp Above-mentioned derivation step is crossed, can obtain including h11、h12、h13、h21、h22、h23、h31、h32Altogether 8 equations of 8 unknown numbers, have corresponding to the combination of each candidate line sections 4 available for solving equations Individual intersection point P and the unit target rectangle based on unknown the ratio of width to height r.So, 9 unknown numbers are shared.
It is in addition, empty in projection based on four points after the world coordinates and perspective correction of four points before perspective correction Between the corresponding relations (i.e. above-mentioned perspective transform formula) of projective coordinates, camera outer ginseng matrix it is known Characteristic, it is known that the restriction relation between perspective transformation matrix and camera intrinsic parameter:
Wherein, camera Intrinsic Matrix A is:F is the focal length of camera, W, h is the resolution ratio of camera, and a, b are the size sensor of camera.
So, totally 9 equations and 9 unknown numbers.
It can solve:
Wherein, each candidate line sections combination can solve a r.Above-mentioned formula is showing for predetermined relationship Example.
Therefore, in step s 32, homography matrix and input according to corresponding to the combination of each candidate line sections The camera intrinsic parameter of image, based on predetermined relationship, calculate perspective correction corresponding to each candidate line sections combination The ratio of width to height of rectangular area afterwards.
In step s 4, based on the ratio of width to height r and the wide height of predetermined reference corresponding to the combination of each candidate line sections Comparison than R, select a candidate line sections combination.
Specifically, the candidate line sections for selecting the difference of its ratio of width to height and predetermined reference the ratio of width to height minimum combine.By There was only a rectangular target areas in input picture, therefore, corresponding to an only candidate line sections combination R is correct, i.e., closest to predetermined reference the ratio of width to height R.
In step s 5, four line segments in selected candidate line sections combination or its extended line are surrounded Region be defined as rectangular target areas.
The rectangular target areas that the method according to the invention that Fig. 6 shows is found, its four angle points are with round dot Mark.
In addition, the homography matrix according to corresponding to the ratio of width to height r of final choice, can be to true in step S5 Fixed rectangular target areas carries out perspective correction, with the image after being corrected.
Fig. 7 is shown on the basis of the present invention, carries out the result after perspective correction.The card of lower section is It is calibrated card-like for standard, the no longer effect with perspective transform, meanwhile, the n times patch of top Deformity is corrected as, because the homography matrix that the perspective correction of the present invention is based on is based on correct Target be what card generated.In traditional method, due to being difficult to judge which card pastes with n times and be Target area, it seem likely that correcting preferably n times patch, and card is corrected to deformity.
The rectangle mesh in determination input picture according to an embodiment of the invention is described next, with reference to Fig. 8 The equipment for marking region.
Fig. 8 shows the block diagram of equipment according to an embodiment of the invention.As shown in figure 8, root Equipment 800 according to the rectangular target areas in the determination input picture of the present invention includes:Line segment obtains device 81, it is configured as:Obtain the horizontal class line segment in input picture and vertical class line segment;Candidate line sections combine Generating means 82, are configured as:Candidate line sections combination is generated, each candidate line sections combination includes two Horizontal class line segment and two vertical class line segments, line segment or its extended line in each candidate line sections combination intersect Obtain four intersection points;The ratio of width to height computing device 83, is configured as:Combined according to each candidate line sections corresponding Four intersection points, predetermined reference the ratio of width to height, the camera intrinsic parameter of input picture, calculate each candidate line sections The ratio of width to height of rectangular area after perspective correction corresponding to combination;Selection device 84, is configured as:Based on every The comparison of the ratio of width to height and predetermined reference the ratio of width to height, selects a candidate line sections corresponding to individual candidate line sections combination Combination;And rectangular area determining device 85, it is configured as:By in selected candidate line sections combination The region that four line segments or its extended line surround is defined as rectangular target areas.
In one embodiment, the ratio of width to height computing device 83 includes:Homography matrix obtaining unit, quilt It is configured to:According to four intersection points and predetermined reference the ratio of width to height corresponding to the combination of each candidate line sections, obtain pair The homography matrix for perspective correction answered;The ratio of width to height computing unit, is configured as:According to each time The camera intrinsic parameter of homography matrix and input picture corresponding to the combination of route selection section, based on predetermined relationship, meter Calculate the ratio of width to height of rectangular area after perspective correction corresponding to the combination of each candidate line sections.
In one embodiment, predetermined relationship is based on the world coordinates of four points before perspective correction and perspective school Four points carry out structure in the characteristic of the corresponding relations of the projective coordinates of projective space, the outer ginseng matrix of camera after just Build.
In one embodiment, line segment obtains device 81 and included:Acquiring unit, it is configured as:Obtain Line segment in input picture;And taxon, it is configured as:Acquired line segment is categorized as level Class line segment and vertical class line segment.
In one embodiment, line segment obtains device 81 and also included:Combining unit, it is configured as:Root According to pre-defined rule, merge at least part line segment in horizontal class line segment and/or vertical class line segment respectively.
In one embodiment, acquiring unit is further configured to:Detect the edge in input picture; And line segment is detected from edge.
In one embodiment, acquiring unit is further configured to:Based on gradient, input picture is detected In edge;And using Hough transformation, line segment is detected from edge.
In one embodiment, selection device 84 is further configured to:Its ratio of width to height is selected with making a reservation for With reference to the candidate line sections combination that the difference of the ratio of width to height is minimum.
Because the processing in each device and unit included in the equipment 800 according to the present invention is distinguished It is similar with the processing in each step included in method described above, therefore for simplicity, The detailed description of these devices and unit is omitted herein.
In addition, in accordance with a further aspect of the present invention, as shown in Figure 9, there is provided a kind of message processing device. The message processing device 100 includes controller 1001.The controller 1001 is configured as:Inputted Horizontal class line segment and vertical class line segment in image;Generate candidate line sections combination, each candidate line sections combination Include two horizontal class line segments and two vertical class line segments, line segment in each candidate line sections combination or its Extended line is intersecting to obtain four intersection points;According to four intersection points, predetermined ginseng corresponding to the combination of each candidate line sections The ratio of width to height, the camera intrinsic parameter of input picture are examined, calculates perspective correction corresponding to each candidate line sections combination The ratio of width to height of rectangular area afterwards;Based on the ratio of width to height and the wide height of predetermined reference corresponding to the combination of each candidate line sections The comparison of ratio, select a candidate line sections combination;And four during selected candidate line sections are combined The region that line segment or its extended line surround is defined as rectangular target areas.
In addition, still need here, it is noted that each component devices, unit can be by soft in the said equipment Part, firmware, hardware or the mode of its combination are configured.Specific means workable for configuration or mode are As it is known to those skilled in the art that it will not be repeated here.In the case where being realized by software or firmware, From storage medium or network to computer (such as the general meter shown in Figure 10 with specialized hardware structure Calculation machine 900) program for forming the software is installed, the computer can be held when being provided with various programs Row various functions etc..
Figure 10 is shown available for the computer for implementing method and apparatus according to an embodiment of the invention Schematic block diagram.
In Fig. 10, CPU (CPU) 901 is according to storing in read-only storage (ROM) 902 Program or from storage part 908 be loaded into random access memory (RAM) 903 program perform it is various from Reason.In RAM 903, stored always according to needs required when CPU 901 performs various processing etc. Data.CPU 901, ROM 902 and RAM 903 are connected to each other via bus 904.Input/output connects Mouth 905 is also connected to bus 904.
Components described below is connected to input/output interface 905:Importation 906 (including keyboard, mouse etc. Deng), output par, c 907 (including display, such as cathode-ray tube (CRT), liquid crystal display (LCD) Deng, and loudspeaker etc.), storage part 908 (including hard disk etc.), (including the network of communications portion 909 Interface card such as LAN card, modem etc.).Communications portion 909 is held via network such as internet Row communication process.As needed, driver 910 can be connected to input/output interface 905.Detachably Medium 911 such as disk, CD, magneto-optic disk, semiconductor memory etc. can be mounted as needed On driver 910 so that the computer program read out is installed to storage part 908 as needed In.
In the case where realizing above-mentioned series of processes by software, from network such as internet or storage medium For example the installation of detachable media 911 forms the program of software.
It will be understood by those of skill in the art that this storage medium is not limited to shown in Figure 10 wherein Have program stored therein, separately distribute to provide a user the detachable media 911 of program with equipment.Can The example for dismantling medium 911 includes disk (including floppy disk (registration mark)), CD (it is read-only to include CD Memory (CD-ROM) and digital universal disc (DVD)), magneto-optic disk (including mini-disk (MD) (registration mark)) And semiconductor memory.Or storage medium can be ROM 902, storage part 908 in include Hard disk etc., wherein computer program stored, and user is distributed to together with the equipment comprising them.
The present invention also proposes a kind of program product for the instruction code for being stored with machine-readable.The instruction When code is read and performed by machine, above-mentioned method according to an embodiment of the invention can perform.
Correspondingly, for the storage for the program product for carrying the above-mentioned instruction code for being stored with machine-readable Medium is also included within disclosure of the invention.The storage medium includes but is not limited to floppy disk, CD, magnetic CD, storage card, memory stick etc..
Above in the description of the specific embodiment of the invention, describing and/or showing for a kind of embodiment The feature gone out can be used in a manner of same or similar in one or more other embodiments, with Feature in other embodiment is combined, or substitutes the feature in other embodiment.
It should be emphasized that term "comprises/comprising" refers to feature, key element, step or group when being used herein The presence of part, but be not precluded from one or more further features, key element, step or component presence or It is additional.
In addition, the method for the present invention be not limited to specifications described in time sequencing perform, also may be used According to other time sequencings, concurrently or independently to perform.Therefore, described in this specification The execution sequence of method is not construed as limiting to the technical scope of the present invention.
Although being had been disclosed above by the description of the specific embodiment to the present invention to the present invention, However, it is to be understood that above-mentioned all embodiments and example are illustrative, and not restrictive. Those skilled in the art can design to the various of the present invention in the spirit and scope of the appended claims Modification, improvement or equivalent.These modifications, improvement or equivalent should also be as being to be considered as included in this In the protection domain of invention.
Note
1. a kind of method for determining the rectangular target areas in input picture, including:
Obtain the horizontal class line segment in input picture and vertical class line segment;
Candidate line sections combination is generated, each candidate line sections combination includes two horizontal class line segments and two Vertical class line segment, line segment or its extended line in each candidate line sections combination, which intersect, obtains four intersection points;
According to four intersection points, predetermined reference the ratio of width to height, input picture corresponding to the combination of each candidate line sections Camera intrinsic parameter, the width for calculating rectangular area after perspective correction corresponding to the combination of each candidate line sections is high Than;
Based on the comparison of the ratio of width to height and predetermined reference the ratio of width to height corresponding to the combination of each candidate line sections, selection One candidate line sections combination;And
The region that four line segments in selected candidate line sections combination or its extended line surround is determined For rectangular target areas.
2. the method as described in note 1, wherein four friendships according to corresponding to the combination of each candidate line sections Point, predetermined reference the ratio of width to height, the camera intrinsic parameter of input picture, calculate each candidate line sections combination pair The ratio of width to height of rectangular area includes after the perspective correction answered:
According to four intersection points and predetermined reference the ratio of width to height corresponding to the combination of each candidate line sections, obtain correspondingly The homography matrix for perspective correction;
The camera intrinsic parameter of homography matrix and input picture according to corresponding to combining each candidate line sections, Based on predetermined relationship, the width for calculating rectangular area after perspective correction corresponding to each candidate line sections combination is high Than.
3. the method as described in note 2, wherein, predetermined relationship is based on four points before perspective correction Four points are in the corresponding relations of the projective coordinates of projective space, camera after world coordinates and perspective correction The characteristic of outer ginseng matrix is built.
4. the method as described in note 1, wherein, obtain the horizontal class line segment in input picture and erect Straight class line segment includes:
Obtain the line segment in input picture;And
Acquired line segment is categorized as horizontal class line segment and vertical class line segment.
5. the method as described in note 4, obtain the horizontal class line segment in input picture and vertical class line Section also includes:
According to pre-defined rule, merge at least part in horizontal class line segment and/or vertical class line segment respectively Line segment.
6. the method as described in note 4, the line segment obtained in input picture includes:
Detect the edge in input picture;And
Line segment is detected from edge.
7. the method as described in note 6, wherein,
Based on gradient, the edge in input picture is detected;And
Using Hough transformation, line segment is detected from edge.
8. the method as described in note 1, wherein, based on wide high corresponding to the combination of each candidate line sections Than the comparison with predetermined reference the ratio of width to height, a candidate line sections combination is selected to include:
The candidate line sections for selecting the difference of its ratio of width to height and predetermined reference the ratio of width to height minimum combine.
9. a kind of equipment for determining the rectangular target areas in input picture, including:
Line segment obtains device, is configured as:Obtain the horizontal class line segment in input picture and vertical class line Section;
Candidate line sections combination producing device, is configured as:Generate candidate line sections combination, each candidate line Duan Zuhe includes two horizontal class line segments and two vertical class line segments, in each candidate line sections combination Line segment or its extended line, which intersect, obtains four intersection points;
The ratio of width to height computing device, is configured as:According to each candidate line sections combination corresponding to four intersection points, The camera intrinsic parameter of predetermined reference the ratio of width to height, input picture, calculate corresponding to each candidate line sections combination The ratio of width to height of rectangular area after perspective correction;
Selection device, it is configured as:Based on the ratio of width to height corresponding to the combination of each candidate line sections and predetermined ginseng The comparison of the ratio of width to height is examined, selects a candidate line sections combination;And
Rectangular area determining device, is configured as:By four lines in selected candidate line sections combination The region that section or its extended line surround is defined as rectangular target areas.
10. the equipment as described in note 9, the ratio of width to height computing device include:
Homography matrix obtaining unit, is configured as:Four according to corresponding to the combination of each candidate line sections Intersection point and predetermined reference the ratio of width to height, obtain the corresponding homography matrix for being used for perspective correction;
The ratio of width to height computing unit, is configured as:According to homography square corresponding to the combination of each candidate line sections The camera intrinsic parameter of battle array and input picture, based on predetermined relationship, it is corresponding to calculate each candidate line sections combination Perspective correction after rectangular area the ratio of width to height.
11. the equipment as described in note 10, wherein, predetermined relationship is based on four points before perspective correction World coordinates and perspective correction after corresponding relation, camera of four points in the projective coordinates of projective space The characteristic of outer ginseng matrix build.
12. the equipment as described in note 9, wherein, the line segment, which obtains device, to be included:
Acquiring unit, it is configured as:Obtain the line segment in input picture;And
Taxon, it is configured as:Acquired line segment is categorized as horizontal class line segment and vertical class line Section.
13. the equipment as described in note 12, wherein, the line segment, which obtains device, also to be included:
Combining unit, it is configured as:According to pre-defined rule, merge horizontal class line segment respectively and/or erect At least part line segment in straight class line segment.
14. the equipment as described in note 12, wherein, the acquiring unit is further configured to:
Detect the edge in input picture;And
Line segment is detected from edge.
15. the equipment as described in note 14, wherein, the acquiring unit is further configured to:
Based on gradient, the edge in input picture is detected;And
Using Hough transformation, line segment is detected from edge.
16. the equipment as described in note 9, wherein, the selection device is further configured to:
The candidate line sections for selecting the difference of its ratio of width to height and predetermined reference the ratio of width to height minimum combine.
17. a kind of message processing device, including:
Controller, it is configured as:
Obtain the horizontal class line segment in input picture and vertical class line segment;
Generate candidate line sections combination, the combination of each candidate line sections include two horizontal class line segments with Two vertical class line segments, line segment or its extended line in each candidate line sections combination, which intersect, obtains four friendships Point;
According to four intersection points, predetermined reference the ratio of width to height, input corresponding to the combination of each candidate line sections The camera intrinsic parameter of image, calculate rectangular area after perspective correction corresponding to the combination of each candidate line sections The ratio of width to height;
Based on the comparison of the ratio of width to height and predetermined reference the ratio of width to height corresponding to the combination of each candidate line sections, One candidate line sections combination of selection;And
The region that four line segments in selected candidate line sections combination or its extended line are surrounded It is defined as rectangular target areas.

Claims (10)

1. a kind of method for determining the rectangular target areas in input picture, including:
Obtain the horizontal class line segment in input picture and vertical class line segment;
Candidate line sections combination is generated, each candidate line sections combination includes two horizontal class line segments and two Vertical class line segment, line segment or its extended line in each candidate line sections combination, which intersect, obtains four intersection points;
According to four intersection points, predetermined reference the ratio of width to height, input picture corresponding to the combination of each candidate line sections Camera intrinsic parameter, the width for calculating rectangular area after perspective correction corresponding to the combination of each candidate line sections is high Than;
Based on the comparison of the ratio of width to height and predetermined reference the ratio of width to height corresponding to the combination of each candidate line sections, selection One candidate line sections combination;And
The region that four line segments in selected candidate line sections combination or its extended line surround is determined For rectangular target areas.
2. the method as described in claim 1, wherein four according to corresponding to the combination of each candidate line sections Individual intersection point, predetermined reference the ratio of width to height, the camera intrinsic parameter of input picture, calculate each candidate line sections group The ratio of width to height of rectangular area includes after perspective correction corresponding to conjunction:
According to four intersection points and predetermined reference the ratio of width to height corresponding to the combination of each candidate line sections, obtain correspondingly The homography matrix for perspective correction;
The camera intrinsic parameter of homography matrix and input picture according to corresponding to combining each candidate line sections, Based on predetermined relationship, the width for calculating rectangular area after perspective correction corresponding to each candidate line sections combination is high Than.
3. method as claimed in claim 2, wherein, predetermined relationship is based on before perspective correction four The world coordinates and corresponding relation of four points after perspective correction in the projective coordinates of projective space, phase of point The characteristic of the outer ginseng matrix of machine is built.
4. the method for claim 1, wherein obtain the horizontal class line segment in input picture Include with vertical class line segment:
Obtain the line segment in input picture;And
Acquired line segment is categorized as horizontal class line segment and vertical class line segment.
5. method as claimed in claim 4, horizontal class line segment in input picture and vertical is obtained Class line segment also includes:
According to pre-defined rule, merge at least part in horizontal class line segment and/or vertical class line segment respectively Line segment.
6. method as claimed in claim 4, the line segment obtained in input picture includes:
Detect the edge in input picture;And
Line segment is detected from edge.
7. method as claimed in claim 6, wherein,
Based on gradient, the edge in input picture is detected;And
Using Hough transformation, line segment is detected from edge.
8. the method for claim 1, wherein based on corresponding to the combination of each candidate line sections The comparison of the ratio of width to height and predetermined reference the ratio of width to height, a candidate line sections combination is selected to include:
The candidate line sections for selecting the difference of its ratio of width to height and predetermined reference the ratio of width to height minimum combine.
9. a kind of equipment for determining the rectangular target areas in input picture, including:
Line segment obtains device, is configured as:Obtain the horizontal class line segment in input picture and vertical class line Section;
Candidate line sections combination producing device, is configured as:Generate candidate line sections combination, each candidate line Duan Zuhe includes two horizontal class line segments and two vertical class line segments, in each candidate line sections combination Line segment or its extended line, which intersect, obtains four intersection points;
The ratio of width to height computing device, is configured as:According to each candidate line sections combination corresponding to four intersection points, The camera intrinsic parameter of predetermined reference the ratio of width to height, input picture, calculate corresponding to each candidate line sections combination The ratio of width to height of rectangular area after perspective correction;
Selection device, it is configured as:Based on the ratio of width to height corresponding to the combination of each candidate line sections and predetermined ginseng The comparison of the ratio of width to height is examined, selects a candidate line sections combination;And
Rectangular area determining device, is configured as:By four lines in selected candidate line sections combination The region that section or its extended line surround is defined as rectangular target areas.
10. a kind of message processing device, including:
Controller, it is configured as:
Obtain the horizontal class line segment in input picture and vertical class line segment;
Generate candidate line sections combination, the combination of each candidate line sections include two horizontal class line segments with Two vertical class line segments, line segment or its extended line in each candidate line sections combination, which intersect, obtains four friendships Point;
According to four intersection points, predetermined reference the ratio of width to height, input corresponding to the combination of each candidate line sections The camera intrinsic parameter of image, calculate rectangular area after perspective correction corresponding to the combination of each candidate line sections The ratio of width to height;
Based on the comparison of the ratio of width to height and predetermined reference the ratio of width to height corresponding to the combination of each candidate line sections, One candidate line sections combination of selection;And
The region that four line segments in selected candidate line sections combination or its extended line are surrounded It is defined as rectangular target areas.
CN201610307727.3A 2016-05-11 2016-05-11 Method and apparatus for determining rectangular target area in input image Active CN107368829B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610307727.3A CN107368829B (en) 2016-05-11 2016-05-11 Method and apparatus for determining rectangular target area in input image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610307727.3A CN107368829B (en) 2016-05-11 2016-05-11 Method and apparatus for determining rectangular target area in input image

Publications (2)

Publication Number Publication Date
CN107368829A true CN107368829A (en) 2017-11-21
CN107368829B CN107368829B (en) 2020-08-14

Family

ID=60304464

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610307727.3A Active CN107368829B (en) 2016-05-11 2016-05-11 Method and apparatus for determining rectangular target area in input image

Country Status (1)

Country Link
CN (1) CN107368829B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108564557A (en) * 2018-05-31 2018-09-21 京东方科技集团股份有限公司 Method for correcting image and device
CN108734162A (en) * 2018-04-12 2018-11-02 上海扩博智能技术有限公司 Target identification method, system, equipment and storage medium in commodity image
CN108805823A (en) * 2018-04-12 2018-11-13 上海扩博智能技术有限公司 Commodity image antidote, system, equipment and storage medium
CN109409366A (en) * 2018-10-30 2019-03-01 四川长虹电器股份有限公司 Distorted image correction method and device based on Corner Detection
CN110930300A (en) * 2019-12-09 2020-03-27 上海扩博智能技术有限公司 Image squaring method, system, device and storage medium
TWI731484B (en) * 2019-11-26 2021-06-21 台灣基督長老教會馬偕醫療財團法人馬偕紀念醫院 Method and system for building medication library and managing medication via the image of its blister package
CN115760620A (en) * 2022-11-18 2023-03-07 荣耀终端有限公司 Document correction method and device and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1525733A (en) * 2002-12-20 2004-09-01 ��ʿͨ��ʽ���� Boundary detection method between areas having different features in image data
JP2005286572A (en) * 2004-03-29 2005-10-13 Seiko Epson Corp Image processing system, projector, program, information storing medium, and image processing method
CN101137011A (en) * 2006-08-29 2008-03-05 索尼株式会社 Image processing apparatus, image processing method and computer program
US8897538B1 (en) * 2013-08-26 2014-11-25 Vertifi Software, LLC Document image capturing and processing

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1525733A (en) * 2002-12-20 2004-09-01 ��ʿͨ��ʽ���� Boundary detection method between areas having different features in image data
JP2005286572A (en) * 2004-03-29 2005-10-13 Seiko Epson Corp Image processing system, projector, program, information storing medium, and image processing method
CN101137011A (en) * 2006-08-29 2008-03-05 索尼株式会社 Image processing apparatus, image processing method and computer program
US8897538B1 (en) * 2013-08-26 2014-11-25 Vertifi Software, LLC Document image capturing and processing

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
GANG HUA等: "Automatic Business Card Scanning with a Camera", 《2006 INTERNATIONAL CONFERENCE ON IMAGE PROCESSING》 *
贺志明: "数码相机拍摄的透视文本图像的校正", 《上海工程技术大学学报》 *

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108734162B (en) * 2018-04-12 2021-02-09 上海扩博智能技术有限公司 Method, system, equipment and storage medium for identifying target in commodity image
CN108734162A (en) * 2018-04-12 2018-11-02 上海扩博智能技术有限公司 Target identification method, system, equipment and storage medium in commodity image
CN108805823A (en) * 2018-04-12 2018-11-13 上海扩博智能技术有限公司 Commodity image antidote, system, equipment and storage medium
CN108805823B (en) * 2018-04-12 2021-03-12 上海扩博智能技术有限公司 Commodity image correction method, system, equipment and storage medium
CN108564557B (en) * 2018-05-31 2020-08-25 京东方科技集团股份有限公司 Image correction method and device
CN108564557A (en) * 2018-05-31 2018-09-21 京东方科技集团股份有限公司 Method for correcting image and device
US20190370943A1 (en) * 2018-05-31 2019-12-05 Boe Technology Group Co., Ltd. Image correction method and device
US10922794B2 (en) 2018-05-31 2021-02-16 Boe Technology Group Co., Ltd. Image correction method and device
CN109409366A (en) * 2018-10-30 2019-03-01 四川长虹电器股份有限公司 Distorted image correction method and device based on Corner Detection
CN109409366B (en) * 2018-10-30 2022-04-05 四川长虹电器股份有限公司 Distorted image correction method and device based on angular point detection
TWI731484B (en) * 2019-11-26 2021-06-21 台灣基督長老教會馬偕醫療財團法人馬偕紀念醫院 Method and system for building medication library and managing medication via the image of its blister package
CN110930300A (en) * 2019-12-09 2020-03-27 上海扩博智能技术有限公司 Image squaring method, system, device and storage medium
CN110930300B (en) * 2019-12-09 2023-09-29 上海扩博智能技术有限公司 Image correction method, system, device and storage medium
CN115760620A (en) * 2022-11-18 2023-03-07 荣耀终端有限公司 Document correction method and device and electronic equipment
CN115760620B (en) * 2022-11-18 2023-10-20 荣耀终端有限公司 Document correction method and device and electronic equipment

Also Published As

Publication number Publication date
CN107368829B (en) 2020-08-14

Similar Documents

Publication Publication Date Title
CN107368829A (en) The method and apparatus for determining the rectangular target areas in input picture
JP3841321B2 (en) Image registration method
CN102833460B (en) Image processing method, image processing device and scanner
JP6935786B2 (en) Geometric transformation matrix estimation device, geometric transformation matrix estimation method, and program
CN112528776B (en) Text line correction method and device
CN103839059B (en) For extracting device, method and the electronic equipment of the document boundaries in file and picture
WO2019128495A1 (en) Method and apparatus for detecting image resolution, storage medium, and electronic device
CN109948135A (en) A kind of method and apparatus based on table features normalized image
CN111753605A (en) Lane line positioning method and device, electronic equipment and readable medium
CN111310746A (en) Text line detection method, model training method, device, server and medium
CN106096516A (en) The method and device that a kind of objective is followed the tracks of
US9563937B2 (en) High-resolution image generation apparatus, high-resolution image generation method, and high-resolution image generation program
EP2536123A1 (en) Image processing method and image processing apparatus
US9514526B2 (en) Device and method for detecting angle of rotation from normal position of image
CN108805823B (en) Commodity image correction method, system, equipment and storage medium
Garcia-Salguero et al. A tighter relaxation for the relative pose problem between cameras
JP7192526B2 (en) Image processing device, image processing method and program
JP2009146150A (en) Method and device for detecting feature position
CN110415196A (en) Method for correcting image, device, electronic equipment and readable storage medium storing program for executing
CN107480710B (en) Feature point matching result processing method and device
CN109558846A (en) It is normalized based on OCR template and promotes self-defined template discrimination method and apparatus
JP2016218849A (en) Planar conversion parameter estimation device, method and program
CN110663046A (en) Hardware accelerator for histogram of oriented gradients calculation
US20200364933A1 (en) Image processing apparatus, image processing method and storage medium
JP2005228150A (en) Image verification 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