CN112884746A - Character defect intelligent detection algorithm based on edge shape matching - Google Patents

Character defect intelligent detection algorithm based on edge shape matching Download PDF

Info

Publication number
CN112884746A
CN112884746A CN202110215572.1A CN202110215572A CN112884746A CN 112884746 A CN112884746 A CN 112884746A CN 202110215572 A CN202110215572 A CN 202110215572A CN 112884746 A CN112884746 A CN 112884746A
Authority
CN
China
Prior art keywords
image
point
edge
defect
contour
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
CN202110215572.1A
Other languages
Chinese (zh)
Other versions
CN112884746B (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.)
Qingdao Xingke Ruisheng Information Technology Co ltd
Original Assignee
Qingdao Xingke Ruisheng Information Technology Co 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 Qingdao Xingke Ruisheng Information Technology Co ltd filed Critical Qingdao Xingke Ruisheng Information Technology Co ltd
Priority to CN202110215572.1A priority Critical patent/CN112884746B/en
Publication of CN112884746A publication Critical patent/CN112884746A/en
Application granted granted Critical
Publication of CN112884746B publication Critical patent/CN112884746B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • G06T2207/30144Printing quality
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

The invention discloses an intelligent character defect detection algorithm based on edge shape matching, which comprises the following steps: the algorithm determines an optimal edge segmentation threshold value based on gradient data obtained after Sobel operator filtering according to the length of an edge connected domain, and obtains the gradient direction and coordinates of edge contour points as matching information. And according to the matching degree of the contour points, searching for the defective points by using a mode of combining rough screening and fine screening, and then marking the character defective areas by using a mode of searching for connected domains based on defective point filling. In order to enable the matching algorithm to meet the real-time requirement, a self-adaptive image pyramid algorithm and a search strategy which is ended in advance through threshold judgment are adopted. The similarity measurement adopted by the invention is not influenced by the conditions of shielding, chaos, linear and nonlinear illumination change and the like, so that the character printing defects can still be quickly and accurately positioned in the illumination change environment.

Description

