CN113298803B - Magnet piece detection method, system, equipment and computer readable storage medium - Google Patents

Magnet piece detection method, system, equipment and computer readable storage medium Download PDF

Info

Publication number
CN113298803B
CN113298803B CN202110660043.2A CN202110660043A CN113298803B CN 113298803 B CN113298803 B CN 113298803B CN 202110660043 A CN202110660043 A CN 202110660043A CN 113298803 B CN113298803 B CN 113298803B
Authority
CN
China
Prior art keywords
detected
value
gray
determining
magnet piece
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.)
Active
Application number
CN202110660043.2A
Other languages
Chinese (zh)
Other versions
CN113298803A (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 Research Institute Of Beihang University
Qingdao Technology Branch Of Weihai Jianhong Construction Engineering Co ltd
Goertek Techology Co Ltd
Original Assignee
Qingdao Research Institute Of Beihang University
Qingdao Technology Branch Of Weihai Jianhong Construction Engineering Co ltd
Goertek Optical 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 Research Institute Of Beihang University, Qingdao Technology Branch Of Weihai Jianhong Construction Engineering Co ltd, Goertek Optical Technology Co Ltd filed Critical Qingdao Research Institute Of Beihang University
Priority to CN202110660043.2A priority Critical patent/CN113298803B/en
Publication of CN113298803A publication Critical patent/CN113298803A/en
Application granted granted Critical
Publication of CN113298803B publication Critical patent/CN113298803B/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
    • 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/20Special algorithmic details
    • G06T2207/20036Morphological image processing

Abstract

The application discloses a magnet piece detection method, a system, equipment and a computer readable storage medium, which are used for acquiring a target image of a magnet piece to be detected; acquiring a preset template of a region to be detected; determining a region to be detected corresponding to a region template to be detected in a target image based on an indirect adjustment method; calculating gray value information of the area to be detected; and determining the detection result of the magnet piece to be detected based on the gray value information and the preset threshold value. According to the method, the to-be-detected area corresponding to the to-be-detected area template can be rapidly determined in the target image through an indirect adjustment method, the detection result of the to-be-detected magnet piece can be determined based on the gray value information and the preset threshold value only by calculating the gray value information of the to-be-detected area, and the performance of the to-be-detected magnet piece can be rapidly detected. The magnet piece detecting system, the magnet piece detecting equipment and the computer-readable storage medium solve the corresponding technical problems.

Description

Magnet piece detection method, system, equipment and computer readable storage medium
Technical Field
The present application relates to the field of speaker technology in the electroacoustic industry, and more particularly, to a magnet sheet detection method, system, device, and computer-readable storage medium.
Background
In a speaker of an electronic device such as a mobile phone or an earphone, a magnet piece is mounted, and the quality of the magnet piece affects the performance of the speaker.
In summary, the examination of the magnet pieces is an urgent problem to be solved by those skilled in the art.
Disclosure of Invention
The application aims to provide a magnet piece detection method which can solve the technical problem of how to detect the magnet piece to a certain extent. The application also provides a magnet piece detection system, equipment and a computer readable storage medium.
In order to achieve the above purpose, the present application provides the following technical solutions:
a magnet piece inspection method comprising:
acquiring a target image of the magnet piece to be detected;
acquiring a preset template of a region to be detected;
determining a region to be detected corresponding to the region template to be detected in the target image based on an indirect adjustment method;
calculating gray value information of the area to be detected;
and determining the detection result of the magnet piece to be detected based on the gray value information and a preset threshold value.
Preferably, the determining, based on the indirect adjustment method, the to-be-detected region corresponding to the to-be-detected region template in the target image includes:
determining locating point information of the target image;
determining a two-dimensional steel body transformation matrix between the template of the area to be detected and the positioning point information through an operation formula based on the indirect adjustment method;
mapping the template of the area to be detected to the target image based on the two-dimensional steel body transformation matrix to obtain the area to be detected;
the operation formula comprises:
Figure GDA0003688018910000021
Figure GDA0003688018910000022
wherein R isbRepresenting the two-dimensional steel body transformation matrix;
Figure GDA0003688018910000023
expressing the local variation of the adjustment parameters, wherein six adjustment parameters express corresponding parameter values in the two-dimensional steel body transformation matrix; r is a radical of hydrogen1、r2、r3、r4Representing multiple rotation terms; t is trx、tryRepresenting a translation term; b represents a mapping matrix constructed based on the template of the area to be detected and the locating point information; p represents an identity matrix; b isTRepresents a transpose of B; and l represents the difference value between the observed value and the corresponding approximate value in the indirect adjustment method.
Preferably, the determining the anchor point information of the target image includes:
converting the target image into a grey-scale map;
carrying out binarization operation on the gray level image to obtain a target binarization image;
and respectively carrying out integral projection in the horizontal direction and the vertical direction on the target binary image, and determining the positioning point information according to the projection result.
Preferably, the binarizing the gray-scale map to obtain a target binarized map includes:
carrying out binarization operation on the gray level image to obtain an initial binarization image;
performing morphological operation on the initial binary image to obtain a processed image;
extracting the longest straight line in the processed image based on Hough transform;
correcting the gray level image based on the longest straight line to obtain a corrected gray level image;
and carrying out binarization operation on the positive-turning gray level image to obtain the target binarization image.
Preferably, the calculating gray scale value information of the region to be detected includes:
calculating a target gray mean value and a target first-order gray derivative mean value of the area to be detected;
the determining the detection result of the magnet piece to be detected based on the gray value information and the preset threshold value comprises the following steps:
selecting a to-be-detected sub-region in the to-be-detected region;
calculating a first gray mean value and a first one-step gray derivative mean value of the subarea to be detected;
calculating a first difference value between the first gray level mean value and the target gray level mean value;
calculating a second difference value between the first-order gray derivative mean value and the target first-order gray derivative mean value;
and comparing the first difference value and the second difference value with the preset threshold value, and determining the detection result according to the comparison result.
Preferably, the comparing the first difference and the second difference with the preset threshold and determining the detection result according to the comparison result includes:
judging whether the first difference value is larger than a first threshold value or not and whether the second difference value is larger than a second threshold value or not, and if the first difference value is larger than the first threshold value and the second difference value is larger than the second threshold value, determining that the detection result that the magnet piece to be detected is whitish exists;
and/or
And judging whether the first difference value is smaller than a third threshold value and whether the second difference value is smaller than a fourth threshold value, and if the first difference value is smaller than the third threshold value and the second difference value is smaller than the fourth threshold value, determining that the magnet piece to be detected has a bright detection result.
Preferably, the acquiring a preset template of the area to be detected includes:
and acquiring a preset template of the area to be detected, wherein the template of the area to be detected comprises templates consisting of runways on two sides and a middle rectangle.
A magnet sheet inspection system, comprising:
the first acquisition module is used for acquiring a target image of the magnet piece to be detected;
the second acquisition module is used for acquiring a preset area template to be detected;
the first determining module is used for determining a to-be-detected area corresponding to the to-be-detected area template in the target image based on an indirect adjustment method;
the first calculation module is used for calculating gray value information of the to-be-detected region;
and the second determining module is used for determining the detection result of the magnet piece to be detected based on the gray value information and a preset threshold value.
A magnet piece inspection apparatus, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the magnet piece detecting method as described above when the computer program is executed.
A computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the magnet piece detecting method as described in any one of the above.
According to the magnet piece detection method, the target image of the magnet piece to be detected is obtained; acquiring a preset template of a region to be detected; determining a region to be detected corresponding to a region template to be detected in a target image based on an indirect adjustment method; calculating gray value information of the area to be detected; and determining the detection result of the magnet piece to be detected based on the gray value information and the preset threshold value. According to the method, the to-be-detected area corresponding to the to-be-detected area template can be rapidly determined in the target image through an indirect adjustment method, the detection result of the to-be-detected magnet piece can be determined based on the gray value information and the preset threshold value only by calculating the gray value information of the to-be-detected area, and the performance of the to-be-detected magnet piece can be rapidly detected. The application provides a magnet piece detecting system, equipment and computer readable storage medium has also solved corresponding technical problem.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only the embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a magnet piece inspection method according to an embodiment of the present disclosure;
fig. 2 is a flow chart of locating point information determination provided in the embodiment of the present application;
FIG. 3 is a schematic illustration of a gray scale map;
FIG. 4 is a schematic diagram of an initial binarization map;
FIG. 5 is a schematic diagram of processing an image;
FIG. 6 is a schematic view of a positive gray scale map;
FIG. 7 is a schematic diagram of a target binarization image;
FIG. 8 is a diagram illustrating the projection result;
FIG. 9 is a diagram illustrating anchor point information;
FIG. 10 is a schematic diagram of a template of an area to be detected;
fig. 11 is a schematic view of a magnet piece inspection system according to an exemplary embodiment of the present application;
fig. 12 is a schematic structural view of a magnet piece inspection apparatus according to an embodiment of the present application;
fig. 13 is another schematic structural view of a magnet piece inspection apparatus according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, fig. 1 is a flowchart of a magnet piece detecting method according to an embodiment of the present disclosure.
The magnet piece detection method provided by the embodiment of the application can comprise the following steps:
step S101: and acquiring a target image of the magnet piece to be detected.
In practical applications, the performance of the magnet piece can be detected by the image information of the magnet piece, so that the target image of the magnet piece to be detected can be acquired first.
Step S102: and acquiring a preset template of the area to be detected.
In practical application, the size influence of the target image is considered, if all the target images are calculated to determine the performance of the magnet piece to be detected, the detection process is possibly complicated, the efficiency is low, in order to avoid the problem, a preset template of the area to be detected can be obtained, the corresponding area to be detected is determined in the target image by means of the template of the area to be detected, and the performance detection is performed on the magnet piece to be detected by the area to be detected.
Step S103: and determining a region to be detected corresponding to the region template to be detected in the target image based on an indirect adjustment method.
In practical application, in order to quickly determine the region to be detected, the region to be detected corresponding to the template of the region to be detected can be determined in the target image based on an indirect adjustment method. The indirect adjustment is an adjustment method for obtaining the most probable value of the unknown quantity according to the principle of least square method by selecting independent quantities without any condition relation between the independent quantities as the unknown quantity to form a functional relation for expressing measurement by the unknown quantity, listing an error equation and obtaining the most probable value of the unknown quantity when determining the most probable value of a plurality of unknown quantities.
Step S104: and calculating gray value information of the area to be detected.
Step S105: and determining the detection result of the magnet piece to be detected based on the gray value information and the preset threshold value.
In practical application, after the area to be detected is determined, the gray information of the area to be detected can be calculated, and the detection result of the magnet piece to be detected is determined based on the gray information and the preset threshold.
It should be noted that, since the color and brightness of each point of the region to be detected are different, and the calculated gray value information is different, the whitening or brightening detection can be performed on the magnet piece to be detected by means of the gray value information and the preset threshold, that is, the detection result can be the whitening or brightening of the magnet piece to be detected.
According to the magnet piece detection method, the target image of the magnet piece to be detected is obtained; acquiring a preset template of a region to be detected; determining a to-be-detected area corresponding to the to-be-detected area template in the target image based on an indirect adjustment method; calculating gray value information of the area to be detected; and determining the detection result of the magnet piece to be detected based on the gray value information and the preset threshold value. According to the method, the to-be-detected area corresponding to the to-be-detected area template can be rapidly determined in the target image through an indirect adjustment method, the detection result of the to-be-detected magnet piece can be determined based on the gray value information and the preset threshold value only by calculating the gray value information of the to-be-detected area, and the performance of the to-be-detected magnet piece can be rapidly detected.
In the method for detecting a magnet sheet provided in the embodiment of the present application, in the process of determining the to-be-detected region corresponding to the to-be-detected region template in the target image based on the indirect adjustment method, the method may include the following steps:
determining locating point information of a target image;
determining a two-dimensional steel body transformation matrix between the template of the area to be detected and the positioning point information through an operational formula based on an indirect adjustment method;
mapping a template of the area to be detected to a target image based on a two-dimensional steel body transformation matrix to obtain the area to be detected;
the operation formula comprises:
Figure GDA0003688018910000061
Figure GDA0003688018910000062
wherein R isbRepresenting a two-dimensional steel body transformation matrix;
Figure GDA0003688018910000063
expressing the local variation of the adjustment parameters, wherein six adjustment parameters express corresponding parameter values in a two-dimensional steel body transformation matrix; r is a radical of hydrogen1、r2、r3、r4Representing multiple rotation terms; t is trx、tryRepresenting a translation term; b represents a mapping matrix constructed based on the template of the area to be detected and the locating point information; p represents an identity matrix; b isTRepresents the transpose of B; and l represents the difference between the observed value and the corresponding approximate value in the indirect adjustment method.
The derivation process of the operation formula is as follows:
suppose a transformation matrix such as RbAs shown, according to the indirect adjustment theory, the error equation is:
Figure GDA0003688018910000071
wherein V represents an error value in the indirect adjustment; the adjustment criterion is: vTPV is min; according to the least square principle, the method can be obtained as follows:
Figure GDA0003688018910000072
finally, the following can be obtained:
Figure GDA0003688018910000073
in a specific application scenario, in the process of determining a two-dimensional steel body transformation matrix between a template of a region to be detected and positioning point information through an operational formula based on an indirect adjustment method, template point information corresponding to the positioning point information can be determined in the template of the region to be detected, and then the two-dimensional steel body transformation matrix between the positioning point information and the template point information is determined through the operational formula based on the indirect adjustment method; correspondingly, in the process of mapping the template of the area to be detected to the target image based on the two-dimensional steel body transformation matrix to obtain the area to be detected, the point set of the template of the area to be detected and the two-dimensional steel body transformation matrix can be operated to obtain the point set information of the area to be detected, and the area to be detected and the like can be determined on the target image according to the point set information of the area to be detected.
In the magnet piece detection method provided by the embodiment of the application, in the process of determining the locating point information of the target image, the locating point information can be quickly determined by means of operations such as gray scale, binaryzation and the like, that is, the method can also comprise the following steps:
converting the target image into a gray scale image;
carrying out binarization operation on the gray level image to obtain a target binarization image;
and respectively carrying out integral projection in the horizontal direction and the vertical direction on the target binary image, and determining positioning point information according to the projection result.
Referring to fig. 2, in a specific application scenario, the process of determining the anchor point information of the target image may include the following steps:
step S201: the target image is converted into a grayscale image.
Step S202: and carrying out binarization operation on the gray level image to obtain an initial binarization image.
In practical applications, in order to facilitate processing of the image, the target image may be first converted into a gray-scale map, a schematic result diagram of which may be as shown in fig. 3, and then the gray-scale map is binarized to obtain an initial binary diagram, a schematic result diagram of which may be as shown in fig. 4.
Step S203: and performing morphological operation on the initial binary image to obtain a processed image.
In practical applications, in consideration of image processing errors caused by noise influence, background influence and the like in an image, morphological operations can be performed on the initial binary image to obtain a processed image without error influence, and a schematic result diagram of the processed image can be as shown in fig. 5 to accurately process the image. The morphological operation in the image processing is used in scenes such as image and processing operation (denoising, shape simplification and the like), image enhancement (skeleton extraction, refinement, convex hull and object marking), object background segmentation, object morphological quantification and the like.
Step S204: based on the hough transform, the longest straight line in the processed image is extracted.
Step S205: and (5) correcting the gray scale image based on the longest straight line to obtain a corrected gray scale image.
In practical applications, because the template of the region to be detected is forward, if the target image is not forward, the final locating point information may not match the template of the region to be detected, after the processed image is obtained, the longest straight line in the processed image needs to be extracted based on hough transform, and the grayscale map is converted into forward based on the longest straight line, so as to obtain a converted grayscale map, where a schematic result map may be as shown in fig. 6.
Step S206: and carrying out binarization operation on the positive gray map to obtain a target binarization map.
In practical application, after the positive-transition gray scale map is obtained, the positive-transition gray scale map needs to be binarized again to obtain a target binary map, and a schematic result map of the target binary map can be shown in fig. 7.
Step S207: and respectively carrying out integral projection in the horizontal direction and the vertical direction on the target binary image, and determining positioning point information according to the projection result.
In practical application, after the target binary image is obtained, integral projection in the horizontal direction and integral projection in the vertical direction can be performed on the target binary image, the projection result can be as shown in fig. 8, and positioning point information can be determined according to the projection result, wherein the positioning point information can include coordinate information of three points, namely, an upper left corner, an upper right corner and a lower left corner, and the like, and at this time, the positioning point information can be as shown in fig. 9, and certainly, the positioning point information can be flexibly determined according to actual needs.
In the magnet sheet detection method provided by the embodiment of the application, in the process of calculating the gray value information of the area to be detected, the following steps may be performed:
calculating a target gray level mean value and a target first-order gray level derivative mean value of a region to be detected;
accordingly, in the process of determining the detection result of the magnet piece to be detected based on the gray value information and the preset threshold, it may be:
selecting a to-be-detected sub-region in a to-be-detected region;
calculating a first gray mean value and a first one-order gray derivative mean value of a subregion to be detected;
calculating a first difference value between the first gray level mean value and the target gray level mean value;
calculating a second difference value between the first-order gray derivative mean value and the target first-order gray derivative mean value;
and comparing the first difference value and the second difference value with a preset threshold value, and determining a detection result according to the comparison result.
It should be noted that, the sub-region to be detected and the region to be detected may be divided into fine fractions according to actual needs, for example, the region to be detected may be divided into a plurality of portions to be detected first, and a corresponding sub-region to be detected is determined in each portion to be detected, so that in the process of calculating the target gray level mean value and the target first-order gray level derivative mean value of the region to be detected, the target gray level mean value and the target first-order gray level derivative mean value of each portion to be detected need to be calculated; and in the process of calculating a first difference value between the first gray mean value and the target gray mean value and calculating a second difference value between the first-order gray derivative mean value and the target first-order gray derivative mean value, calculating a first difference value between the first gray mean value and the target gray mean value of the part to be detected corresponding to the sub-region to be detected, and calculating a second difference value between the first-order gray derivative mean value and the target first-order gray derivative mean value of the part to be detected corresponding to the sub-region to be detected, so as to accurately determine the detection result under the condition of reducing the region difference value between the region to be detected and the sub-region to be detected.
In practical application, in the process of comparing the first difference and the second difference with the preset threshold and determining the detection result according to the comparison result, the following steps may be performed:
judging whether the first difference value is greater than a first threshold value and whether the second difference value is greater than a second threshold value, and if the first difference value is greater than the first threshold value and the second difference value is greater than the second threshold value, determining that the to-be-detected magnet piece has a whitish detection result;
and/or
And judging whether the first difference value is smaller than a third threshold value and the second difference value is smaller than a fourth threshold value, and if the first difference value is smaller than the third threshold value and the second difference value is smaller than the fourth threshold value, determining that the magnet piece to be detected has a bright detection result.
It should be noted that, because the first difference and the second difference are differences of corresponding parameters, in practical applications, the corresponding thresholds may be set to be the same, that is, the values of the first threshold and the second threshold may be the same, and the values of the third threshold and the fourth threshold may be the same.
In the magnet sheet detection method provided by the embodiment of the application, in the process of obtaining the preset template of the area to be detected, the preset template of the area to be detected can be obtained, the template of the area to be detected comprises templates formed by runways on two sides and a middle rectangle, and a schematic diagram of the template can be shown in fig. 10. The part to be detected may be five parts, wherein two parts are provided on each of the two side runways, and the middle rectangle is one part, as indicated by the reference numerals 1 to 5 in fig. 10.
Referring to fig. 11, fig. 11 is a schematic structural diagram of a magnet piece detecting system according to an embodiment of the present application.
The magnet piece detecting system that this application embodiment provided can include:
the first acquisition module 101 is used for acquiring a target image of the magnet piece to be detected;
the second obtaining module 102 is configured to obtain a preset template of the area to be detected;
the first determining module 103 is configured to determine, based on an indirect adjustment method, a to-be-detected region corresponding to a to-be-detected region template in the target image;
the first calculation module 104 is configured to calculate gray value information of the to-be-detected region;
and the second determining module 105 is configured to determine a detection result of the magnet piece to be detected based on the gray value information and a preset threshold.
In an embodiment of the present application, a magnet piece detecting system, a first determining module may include:
the first determining submodule is used for determining positioning point information of the target image;
the second determining submodule is used for determining a two-dimensional steel body transformation matrix between the template of the area to be detected and the positioning point information through an operational formula based on an indirect adjustment method;
the third determining submodule is used for mapping the template of the area to be detected to the target image based on the two-dimensional steel body transformation matrix to obtain the area to be detected;
the operational formula comprises:
Figure GDA0003688018910000101
Figure GDA0003688018910000102
wherein R isbRepresenting a two-dimensional steel body transformation matrix;
Figure GDA0003688018910000103
expressing local variation of adjustment parameters, wherein six adjustment parameters express corresponding parameter values in a two-dimensional steel body transformation matrix; r is1、r2、r3、r4Representing multiple rotation terms; t is trx、tryRepresenting a translation term; b represents a mapping matrix constructed based on the template of the area to be detected and the locating point information; p represents an identity matrix; b isTRepresents the transpose of B; and l represents the difference between the observed value and the corresponding approximate value in the indirect adjustment method.
In an embodiment of the present application, a first determining submodule of a magnet piece detecting system may include:
the first conversion submodule is used for converting the target image into a gray map;
the first operation submodule is used for carrying out binarization operation on the gray level image to obtain a target binarization image;
and the fourth determining submodule is used for respectively performing integral projection in the horizontal direction and the vertical direction on the target binary image and determining the positioning point information according to the projection result.
In an embodiment of the present application, the first operation sub-module may include:
the first binarization unit is used for carrying out binarization operation on the gray scale image to obtain an initial binarization image;
the first operation unit is used for performing morphological operation on the initial binary image to obtain a processed image;
a first extraction unit, configured to extract a longest straight line in a processed image based on hough transform;
the first correction unit is used for correcting the gray-scale image based on the longest straight line to obtain a corrected gray-scale image;
and the second binarization unit is used for carrying out binarization operation on the positive rotation gray level map to obtain a target binarization map.
In an embodiment of the present application, a magnet piece detecting system, a first calculating module may include:
the first calculation submodule is used for calculating a target gray level mean value and a target first-order gray level derivative mean value of the area to be detected;
the second determining module may include:
the first selection submodule is used for selecting a sub-region to be detected in the region to be detected;
the second calculation submodule is used for calculating a first gray average value and a first one-step gray derivative average value of the sub-region to be detected;
the third calculation submodule is used for calculating a first difference value of the first gray level mean value and the target gray level mean value;
the fourth calculation submodule is used for calculating a second difference value between the first-order gray derivative average value and the target first-order gray derivative average value;
and the fifth determining submodule is used for comparing the first difference value and the second difference value with a preset threshold value and determining a detection result according to a comparison result.
In an embodiment of the present application, the fifth determining sub-module may include:
the first judging unit is used for judging whether the first difference value is larger than a first threshold value and whether the second difference value is larger than a second threshold value, and if the first difference value is larger than the first threshold value and the second difference value is larger than the second threshold value, determining that the detection result that the magnet piece to be detected is whitish exists;
and/or
And the second judgment unit is used for judging whether the first difference value is smaller than a third threshold value and whether the second difference value is smaller than a fourth threshold value, and if the first difference value is smaller than the third threshold value and the second difference value is smaller than the fourth threshold value, determining that the magnet piece to be detected has a bright detection result.
The embodiment of the application provides a magnet piece detecting system, the second acquires the module and can include:
the first acquisition unit is used for acquiring a preset area template to be detected, and the area template to be detected comprises templates consisting of runways on two sides and a middle rectangle.
The application also provides a magnet piece detection device and a computer readable storage medium, which have corresponding effects of the magnet piece detection method provided by the embodiment of the application. Referring to fig. 12, fig. 12 is a schematic structural view of a magnet piece detecting apparatus according to an embodiment of the present application.
The magnet piece detection device provided by the embodiment of the application comprises a memory 201 and a processor 202, wherein a computer program is stored in the memory 201, and the processor 202 executes the computer program to realize the steps of the magnet piece detection method described in any one of the embodiments.
Referring to fig. 13, another magnet piece inspection apparatus provided in an embodiment of the present application may further include: an input port 203 connected to the processor 202, for transmitting externally input commands to the processor 202; a display unit 204 connected to the processor 202, for displaying the processing result of the processor 202 to the outside; and a communication module 205 connected to the processor 202 for communicating the magnet piece detecting apparatus with the outside. The display unit 204 may be a display panel, a laser scanning display, or the like; the communication method adopted by the communication module 205 includes, but is not limited to, mobile high definition link technology (HML), Universal Serial Bus (USB), High Definition Multimedia Interface (HDMI), and wireless connection: wireless fidelity technology (WiFi), bluetooth communication technology, bluetooth low energy communication technology, ieee802.11s based communication technology.
A computer-readable storage medium is provided in an embodiment of the present application, in which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the following steps:
the computer-readable storage media to which the present application relates include Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage media known in the art.
For a description of relevant portions of the magnet piece detection system, the magnet piece detection apparatus, and the computer-readable storage medium provided in the embodiments of the present application, reference is made to the detailed description of corresponding portions of the magnet piece detection method provided in the embodiments of the present application, and details are not repeated herein. In addition, parts of the above technical solutions provided in the embodiments of the present application, which are consistent with the implementation principles of corresponding technical solutions in the prior art, are not described in detail so as to avoid redundant description.
It is further noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (8)

1. A magnet piece inspection method, comprising:
acquiring a target image of the magnet piece to be detected;
acquiring a preset template of a region to be detected;
determining a region to be detected corresponding to the region template to be detected in the target image based on an indirect adjustment method;
calculating gray value information of the to-be-detected region;
determining a detection result of the magnet piece to be detected based on the gray value information and a preset threshold value;
the determining, based on the indirect adjustment method, a region to be detected corresponding to the region template to be detected in the target image includes:
determining positioning point information of the target image;
determining a two-dimensional rigid body transformation matrix between the template of the area to be detected and the locating point information based on the indirect adjustment method through an operational formula;
mapping the area template to be detected to the target image based on the two-dimensional rigid body transformation matrix to obtain the area to be detected;
the operation formula comprises:
Figure FDA0003688018900000011
Figure FDA0003688018900000012
wherein R isbRepresenting the two-dimensional rigid body transformation matrix;
Figure FDA0003688018900000013
expressing local variation of adjustment parameters, wherein six adjustment parameters express corresponding parameter values in the two-dimensional rigid body transformation matrix; r is a radical of hydrogen1、r2、r3、r4Representing multiple rotation terms; t is trx、tryRepresenting a translation term; b represents a mapping matrix constructed based on the template of the area to be detected and the locating point information; p represents an identity matrix; bTRepresents the transpose of B; l represents the difference between the observed value and the corresponding approximate value in the indirect adjustment method;
the calculating the gray value information of the to-be-detected region comprises:
calculating a target gray mean value and a target first-order gray derivative mean value of the area to be detected;
the determining the detection result of the magnet sheet to be detected based on the gray value information and the preset threshold value comprises the following steps:
selecting a to-be-detected sub-region in the to-be-detected region;
calculating a first gray mean value and a first one-step gray derivative mean value of the subarea to be detected;
calculating a first difference value of the first gray level mean value and the target gray level mean value;
calculating a second difference value between the first-order gray derivative mean value and the target first-order gray derivative mean value;
and comparing the first difference value and the second difference value with the preset threshold value, and determining the detection result according to the comparison result.
2. The method of claim 1, wherein the determining the anchor point information of the target image comprises:
converting the target image into a grey-scale map;
carrying out binarization operation on the gray level image to obtain a target binarization image;
and respectively carrying out integral projection in the horizontal direction and the vertical direction on the target binary image, and determining the positioning point information according to the projection result.
3. The method according to claim 2, wherein the binarizing operation on the gray-scale map to obtain a target binarized map comprises:
carrying out binarization operation on the gray level image to obtain an initial binarization image;
performing morphological operation on the initial binary image to obtain a processed image;
extracting the longest straight line in the processed image based on Hough transform;
correcting the gray level image based on the longest straight line to obtain a corrected gray level image;
and carrying out binarization operation on the positive-conversion gray-scale image to obtain the target binarization image.
4. The method according to claim 1, wherein the comparing the first difference and the second difference with the preset threshold and determining the detection result according to the comparison result comprises:
judging whether a first difference value is larger than a first threshold value and whether a second difference value is larger than a second threshold value, and if the first difference value is larger than the first threshold value and the second difference value is larger than the second threshold value, determining that the detection result that the magnet piece to be detected is whitish exists;
and/or
And judging whether the first difference value is smaller than a third threshold value and whether the second difference value is smaller than a fourth threshold value, and if the first difference value is smaller than the third threshold value and the second difference value is smaller than the fourth threshold value, determining that the magnet piece to be detected has a bright detection result.
5. The method according to claim 1, wherein the acquiring a preset template of the area to be detected comprises:
and acquiring a preset template of the area to be detected, wherein the template of the area to be detected comprises templates consisting of runways on two sides and a middle rectangle.
6. A magnet sheet inspection system, comprising:
the first acquisition module is used for acquiring a target image of the magnet piece to be detected;
the second acquisition module is used for acquiring a preset area template to be detected;
the first determining module is used for determining a to-be-detected region corresponding to the to-be-detected region template in the target image based on an indirect adjustment method;
the first calculation module is used for calculating gray value information of the to-be-detected region;
the second determining module is used for determining the detection result of the magnet piece to be detected based on the gray value information and a preset threshold value;
the determining, based on the indirect adjustment method, the to-be-detected region corresponding to the to-be-detected region template in the target image includes:
determining locating point information of the target image;
determining a two-dimensional rigid body transformation matrix between the template of the area to be detected and the locating point information based on the indirect adjustment method through an operational formula;
mapping the area template to be detected to the target image based on the two-dimensional rigid body transformation matrix to obtain the area to be detected;
the operation formula comprises:
Figure FDA0003688018900000031
Figure FDA0003688018900000032
wherein R isbRepresenting the two-dimensional rigid body transformation matrix;
Figure FDA0003688018900000033
expressing local variation of adjustment parameters, wherein six adjustment parameters express corresponding parameter values in the two-dimensional rigid body transformation matrix; r is a radical of hydrogen1、r2、r3、r4Representing multiple rotation terms; t is trx、tryRepresenting a translation term; b represents a mapping matrix constructed based on the template of the area to be detected and the positioning point information; p represents an identity matrix; bTRepresents a transpose of B; l represents the difference value between the observed value and the corresponding approximate value in the indirect adjustment method;
the calculating the gray value information of the to-be-detected region comprises:
calculating a target gray level mean value and a target first-order gray level derivative mean value of the area to be detected;
the determining the detection result of the magnet piece to be detected based on the gray value information and the preset threshold value comprises the following steps:
selecting a to-be-detected sub-region in the to-be-detected region;
calculating a first gray average value and a first one-step gray derivative average value of the sub-region to be detected;
calculating a first difference value of the first gray level mean value and the target gray level mean value;
calculating a second difference value between the first primary gray derivative mean value and the target first-order gray derivative mean value;
and comparing the first difference value and the second difference value with the preset threshold value, and determining the detection result according to the comparison result.
7. A magnet piece detection apparatus, comprising:
a memory for storing a computer program;
a processor for realizing the steps of the magnet piece detecting method as recited in any one of claims 1 to 5 when the computer program is executed.
8. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and the computer program when executed by a processor realizes the steps of the magnet piece detecting method as recited in any one of claims 1 to 5.
CN202110660043.2A 2021-06-15 2021-06-15 Magnet piece detection method, system, equipment and computer readable storage medium Active CN113298803B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110660043.2A CN113298803B (en) 2021-06-15 2021-06-15 Magnet piece detection method, system, equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110660043.2A CN113298803B (en) 2021-06-15 2021-06-15 Magnet piece detection method, system, equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN113298803A CN113298803A (en) 2021-08-24
CN113298803B true CN113298803B (en) 2022-07-22

Family

ID=77328417

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110660043.2A Active CN113298803B (en) 2021-06-15 2021-06-15 Magnet piece detection method, system, equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN113298803B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116012330B (en) * 2022-12-28 2023-10-20 广州市易鸿智能装备有限公司 Pole piece defect detection method, device, equipment and computer storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108230321A (en) * 2018-01-19 2018-06-29 深圳市亿图视觉自动化技术有限公司 Defect inspection method and device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104091325A (en) * 2014-06-16 2014-10-08 哈尔滨工业大学 Image ROI positioning method and device based on dimension invariant feature transformation during automobile instrument panel visual detection
CN107515481B (en) * 2017-08-29 2020-09-11 惠科股份有限公司 Display panel detection method and device
CN108346138B (en) * 2017-12-04 2021-04-09 广东嘉铭智能科技有限公司 Surface defect detection method and system based on image processing
CN110400290B (en) * 2019-07-02 2021-08-24 广州大学 Method and device for detecting chromatic aberration of solar cell and storage medium
CN111879777A (en) * 2020-06-19 2020-11-03 巨轮(广州)智能装备有限公司 Soft material fitting defect detection method, device, equipment and storage medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108230321A (en) * 2018-01-19 2018-06-29 深圳市亿图视觉自动化技术有限公司 Defect inspection method and device

Also Published As

Publication number Publication date
CN113298803A (en) 2021-08-24

Similar Documents

Publication Publication Date Title
CN110046529B (en) Two-dimensional code identification method, device and equipment
US8331670B2 (en) Method of detection document alteration by comparing characters using shape features of characters
TW201740316A (en) Image text identification method and apparatus
CN115908269B (en) Visual defect detection method, visual defect detection device, storage medium and computer equipment
US10699110B2 (en) Image processing apparatus, image processing method, and non-transitory recording medium storing program for causing computer to execute image processing method
CN109919002B (en) Yellow stop line identification method and device, computer equipment and storage medium
US20220172337A1 (en) Character defect detection method and device
CN112183038A (en) Form identification and typing method, computer equipment and computer readable storage medium
CN113298803B (en) Magnet piece detection method, system, equipment and computer readable storage medium
CN115760820A (en) Plastic part defect image identification method and application
CN111461100A (en) Bill identification method and device, electronic equipment and storage medium
CN112419207A (en) Image correction method, device and system
CN107993223A (en) Scratch detection method, apparatus and electronic equipment
JP2017500662A (en) Method and system for correcting projection distortion
CN117173090A (en) Welding defect type identification method and device, storage medium and electronic equipment
JP2019100937A (en) Defect inspection device and defect inspection method
CN103778629A (en) Background model real-time updating method for non-coherent radar image
CN111476800A (en) Character region detection method and device based on morphological operation
CN108629805B (en) Salient object detection method and system based on image layering technology
CN113255657B (en) Method and device for detecting scratch on bill surface, electronic equipment and machine-readable medium
CN106934814B (en) Background information identification method and device based on image
CN117557565B (en) Detection method and device for lithium battery pole piece
CN117351011B (en) Screen defect detection method, apparatus, and readable storage medium
CN115880318B (en) Laser ranging method, medium, equipment and device
CN112950623A (en) Mark identification method and system

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
TR01 Transfer of patent right

Effective date of registration: 20230105

Address after: No. 500 Songling Road, Laoshan District, Qingdao City, Shandong Province, 266100

Patentee after: GOERTEK TECHNOLOGY Co.,Ltd.

Patentee after: QINGDAO RESEARCH INSTITUTE OF BEIHANG University

Patentee after: Qingdao technology branch of Weihai Jianhong Construction Engineering Co.,Ltd.

Address before: 261031 workshop 1, phase III, Geer Photoelectric Industrial Park, 3999 Huixian Road, Yongchun community, Qingchi street, Weifang High tech Zone, Weifang City, Shandong Province

Patentee before: GoerTek Optical Technology Co.,Ltd.

Patentee before: QINGDAO RESEARCH INSTITUTE OF BEIHANG University

Patentee before: Qingdao technology branch of Weihai Jianhong Construction Engineering Co.,Ltd.

TR01 Transfer of patent right