SIFT-based automatic matching evaluation method for advertising materials and on-site photos, storage medium and computer equipment
Through the automatic matching evaluation method of creative materials and on-site photos based on SIFT algorithm, the problem of huge labor-intensive manual review and different audit standards in the existing technology is solved, efficient automatic matching evaluation is achieved, matching accuracy is improved and matching is reduced. Risk of rework and re-authorization.
Patent Information
- Application Number
- CN202011257495.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-12
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2040-11-12
AI Technical Summary
The prior art has problems such as manual review and different review standards in the automatic matching evaluation of creative materials and live photos, and the existing image matching algorithm cannot match when rotated or changed in size.
Using the automatic matching evaluation method of creative materials and live photos based on SIFT algorithm, through feature point extraction and rapid matching, feature points whose distance is greater than the preset distance range is eliminated, homography matrix H is calculated, and vertex coordinates of creative images are mapped to the live On the picture, the polygon intersection is calculated and the automatic matching evaluation score for shooting quality is calculated by the preset evaluation model.
It effectively reduces the labor cost of manual review, solves the problem of rework and re-audit caused by different review standards for different personnel, and improves the accuracy of matching creatives with on-site photos.
Smart Images

Figure CN112365470B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image processing, and in particular to a SIFT-based automatic matching evaluation method for advertisement materials and on-site photos, a storage medium and a computer device. Background Art
[0002] With the development of the advertising industry, advertisers require advertising providers to take photos of electronic advertising screens on site for uploading and unloading advertisements, monitoring broadcasts, etc., to ensure that the advertisements are placed and confirmed to be effective on site. However, whether it is the advertising provider taking photos of electronic advertising screens when uploading and unloading advertisements, or the third-party company taking photos of electronic advertising screens when monitoring broadcasts, there are still a series of problems. For example, due to factors such as camera angle, light, and focus, the on-site photographers may not be clear enough to identify the advertisement content in the photos taken on site; the different photography skills of different on-site photographers may lead to uneven quality of on-site photos, etc.
[0003] To address the above issues, currently the only way is to manually review and judge the on-site photos one by one. This process requires a huge amount of manpower, and different people have different review standards, which easily leads to rework and re-review problems.
[0004] To evaluate the automatic matching of advertising material images and on-site photos, we first need to use image matching in image processing technology to locate the position of the corresponding advertising material content in the on-site photos. Among the current image matching algorithms, there are two main types: grayscale-based template matching algorithm and feature-based matching algorithm. Among them, the grayscale-based template matching algorithm searches for a sub-image similar to the template image in another image based on a known template image, and matches it through a two-dimensional sliding template in space. However, when the matching target in the original image rotates or changes in size, the algorithm cannot match it; feature-based matching algorithms such as the SIFT algorithm match by detecting extreme values in scale space, locating key points, specifying direction parameters for key points, generating key point descriptors, and screening descriptors. SIFT features are scale-invariant, and even if the rotation angle, image brightness or shooting angle is changed, good detection results can still be obtained. This method can match the feature points of the two pictures, but whether the advertising material really appears in the on-site picture and whether the on-site picture taken meets the requirements of the uploading and downloading and monitoring functions still needs to be completed by combining other methods. Summary of the invention
[0005] The purpose of the present invention is to overcome the shortcomings and deficiencies of the prior art and to provide a method, storage medium and computer equipment for automatically matching and evaluating advertising materials and on-site photos based on SIFT.
[0006] The SIFT-based automatic matching evaluation method for advertisement materials and on-site photos of the present invention comprises the following steps:
[0007] S1. Extract feature points from the advertising material image and the on-site image using the SIFT algorithm, quickly match the feature points of the two images, and remove feature points whose distance is greater than a preset distance range;
[0008] S2. Based on the eliminated feature points, determine whether the number of feature point groups that meet the distance range reaches four or more. If so, calculate the homography matrix H that maps the feature points of the advertising material image to the feature points of the on-site image; otherwise, it is deemed not to meet the requirements;
[0009] S3. Map the vertex coordinates of the advertising material image to the live image through the homography matrix H, and obtain a polygon A composed of the mapped vertex set V1, and a polygon B composed of the vertex set V2 of the live image. Calculate the intersection of the two polygons A and B on the live image as a polygon S;
[0010] S4, determine whether the polygon S is a convex quadrilateral, if not, it is considered not to meet the requirements; otherwise, proceed to step S5;
[0011] S5. Calculate the automatic matching evaluation score of the quality of the on-site picture shooting through a preset evaluation model.
[0012] The storage medium of the present invention stores computer instructions thereon, and when the computer instructions are executed by a processor, steps S1-S5 of the method for automatically matching and evaluating advertising materials and on-site photos of the present invention are implemented.
[0013] The computer device of the present invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor runs the computer program, the automatic matching and evaluation method of the advertising material and the on-site photo of the present invention is implemented.
[0014] Compared with the prior art, the present invention has the following advantages and effects:
[0015] The present invention provides an automatic evaluation method for advertising materials and on-site photos based on SIFT, which can effectively reduce the labor cost of manual review and solve the problem that different review standards of different personnel are different, which easily leads to rework and re-review. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 is an overall flow chart of the automatic matching evaluation method in an embodiment of the present invention;
[0017] Figure 2 It is the polygon intersection result of the advertising material image and the on-site image;
[0018] Figure 3 is a schematic diagram of two line segments that did not pass the fast repulsion;
[0019] Figure 4 is a schematic diagram of two line segments that pass through rapid repulsion but do not meet the straddling condition;
[0020] Figure 5 is a schematic diagram of two line segments that satisfy the straddling condition;
[0021] Figure 6 It is a schematic diagram of the intersection of a ray starting from any point and a polygon;
[0022] Figure 7 It is a schematic diagram of the imaging model of the camera;
[0023] Figure 8 The following are three schematic diagrams of finding the intersection of two convex quadrilaterals, where (1) is the case where convex quadrilateral A completely falls into convex quadrilateral B, (2) is the case where convex quadrilaterals A and B do not intersect, and (3)-(5) are the cases where convex quadrilaterals A and B intersect.
[0024] Fig. 9 This is a schematic diagram of the convex quadrilateral area method, where (1) and (2) illustrate two convex quadrilaterals respectively;
[0025] Fig.10 This is a schematic diagram of the concave quadrilateral area method, where (1) and (2) respectively illustrate two concave quadrilaterals. DETAILED DESCRIPTION
[0026] The present invention is further described in detail below in conjunction with embodiments and drawings, but the embodiments of the present invention are not limited thereto.
[0027] Example
[0028] The overall process of the present invention is as follows Figure 1 As shown, the following steps are included:
[0029] S1. The feature points of the advertising material image and the on-site image (also called on-site photo) are extracted by using the SIFT algorithm, and the feature points of the two images are quickly matched by using the Flann algorithm to eliminate the feature points whose distance is greater than the preset distance range.
[0030] In this embodiment, the distance range of the feature points is limited to 0-50, and the feature points with a distance greater than 50 are eliminated.
[0031] S2. Based on the feature points after elimination, determine whether the number of feature point groups that meet the distance range reaches four or more. If so, calculate the homography matrix H that maps the feature points of the advertising material image to the feature points of the on-site image; otherwise, it is deemed to not meet the requirements and the evaluation score is 0.
[0032] Since solving the homography matrix of 2D homography transformation requires at least 4 point pairs (any 3 of which are not collinear and linearly unrelated), it is necessary to first determine whether the number of feature point groups that meet the distance range reaches four or more (including four groups). If not, it is considered that the advertising material does not appear in the live picture, which is considered to be unqualified and the automatic matching evaluation score is 0; if it is reached, the homography matrix H mapping the feature points of the advertising material picture to the feature points of the live picture is calculated. The homography matrix is solved by random sampling consistency RANSAC.
[0033] S3. Map the vertex coordinates of the advertising material image to the live image through the homography matrix H to obtain a polygon A composed of the mapped vertex set V1, and a polygon B composed of the live image vertex set V2. Calculate the intersection of the two polygons A and B on the live image as polygon S.
[0034] In this embodiment, the vertex coordinates of the advertising material image are mapped to the on-site photo through the homography matrix H to obtain the vertex set V1. Assume that the mapped vertex set V1 forms polygon A, the vertex set of the on-site photo is V2, and V2 forms polygon B. The matching result of the advertising material image and the on-site photo is mainly achieved by finding the intersection of polygon A and polygon B. The MATLAB pseudo code corresponding to the polygon intersection process is as follows:
[0035] Construct a set S with the vertices of polygon A and polygon B as elements
[0036] for each edge of polygon A as e1
[0037] for each edge of polygon B as e2
[0038] if (e1 and e2 have an intersection)
[0039] Put the intersection points into the set S
[0040] for each element in the set S as e
[0041] if(e belongs to A and e belongs to B)
[0042] % No processing, that is, keep e
[0043] else
[0044] Remove e from S
[0045] Returns the final set S, which is the intersection of polygon A and polygon B, also called polygon S. Figure 2 As shown, this method is applicable to both convex polygon intersection and concave polygon intersection.
[0046] The positional relationship between two line segments can be divided into three categories: overlapping parts, non-overlapping parts but intersection points, and no intersection points. Let the edge of polygon A be e1, the edge of polygon B be e2, and the line segments corresponding to the two edges e1 and e2 are P1P2 and Q1Q2 respectively. The intersection of two polygons A and B is calculated by the following steps to determine whether the two edges e1 and e2 in polygons A and B have an intersection point, and to solve the intersection point:
[0047] S31, determine whether the fast exclusion condition is met, if it is met, go to step S32, otherwise determine that the two sides do not intersect. Let the rectangle with line segment P1P2 as the diagonal be R1, and let the rectangle with line segment Q1Q2 as the diagonal be R2. If rectangle R1 and rectangle R2 do not intersect, then the two line segments do not intersect, that is, the two sides e1 and e2 in polygons A and B do not have an intersection point, such as Figure 3 As shown;
[0048] S32, determine whether the straddling condition is met. Under the condition of step S31, if the line segment P1P2 and the line segment Q1Q2 do not straddle each other, the two line segments do not intersect. Figure 4 As shown; if the line segment P1P2 and the line segment Q1Q2 cross each other, the two line segments intersect, as shown Figure 5 As shown. Among them:
[0049] 1) If line segment P1P2 straddles line segment Q1Q2, then vectors (P1-Q1) and (P2-Q1) are on both sides of vector (Q2-Q1), that is:
[0050] (P1-Q1)×(Q2-Q1)*(P2-Q1)×(Q2-Q1)<0
[0051] 2) If line segment Q1Q2 straddles line segment Q1Q2, then vectors (Q1-P1) and (Q2-P1) are on both sides of vector (P2-P1), that is:
[0052] (Q1-P1)×(P2-P1)*(Q2-P1)×(P2-P1)<0
[0053] S33. When it is confirmed that the two line segments P1P2 and Q1Q2 have an intersection, use the vector method to solve the intersection. Assume that the vertex coordinates of the line segments P1P2 and Q1Q2 are P1(x1,y1), P2(x2,y2), Q1(x3,y3), Q2(x4,y4), and the intersection of the line segments P1P2 and Q1Q2 is O(x0,y0), then the following set of equations holds:
[0054] x0-x1=k1(x2-x1)
[0055] y0-y1=k1(y2-y1)
[0056] x0-x3=k2(x4-x3)
[0057] y0-y3=k2(y4-y3)
[0058] Eliminating the parameters k1 and k2, we obtain the following system of equations:
[0059] x0(y2-y1)-x1(y2-y1)=y0(x2-x1)-y1(x2-x1)
[0060] x0(y4-y3)-x3(y4-y3)=y0(x4-x3)-y3(x4-x3)
[0061] By transposing the above equations, we can get:
[0062] x0(y2-y1)=y0(x2-x1)+x1(y2-y1)+y1(x1-x2)
[0063] x0(y4-y3)=y0(x4-x3)+x3(y4-y3)+y3(x3-x4)
[0064] Let constants b1=x1(y2-y1)+y1(x1-x2), b2=x3(y4-y3)+y3(x3-x4), then the system of equations can be simplified to:
[0065] x0(y2-y1)=y0(x2-x1)+b1
[0066] x0(y4-y3)=y0(x4-x3)+b2
[0067] Solving the above equations, we can get the coordinates of the intersection point O(x0,y0):
[0068]
[0069] S34, after solving the intersection point, determine whether the side e corresponding to the intersection point belongs to polygon A and the side e belongs to polygon B, that is, determine whether the side e is in polygon A and polygon B at the same time, so as to determine the intersection polygon S. The present invention makes the determination by the ray method.
[0070] For any closed curve in a plane, the curve divides the plane into two parts, inside and outside. For any straight line in a plane, when crossing the polygon boundary, there are only two cases: entering the polygon or passing through the polygon. That is, if the point is inside the polygon, the ray must pass through the polygon for the first time when crossing the boundary; if the point is outside the polygon, the ray must enter the polygon for the first time when crossing the boundary.
[0071] Since a straight line can be extended infinitely, while the area enclosed by a closed curve is limited, the last time a line crosses the polygon boundary is to go outside the polygon. From this, we can infer that if we draw a ray from any point and count the number of intersections between it and the polygon boundary, if the number of intersections is an odd number, then the point is inside the polygon, otherwise it is outside the polygon.
[0072] Therefore, the present invention makes a ray with any point other than the intersection point on the edge e corresponding to the intersection point as the starting point, and calculates the number of intersection points between the ray and the polygon boundary. If the number of intersection points is an odd number, then the arbitrary point is inside the polygon, and thus it is judged that the edge e corresponding to the intersection point is inside the polygon; otherwise, the arbitrary point is outside the polygon, and thus it is judged that the edge e corresponding to the intersection point is outside the polygon.
[0073] In particular, for the positional relationship between any point on the edge e corresponding to the intersection point and the polygon, there are the following special cases:
[0074] (1) If the arbitrary point is on a vertex or an edge of a polygon, then it is sufficient to determine whether the arbitrary point is on the edge of the polygon.
[0075] (2) If any point is on the extension line of the polygon edge, it is considered to have 0 crossings;
[0076] (3) The ray starting from any point intersects with the polygon at the vertex of the polygon. At this time, the following rule can be set: Assume that the ray starting from any point intersects with the polygon at the vertex of the polygon, and the direction of the ray is the positive direction of the X axis of the two-dimensional coordinate system, and the positive direction of the Y axis is obtained by rotating the X axis counterclockwise by 90 degrees. If the vertex is the point with the largest ordinate on the edge, it is considered to have crossed once. Figure 6 As shown, in polygon ABCD, the ray from point J passes through vertex D, but the ordinate of vertex D is greater than that of vertex A and vertex C, so the number of crossings is 2; the ray from point K passes through vertex C, but the ordinate of vertex C is greater than that of vertex B and smaller than that of vertex D, so the number of crossings is 1; the ray from point L passes through vertex B, but the ordinate of vertex B is smaller than that of vertex A and vertex C, so the number of crossings is 0.
[0077] The intersection polygon S of polygon A and polygon B is the advertising material content matched in the on-site photo.
[0078] S4. Determine whether the polygon S is a convex quadrilateral. If not, it is considered not to meet the requirements and the evaluation score is 0; otherwise, proceed to step S5.
[0079] Since the advertising material is displayed on an electronic display screen, and the screen shape of the electronic display screen is rectangular. Figure 7In the camera imaging model shown (perspective projection), point O is the optical center of the camera, the plane formed by the X-axis and the Y-axis is the camera image plane, the Z-axis is the optical axis of the camera and is perpendicular to the image plane, and the intersection of the optical axis and the image plane is the origin of the image coordinate system O ′ , line segment OO ′ is the focal length of the camera, rectangle T1T2T3T4 is the electronic display screen, and the projection of rectangle T1T2T3T4 in the camera image plane is quadrilateral T1 ′ T2 ′ T3 ′ T4 v The rectangle T1T2T3T4 and the point O form a tetrahedron OT1T2T3T4, the vertex of the tetrahedron is the point O, the bottom is a rectangle, and the other four faces are triangles. ′ T2 ′ T3 ′ T4 ′ It is equivalent to the cross section formed by cutting the quadrangular pyramid OT1T2T3T4 by the camera image plane.
[0080] According to the definition of convex polyhedron: a closed solid formed by several plane polygons is called a polyhedron, these plane polygons are called faces of the polyhedron, and the sides and vertices of these polygons are called edges and vertices of the polyhedron respectively. If the polyhedron is on the same side of the plane determined by each of its faces, then this polyhedron is called a convex polyhedron.
[0081] Since the base of the tetrahedron OT1T2T3T4 is a rectangle, the other four faces are triangles, and the tetrahedron OT1T2T3T4 is on the same side of the plane where each face is located, the tetrahedron OT1T2T3T4 is a convex polyhedron.
[0082] According to the properties of convex polyhedrons, any cross section of a convex polyhedron is a convex polygon. Therefore, Figure 7 Middle, quadrilateral T1 ′ T2 ′ T3 ′ T4 ′ It is a convex quadrilateral. That is, when the camera takes a photo of the advertising material, the polygon T1 formed by the vertices of the mapped advertising material on the plane where the live photo is formed ′ T2 ′ T3 ′ T4 ′ is a convex polygon. Since polygon T1 v T2 ′ T3 ′ T4 ′ is a quadrilateral, so polygon T1 ′ T2 ′ T3 ′ T4 ′is a convex quadrilateral.
[0083] The vertex set V1 after the vertex coordinates of the ad material image are mapped to form a polygon A, which is actually a convex polygon. Since the number of vertices in the vertex set V1 is four, the polygon A is actually a convex quadrilateral. The polygon B composed of the vertex set V2 of the live image is actually a rectangle B.
[0084] Polygon A and polygon B are both convex quadrilaterals. There are three cases for finding the intersection of two convex quadrilaterals (polygon S):
[0085] 1) If Figure 8 As shown in (1), the convex quadrilateral A completely falls into the convex quadrilateral B (that is, the two are in a containment relationship). At this time, the intersection polygon S is also a convex quadrilateral, and its area is equal to that of the convex quadrilateral A.
[0086] 2) If Figure 8 As shown in (2), convex quadrilateral A and convex quadrilateral B do not intersect, and the intersection is empty;
[0087] 3) If Figure 8 As shown in (3), (4) and (5), the convex quadrilateral A intersects with the convex quadrilateral B. The intersection result is polygon S. Polygon S is a convex polygon (it may be a convex triangle, convex quadrilateral or convex pentagon). The area of polygon S is part of the area of convex quadrilateral A.
[0088] To achieve the scoring of the shooting quality of the on-site photos (i.e., calculating the automatic matching evaluation score), since the purpose of taking photos is to publish or monitor the broadcast, the on-site photos should capture the advertising materials as completely as possible. Obviously, the above situation 1) is the most satisfactory, situation 2) is the least satisfactory, and situation 3) can capture part of the advertising materials, but it still does not meet the requirements and should be avoided as much as possible when taking photos.
[0089] Taking the above three situations into consideration, we can first determine whether polygon S is a convex quadrilateral. If it does not meet the requirements of a convex quadrilateral, it means that they do not intersect, or they intersect but do not contain. In this case, the requirements are not met, and the automatic matching evaluation score is 0 (excluding most of the cases that do not meet the requirements). If it meets the requirements of a convex quadrilateral, it may be a containment relationship, but it may also be an intersection relationship without a containment relationship. At this time, we can further calculate the area ratio of the polygon S area to the convex quadrilateral A area (evaluation indicator one). Through this evaluation indicator, if it is a containment relationship, the area ratio is exactly 1. If it is an intersection relationship but no containment relationship (and meets the requirements of a convex quadrilateral), the corresponding matching completeness can be effectively known through the area ratio, and it can be converted into part of the evaluation score for feedback.
[0090] Determine whether polygon S is a convex quadrilateral. First, determine whether the number of endpoints of polygon S is equal to 4, that is, whether it is a quadrilateral. If not, it is considered to be unqualified and the automatic matching evaluation score is 0. If it meets the requirement of four vertices of a quadrilateral, the area method is further used to determine whether polygon S is a convex quadrilateral. Fig. 9 As shown in (1) and (2), for any convex quadrilateral, the sum of the areas of the triangles formed by the line connecting any two non-adjacent points is equal to the area of the convex quadrilateral; Fig.10 As shown in (1) and (2), for a concave quadrilateral, only the sum of the areas of the triangles separated by the connecting lines corresponding to the concave points is equal to the area of the concave quadrilateral, but they are not equal in other cases.
[0091] The process of judging whether quadrilateral S is a convex quadrilateral by the area method is as follows: suppose the four vertices of quadrilateral S in the clockwise direction are P1(x1,y2), P2(x2,y2), P3(x3,y3), and P4(x4,y4), and the following equations for the area can be obtained:
[0092]
[0093] When the area When , it means that the quadrilateral is a convex quadrilateral, and the following formula holds:
[0094]
[0095] When the above two judgment conditions are met, the quadrilateral S is a convex quadrilateral S.
[0096] S5. If the polygon S is a convex quadrilateral, the automatic matching evaluation score of the quality of the on-site picture shooting is calculated through a preset evaluation model.
[0097] In this step S5, the preset evaluation model is established by the following formula:
[0098] Suppose the four vertices of the convex quadrilateral S are P1, P2, P3, and P4, and its area is S1. The four vertices of the advertising material image mapped on the pixel area of the on-site image (convex quadrilateral) are R1, R2, R3, and R4, and its (pixel) area is S0. The four internal angles of the convex quadrilateral S are ∠P1, ∠P2, ∠P3, and ∠P4, and the automatic matching evaluation score is γ.
[0099] In the calculation of the automatic matching evaluation score for the on-site pictures, the first main evaluation indicator is the area ratio α of the convex quadrilateral (S) P1P2P3P4 to the quadrilateral R1R2R3R4 after the advertising material picture is mapped. The closer this ratio is to 1, the higher the matching completeness is. The calculation formula is as follows:
[0100]
[0101] Ideally, the ad should appear in the middle of the live photo, and the convex quadrilateral A projected on the live photo is a rectangle. Figure 7 In the middle, line segment OO ′ It is not only perpendicular to the image plane, but also perpendicular to the plane where rectangle T1T2T3T4 is located, and point O, point O ′ and the center of rectangle T1T2T3T4 are collinear, so convex quadrilateral T1 ′ T2 ′ T3 ′ T4 ′ It is a figure that is proportionally reduced from the rectangle T1T2T3T4, so the quadrilateral T1 ′ T2 ′ T3 ′ T4 ′ The four angles are still 90 degrees, quadrilateral T1 ′ T2 ′ T3 ′ T4 ′ is a rectangle. In other cases, Figure 7 Convex quadrilateral T1 ′ T2 ′ T3 ′ T4 ′ The angles of the four corners will deviate from 90 degrees. The greater the deviation, the less ideal the shooting effect.
[0102] Therefore, the second main evaluation index is the average degree deviation β of the four internal angles of the convex quadrilateral (S) P1P2P3P4 from 90 degrees. The closer the value is to 0, the better the shooting effect. The calculation formula is as follows:
[0103]
[0104] In the automatic matching evaluation model proposed in the present invention, the weight of the area ratio α is 0.6, and the weight of the average deviation value β is 0.4. Combining the above two evaluation indicators, the calculation formula of the automatic matching evaluation score γ (percentage system) is as follows:
[0105]
[0106] Based on the same inventive concept as the above-mentioned automatic matching and evaluation method, the present invention further proposes a storage medium on which computer instructions are stored. When the computer instructions are executed by a processor, steps S1-S5 of the automatic matching and evaluation method for advertising materials and on-site photos of the present invention are implemented.
[0107] Based on the same inventive concept as the above-mentioned automatic matching and evaluation method, a computer device is also proposed, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor runs the computer program, the automatic matching and evaluation method for advertising materials and on-site photos of the present invention is implemented.
[0108] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A SIFT-based automatic matching evaluation method for advertising materials and on-site photos, characterized in that: The following steps are involved: S1. Extract feature points from the advertising material image and the on-site image using the SIFT algorithm, quickly match the feature points of the two images, and remove feature points whose distance is greater than a preset distance range; S2. Based on the eliminated feature points, determine whether the number of feature point groups that meet the distance range reaches four or more. If so, calculate the homography matrix H that maps the feature points of the advertising material image to the feature points of the on-site image; otherwise, it is deemed not to meet the requirements; S3. Map the vertex coordinates of the advertising material image to the live image through the homography matrix H, and obtain a polygon A composed of the mapped vertex set V1, and a polygon B composed of the vertex set V2 of the live image. Calculate the intersection of the two polygons A and B on the live image as a polygon S; S4, determine whether the polygon S is a convex quadrilateral, if not, it is considered not to meet the requirements; Otherwise, proceed to step S5; S5. Calculate the automatic matching evaluation score of the quality of the on-site picture shooting through a preset evaluation model.
2. The method for automatically matching and evaluating advertising materials and on-site photos according to claim 1, characterized in that: The intersection calculation process of the two polygons A and B in step S3 includes: S31, let the side of polygon A be e1, the side of polygon B be e2, and the line segments corresponding to the two sides e1 and e2 are P1P2 and Q1Q2 respectively; determine whether the two sides e1 and e2 meet the fast exclusion condition, if so, proceed to step S32, otherwise determine that the two sides do not intersect; S32, judging whether the line segment P1P2 and the line segment Q1Q2 meet the straddling condition, if the line segment P1P2 and the line segment Q1Q2 do not straddle each other, the two line segments do not intersect; if the line segment P1P2 and the line segment Q1Q2 straddle each other, the two line segments intersect; S33, when it is confirmed that the two line segments P1P2 and Q1Q2 have an intersection, the intersection is solved by the vector method; S34. After the intersection point is solved, it is determined whether the side e corresponding to the intersection point is in both polygon A and polygon B to determine the intersection polygon S.
3. The method for automatically matching and evaluating advertising materials and on-site photos according to claim 2, characterized in that: In step S31, let the rectangle with line segment P1P2 as the diagonal be R1, let the rectangle with line segment Q1Q2 as the diagonal be R2, if rectangle R1 and rectangle R2 do not intersect, then the two sides e1 and e2 in polygons A and B have no intersection.
4. The method for automatically matching and evaluating advertising materials and on-site photos according to claim 2, characterized in that: Step S34 is judged by the ray method.
5. The method for automatically matching and evaluating advertising materials and on-site photos according to claim 4, characterized in that: Draw a ray starting from any point on the edge e corresponding to the intersection point, and calculate the number of intersections between the ray and the polygon boundary. If the number of intersections is an odd number, then the arbitrary point is inside the polygon, and thus it is determined that the edge e corresponding to the intersection point is inside the polygon; Otherwise, the arbitrary point is outside the polygon, so it is judged that the edge e corresponding to the intersection point is outside the polygon; For the positional relationship between any point on the edge e corresponding to the intersection point and the polygon, there are the following situations: (1) If the arbitrary point is on a vertex or an edge of a polygon, then it is only necessary to determine whether the arbitrary point is on the edge of the polygon; (2) If any point is on the extension line of the polygon edge, it is considered to have 0 crossings; (3) The ray starting from the arbitrary point intersects the polygon at the vertex of the polygon. At this time, the following rule is set: Assume that the ray starting from the arbitrary point intersects the polygon at the vertex of the polygon, and use the direction of the ray as the positive direction of the X-axis of the two-dimensional coordinate system, and the positive direction of the Y-axis is obtained by rotating the X-axis counterclockwise by 90 degrees; if the vertex is the point with the largest ordinate on the edge, it is considered to have crossed once.
6. The method for automatically matching and evaluating advertising materials and on-site photos according to claim 1, characterized in that: In step S4, it is first determined whether the number of endpoints of the polygon S is equal to 4. If so, it is determined to be a quadrilateral, and then the area method is further used to determine whether the quadrilateral S is a convex quadrilateral.
7. The method for automatically matching and evaluating advertising materials and on-site photos according to claim 6, characterized in that: The process of judging whether quadrilateral S is a convex quadrilateral by the area method is: Assume that the four vertices of quadrilateral S in the clockwise direction are P1(x1,y2), P2(x2,y2), P3(x3,y3), and P4(x4,y4), and we get the following system of equations for the area: When the area , then the quadrilateral is judged to be a convex quadrilateral.
8. The method for automatically matching and evaluating advertising materials and on-site photos according to claim 1, characterized in that: The process of establishing the preset evaluation model in step S5 is as follows: Assume that the four vertices of the convex quadrilateral S are P1, P2, P3, and P4, and its area is S1; the four vertices of the advertising material image mapped in the pixel area of the live image are R1, R2, R3, and R4, and its area is S0; the four internal angles of the convex quadrilateral S are ∠P1, ∠P2, ∠P3, and ∠P4, and the automatic matching evaluation score is γ; the proportion of the area of the convex quadrilateral S to the quadrilateral after the advertising material image is mapped is: The average degree deviation β of the four interior angles of convex quadrilateral S from 90 degrees is: The calculation formula of the automatic matching evaluation score γ is as follows: The weight of the area ratio α is 0.6, and the weight of the average deviation value β is 0.
4.
9. A storage medium having computer instructions stored thereon, characterized in that: When the computer instructions are executed by the processor, the steps of the method for automatically matching and evaluating advertising materials and on-site photos according to any one of claims 1 to 8 are implemented.
10. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor runs the computer program, the method for automatically matching and evaluating advertising materials and on-site photos according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Panorama image stitching method and device
CN105389787A
Parallax image splicing method combining motion least square method and linear constraint
CN110544203A