Character defect intelligent detection algorithm based on edge shape matching
Technical Field
The invention relates to character quality defect detection of electronic product printing, in particular to an intelligent character defect detection algorithm based on edge shape matching, which is suitable for detecting related printed character defects in various electronic devices.
Background
With the rapid development of industrial automation technology, the production and manufacturing level is gradually improved, and the requirements of consumers on the product quality are also continuously improved. Therefore, it is very important to control the quality of the product production process.
In many industrial productions, the traditional manual detection is still adopted in the printing quality detection link of the product, the manual detection mainly comprises the steps of carefully observing the characters, characters and numbers printed on the product through human eyes, and connecting the characters, characters and numbers with an existing experience or standard model for judgment to complete the defect detection of the product. The traditional manual detection method is flexible and can quickly adapt to the responsible detection task; however, the spirit is highly concentrated for a long time during detection, and the detection accuracy is reduced due to the influence of fatigue or psychological factors, and meanwhile, the human eye detection needs to be observed sample by sample, so that the efficiency is low, and the industrial automation requirement is difficult to meet.
Most of the existing product printing quality defect detection methods adopt a template matching algorithm based on gray level to position a printing area, and utilize the difference between a template image and the positioned area to realize the defect detection of a target.
Disclosure of Invention
In order to avoid the defects of the traditional manual detection and the defects of the existing method, an intelligent character defect detection algorithm based on edge shape matching is provided. The method is based on gradient data obtained after Sobel operator filtering, and determines an optimal edge segmentation threshold value according to the length of an edge connected domain. Obtaining the gradient direction and coordinates of the edge contour points as matching information, searching for the defective points by using a mode of combining coarse screening and fine screening according to the matching degree of the contour points, and then marking character defect areas by using a mode of searching for connected domains based on the filling of the neighborhood of the defective points. In order to enable the matching algorithm to meet the real-time requirement, a self-adaptive image pyramid algorithm and a search strategy which is ended in advance through threshold judgment are adopted. The result shows that the method can realize high-precision real-time detection of the defects of the printed characters.
In order to solve the technical problems, the invention adopts the following technical scheme:
an intelligent character defect detection algorithm based on edge shape matching comprises the following steps:
A. manufacturing a template: and extracting contour points for optimally describing the printed characters, removing the influence of textures and noise, and calculating the coordinate position of the contour points and the normalized gradient direction vector by using the obtained contour points to manufacture a template. Because the target angle in the image to be detected is random, the template is manufactured once at regular intervals of rotation angle step length in order to obtain the accurate position of the target.
B. Contour matching: and solving the gradient direction of the image to be detected, taking the point multiplication value of the gradient of the edge outline point of the template and the gradient of the corresponding point of the image to be detected as similarity measurement, and calculating the position of the target character on the image to be detected through pixel-by-pixel sliding windows.
C. Defect detection and positioning: after the position of a target on an image to be detected is obtained, according to the matching degree of the character contour points, the defect points are searched in a mode of combining coarse screening and fine screening, and the defect positions are located by a method of solving the minimum circumscribed rectangle based on the filling of the defect points.
D. And (3) accelerating a search strategy: in order to enable the defect detection algorithm to meet the real-time requirement of industrial detection, a self-adaptive image pyramid algorithm and a search strategy which is ended in advance through threshold judgment are adopted.
The character defect intelligent detection algorithm, wherein the step a specifically further comprises: firstly, a Sobel operator is adopted to obtain image gray values of edge detection in the horizontal direction and the vertical direction, but because the image edge obtained by the Sobel operator is influenced by noise, all edge gradient amplitudes are determined on the basis of image edge extraction by the Sobel operator in order to remove the influence of noise and texture, edges larger than an edge gradient threshold value are extracted from a template image and are restrained by non-maximum values, then the edges are further segmented at a high curvature point, a Two-Pass connected region marking algorithm is adopted to process the edge image to obtain the number of connected domains, and the total length of the edges is calculated to be divided by the number of the connected domains to obtain the average length of the edges. And setting the gradient amplitude corresponding to the maximum value of the average length as an edge segmentation threshold. And regarding the determination of the template rotation angle step, calculating the rotation angle of the contour point farthest from the center of the template around the center of the template according to the cosine law to calculate the rotation angle step. In order to avoid mismatching, the step length of the rotation angle is not set too large. Meanwhile, in order to avoid repeated matching, the step length of the rotation angle is not set too small. The method uses an angle corresponding to the connection line between the contour point farthest from the center of the template and the center point of the template and the rotation of 2 pixels as the rotation step length.
The character defect intelligent detection algorithm, wherein the step B specifically further comprises: after the optimal edge contour segmentation threshold is obtained, a template is manufactured by using the coordinate position of the obtained contour point and the normalized gradient direction vector, and the template is converted into a series of character contour points Pi=(Xi,Yi)TI is 1, 2, … n, and a normalized gradient direction vector d is obtained for each pointi=(ti,ui)T. For the image to be detected, calculating the gradient direction vector e of each point (X, Y) after normalization by using Sobel operator filteringx,y=(vx,y,wx,y)T. The similarity metric function is:
Figure BSA0000234664440000021
the character defect intelligent detection algorithm, wherein the step C specifically further comprises: after contour matching, each contour point has a degree of match. In the defect extraction process, a mode of combining rough screening and fine screening is adopted to search for defect points, and defects are extracted based on a method of filling the defect points to obtain minimum circumscribed rectangles.
The intelligent character defect detection algorithm specifically comprises the step D of finishing calculation in advance at a non-target point and performing matching at the next position because the matching degree score of the region outside the target character of the image to be detected is low. Therefore, the algorithm processing speed can be effectively accelerated, and the calculated amount in the matching process is reduced. The strategy of terminating the calculation by setting the threshold value can reduce the running time of the algorithm, but does not change the complexity of the algorithm. The complexity of the algorithm can be reduced by constructing a multi-layered image pyramid.
The invention has the following advantages:
according to the intelligent character defect detection algorithm based on edge shape matching, an optimal edge segmentation threshold value is obtained according to the average length of the edge, and contour points capable of optimally describing characters are extracted, so that the influence of texture and noise is removed. And calculating the coordinate position of the contour points and the normalized gradient direction vector by using the obtained contour points to manufacture a template. Therefore, after the target is matched on the diagram to be detected, defect analysis is performed according to the matching degree of each character contour point. Using the gradient direction as a matching feature, rather than the gradient magnitude, makes the feature robust to illumination variations. And a self-adaptive image pyramid algorithm and a search strategy of judging the early termination by a threshold value are adopted, so that the method meets the real-time requirement of industrial detection. The defect position can be accurately detected in real time by targets with random angles in the image to be detected in a complex illumination environment.
Drawings
FIG. 1 is a schematic flow chart of an intelligent character defect detection algorithm based on edge shape matching according to the present invention.
FIG. 2 is a schematic diagram of a template graph and an extracted outline of a character.
Fig. 3 is a schematic diagram of rotation step determination.
FIG. 4 is a diagram of an example of a character defect image of a printed matter and a detection result.
Detailed Description
The invention is described in further detail below with reference to the following figures and detailed description:
the invention provides an intelligent character defect detection algorithm based on edge shape matching, which comprises the following specific steps as shown in figure 1:
firstly, extracting contour points for optimally describing printed characters, removing the influence of textures and noise, and solving the coordinate position of the contour points and a normalized gradient direction vector by using the obtained contour points to manufacture a template. Because the target angle in the image to be detected is random, the template is manufactured once at regular intervals of rotation angle step length in order to obtain the accurate position of the target.
For determining the rotation angle step, as shown in fig. 3, assuming that the point O is the template center point, the point a is the farthest contour point, the point B is the rotated point of the point a, the side length AB is 1, and OA is OB, and the included angle between OA and OB is determined by the cosine law
Figure BSA0000234664440000031
And (4) an angle.
Figure BSA0000234664440000032
And secondly, solving the gradient direction of the image to be detected, taking the point multiplication value of the gradient of the edge outline point of the template and the gradient of the corresponding point of the image to be detected as similarity measurement, and calculating the position of the target character on the image to be detected by pixel-by-pixel sliding window. The similarity metric function is:
Figure BSA0000234664440000033
in the formula (d)i=(ti,ui)TAs template character contour points Pi=(Xi,Yi)TI is the normalized gradient direction vector of 1, 2, … n, ex,y=(vx,y,wx,y)TAnd normalizing the gradient direction vector of each point (X, Y) of the image to be detected.
And thirdly, after the position of the target on the image to be detected is obtained, searching for a defect point through a mode of combining coarse screening and fine screening according to the matching degree of the character contour point, and positioning the defect position based on a method of filling the defect point to obtain a minimum circumscribed rectangle.
After the target character position is detected on the image to be detected, points with the score of more than or equal to 0.75 of the contour points of the target character are removed, and points with the score of less than 0.75 are reserved. Considering the influence of noise, the contour points obtained by coarse screening may not be true defect points, and therefore further screening is needed. Considering that noise points generally exist in isolation, traversal is performed in a certain region of points obtained by coarse screening, and if the region has more than a certain number of points with scores less than 0.75, the points are considered as true defect points. After the actual defect point is obtained, it is inconvenient to determine the specific defect position because the defect point exists discretely. Therefore, in order to locate the area where the character defect is located, the gray value in the 12 × 12 area around the defect point is filled to 255, and the gray values at other positions are set to 0. Then, the minimum circumscribed rectangle where the contour of the binary image is located is found, and the minimum circumscribed rectangle is the character defect area.
And fourthly, in order to enable the defect detection algorithm to meet the real-time requirement of industrial detection, a self-adaptive image pyramid algorithm and a search strategy which is ended in advance through threshold judgment are adopted.
The matching degree score of the region outside the target character of the image to be detected is low, so a certain strategy can be adopted, the calculation is finished in advance at the non-target point, and the matching at the next position is carried out. According to the similarity metric function, the part and formula of the similarity metric can be obtained as follows:
Figure BSA0000234664440000041
because of the vector diAnd ex,yIs a normalized gradient direction vector, so that the sum of the first j terms is less than j/n, and the sum of the remaining n-j terms is less than (n-j)/n-1-j/n, as can be seen from the formula, so that when the partial sum satisfies Sj<Smin-1+j/n(SminA set threshold) the calculation of the position can be ended and the calculation of the next position can be performed.
The method adopts a self-adaptive image pyramid algorithm, when the number of contour points of an image pyramid at a certain layer is about a certain number and the higher layer is smaller than the value, the character image still has more complete contour characteristic points at the layer, and the layer is determined as the highest layer of the image pyramid. The method sets the number of contour points to 100.
FIG. 4 is a diagram of an example of a character defect image of a printed matter and a detection result, and it can be seen that the contour points of the target character are accurately matched and the defect position is also accurately detected, and the detection time is within 1s, which shows that the method of the present invention can realize high-precision real-time detection of the printing defect.
It should be understood, however, that the description herein of specific embodiments is not intended to limit the invention to the particular forms disclosed, but on the contrary, the intention is to cover all modifications, equivalents, and alternatives falling within the spirit and scope of the invention as defined by the appended claims.

Claims (4)

1. An intelligent character defect detection algorithm based on edge shape matching is characterized by comprising the following steps:
A. manufacturing a template: extracting contour points for optimally describing printed characters, removing the influence of textures and noise, solving the coordinate position of the contour points and a normalized gradient direction vector by using the obtained contour points to manufacture a template, wherein the template is manufactured at intervals of a certain rotation angle step length in order to obtain the accurate position of a target because the target angle in an image to be detected is random;
B. contour matching: solving the gradient direction of the image to be detected, taking the point multiplication value of the gradient of the edge contour point of the template and the gradient of the corresponding point of the image to be detected as similarity measurement, and calculating the position of the target character on the image to be detected by pixel-by-pixel sliding window;
C. defect detection and positioning: after the position of a target on an image to be detected is obtained, searching for a defect point in a mode of combining coarse screening and fine screening according to the matching degree of the character contour point, and positioning the defect position based on a method of filling the defect point to obtain a minimum circumscribed rectangle;
D. and (3) accelerating a search strategy: in order to enable the defect detection algorithm to meet the real-time requirement of industrial detection, a self-adaptive image pyramid algorithm and a search strategy which is ended in advance through threshold judgment are adopted.
2. The intelligent character defect detection algorithm based on edge shape matching according to claim 1, wherein in the step a, the specific extraction method is as follows:
in order to remove the influence of noise and texture, determining all edge gradient amplitudes on the basis of extracting image edges by a Sobel operator, extracting edges larger than an edge gradient threshold value from a template image, inhibiting the edges through a non-maximum value, further segmenting the edges at a high curvature point, processing the edge image by adopting a Two-Pass connected region marking algorithm to obtain the number of connected domains, and calculating the total length of the edges to divide the number of the connected domains to obtain the average length of the edges. And setting the gradient amplitude corresponding to the maximum value of the average length as an edge segmentation threshold.
3. The intelligent character defect detection algorithm based on edge shape matching according to claim 1, wherein in the step B, the specific extraction method is as follows:
after the optimal edge contour segmentation threshold is obtained, a template is manufactured by using the coordinate position of the obtained contour point and the normalized gradient direction vector, and the template is converted into a series of character contour points Pi=(Xi,Yi)TI is 1, 2, … n, and a normalized gradient direction vector d is obtained for each pointi=(ti,ui)T. For the image to be detected, calculating the gradient direction vector e of each point (X, Y) after normalization by using Sobel operator filteringx,y=(vx,y,wx,y)T
4. The intelligent character defect detection algorithm based on edge shape matching according to claim 1, wherein in the step C, the specific extraction method is as follows:
after contour matching, each contour point has a degree of match. In the defect extraction process, a mode of combining rough screening and fine screening is adopted to search for defect points, and defects are extracted based on a method of filling the defect points to obtain minimum circumscribed rectangles.
CN202110215572.1A 2021-02-22 2021-02-22 Character defect intelligent detection algorithm based on edge shape matching Active CN112884746B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110215572.1A CN112884746B (en) 2021-02-22 2021-02-22 Character defect intelligent detection algorithm based on edge shape matching

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110215572.1A CN112884746B (en) 2021-02-22 2021-02-22 Character defect intelligent detection algorithm based on edge shape matching

Publications (2)

Publication Number Publication Date
CN112884746A true CN112884746A (en) 2021-06-01
CN112884746B CN112884746B (en) 2024-08-27

Family

ID=76054608

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110215572.1A Active CN112884746B (en) 2021-02-22 2021-02-22 Character defect intelligent detection algorithm based on edge shape matching

Country Status (1)

Country Link
CN (1) CN112884746B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114998922A (en) * 2022-07-29 2022-09-02 成都薯片科技有限公司 Electronic contract generation method based on format template
CN115050017A (en) * 2022-08-16 2022-09-13 南通万瑞精密机械加工有限公司 Electric power fitting surface inscription identification method based on machine vision
CN116452580A (en) * 2023-06-13 2023-07-18 山东古天电子科技有限公司 Notebook appearance quality detection method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102654902A (en) * 2012-01-16 2012-09-05 江南大学 Contour vector feature-based embedded real-time image matching method
WO2019041590A1 (en) * 2017-08-31 2019-03-07 中国科学院微电子研究所 Edge detection method using arbitrary angle
CN110220917A (en) * 2019-06-11 2019-09-10 江苏农林职业技术学院 A kind of crown plug surface defect online test method based on image procossing

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102654902A (en) * 2012-01-16 2012-09-05 江南大学 Contour vector feature-based embedded real-time image matching method
WO2019041590A1 (en) * 2017-08-31 2019-03-07 中国科学院微电子研究所 Edge detection method using arbitrary angle
CN110220917A (en) * 2019-06-11 2019-09-10 江苏农林职业技术学院 A kind of crown plug surface defect online test method based on image procossing

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张代林;陈文广;谢经明;陈幼平;: "基于形状模板匹配的印刷品缺陷检测", 机械与电子, no. 12, 24 December 2013 (2013-12-24) *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114998922A (en) * 2022-07-29 2022-09-02 成都薯片科技有限公司 Electronic contract generation method based on format template
CN114998922B (en) * 2022-07-29 2022-11-04 成都薯片科技有限公司 Electronic contract generating method based on format template
CN115050017A (en) * 2022-08-16 2022-09-13 南通万瑞精密机械加工有限公司 Electric power fitting surface inscription identification method based on machine vision
CN116452580A (en) * 2023-06-13 2023-07-18 山东古天电子科技有限公司 Notebook appearance quality detection method
CN116452580B (en) * 2023-06-13 2023-09-01 山东古天电子科技有限公司 Notebook appearance quality detection method

Also Published As

Publication number Publication date
CN112884746B (en) 2024-08-27

Similar Documents

Publication Publication Date Title
CN107808378B (en) Method for detecting potential defects of complex-structure casting based on vertical longitudinal and transverse line profile features
CN112884746A (en) Character defect intelligent detection algorithm based on edge shape matching
CN112819772B (en) High-precision rapid pattern detection and recognition method
CN107610111B (en) deep learning-based welding spot image detection method
CN104732536A (en) Sub-pixel edge detection method based on improved morphology
CN111862037A (en) Method and system for detecting geometric characteristics of precision hole type part based on machine vision
CN109658391B (en) Circle radius measuring method based on contour merging and convex hull fitting
CN112037203A (en) Side surface defect detection method and system based on complex workpiece outer contour registration
CN102982545B (en) A kind of image depth estimation method
CN115294099B (en) Method and system for detecting hairline defect in steel plate rolling process
CN112233116B (en) Concave-convex mark visual detection method based on neighborhood decision and gray level co-occurrence matrix description
CN112734761B (en) Industrial product image boundary contour extraction method
CN111401449B (en) Image matching method based on machine vision
CN108802051B (en) System and method for detecting bubble and crease defects of linear circuit of flexible IC substrate
CN112381140B (en) Abrasive particle image machine learning identification method based on new characteristic parameters
CN113781413B (en) Electrolytic capacitor positioning method based on Hough gradient method
CN113673396B (en) Spore germination rate calculation method, device and storage medium
CN112102189B (en) Line structure light bar center line extraction method
CN115619799B (en) Grain image segmentation method and system based on transfer learning
CN112489052A (en) Line structure light central line extraction method under complex environment
CN110853097A (en) Biscuit identification and positioning method applied to biscuit surface pattern printing equipment
CN108985294B (en) Method, device and equipment for positioning tire mold picture and storage medium
CN116188408A (en) Canny-based vamp edge detection and identification method
CN113643290B (en) Straw counting method and device based on image processing and storage medium
CN114418975A (en) Cutting method of large-area animal fur contour image based on radius increment constraint

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