WO2021000702A1 - 图像检测方法、设备以及*** - Google Patents

图像检测方法、设备以及*** Download PDF

Info

Publication number
WO2021000702A1
WO2021000702A1 PCT/CN2020/094997 CN2020094997W WO2021000702A1 WO 2021000702 A1 WO2021000702 A1 WO 2021000702A1 CN 2020094997 W CN2020094997 W CN 2020094997W WO 2021000702 A1 WO2021000702 A1 WO 2021000702A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
area
target object
detected
seal
Prior art date
Application number
PCT/CN2020/094997
Other languages
English (en)
French (fr)
Inventor
李骏驰
于磊
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021000702A1 publication Critical patent/WO2021000702A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/22Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/25Determination of region of interest [ROI] or a volume of interest [VOI]

Definitions

  • This application relates to the field of information technology, and in particular to an image detection method, device and system.
  • Seals also called seals
  • red pixels for example, the seal color is red
  • blue pixels for example, the seal color is blue
  • the seal image generated by the above method contains many invalid parts that are not part of the seal, resulting in poor accuracy of the seal image.
  • the seal is compared later, it is easy to produce wrong results and cannot accurately verify the authenticity of the document. legality.
  • This application provides an image detection method, device, and system to realize efficient image detection.
  • the present application provides an image detection method, which can be executed by an image detection device.
  • the method includes that the image detection device can first locate the area where the target object in the image to be detected is located; The image of the area where the target object is located; the image detection device can also obtain the background image of the target object from the area where the target object is located in the image to be detected.
  • the background image of the target object is the image of the target object removed from the area where the target object is located; for example, the target object
  • the background can be text, graphics, and images covered by the target object, or text, graphics, and images covered by the target object.
  • the image detection device can distinguish the target object in the area where the target object is located and the background of the target object through the background image of the target object, remove the background of the target object from the image of the area where the target object is located, and generate an image of the target object; For the image of the target object and the reference image, determine the degree of similarity between the image of the target object and the reference image.
  • the image detection device can distinguish between the target object in the area where the target object is located and the background of the target object through the background image of the target object, which can make the image of the target object contain less background or even no background, which can be more accurate
  • this method is not only suitable for the detection of color images, but also for the detection of black and white images, which can expand the scope of application of the image detection method.
  • the image detection device can locate the area of the target object in the image to be detected in two different ways.
  • the image detection device can detect the image in the image to be detected through the target detection algorithm.
  • the target object is located in the first area in the image to be inspected, and the first area includes the target object;
  • the image detection device can also detect the preset pattern in the image to be inspected in the image to be inspected, and the area where the preset pattern is located in the image to be inspected Is the second area, and the preset graphic is the boundary shape of the target object; after that, the image detection device combines the first area and the second area to obtain the area where the target object is located.
  • the image detection device locates the area of the target object in the image to be detected, it can perform positioning in two different ways, and integrate the area of the target object determined by the two methods to ensure that the area of the target object can be accurately located.
  • the image detection device can respectively determine the boundary and center of the area where the target object is located by integrating the first area and the second area to obtain the area where the target object is located: for example, the image detection device may determine the boundary and center of the area where the target object is located. Curve fitting is performed on the boundary of the second area and the boundary of the second area to determine the boundary of the area where the target object is located; and the center coordinates of the area where the target object is located are determined according to the center coordinates of the first area and the center coordinates of the second area.
  • the boundary coordinates and center coordinates of the area where the target object is located are determined by integrating the areas located in different ways, so that the final location of the target object area is more accurate.
  • the image detection device when the image detection device performs curve fitting on the boundary of the first area and the boundary of the second area to determine the boundary of the area where the target object is located, it can compare the value of the first area according to a preset ratio value. Curve fitting is performed on the boundary and the boundary of the second area. Each area in the first area and the second area corresponds to a scale value; the image detection device determines the area where the target object is located according to the center coordinates of the first area and the center coordinates of the second area When the center coordinates of the target object are located, the center coordinates of the area where the target object is located can be determined according to the sum of the center coordinates of each area and the product of the corresponding weight.
  • the corresponding scale value and weight are configured.
  • the configuration can be higher.
  • the scale value and weight of make the boundary coordinates and center coordinates of the area where the final positioning target object is located more accurate.
  • the image detection device can locate the area of the target object in the image to be detected in three different ways; for example, the image detection device The target object in the image to be detected can be detected by the target detection algorithm, and the first area in the image to be detected can be located, the first area includes the target object; the image detection device can also detect the preset pattern in the image to be detected in the image to be detected , The area where the preset graphic is located in the image to be detected is the second area, and the preset graphic is the boundary shape of the target object; the image detection device can also determine the third area from the image to be detected according to the color of the target object.
  • the color is the color of the target object; after that, the first area, the second area, and the third area are combined to obtain the area where the target object is located.
  • the image detection device locates the area where the target object in the image to be detected is located, it can integrate the areas determined in these three ways to achieve precise positioning of the area where the target object is.
  • the image detection device can determine the boundary and center of the area where the target object is located when the first area, the second area, and the third area are integrated to obtain the area where the target object is located; exemplary, the image detection device The boundary of the first area, the boundary of the second area, and the boundary of the third area can be curve-fitted to determine the boundary of the area where the target object is located; and according to the center coordinates of the first area, the center coordinates of the second area, and the third area The center coordinates of the area determine the center coordinates of the area where the target object is located.
  • the boundary coordinates and center coordinates of the area where the target object is located are determined by integrating the areas located in different ways to ensure that the area of the target object can be accurately located.
  • the image detection device can perform curve fitting on the boundary of the first area, the boundary of the second area, and the boundary of the third area to determine the boundary of the area where the target object is located, according to a preset ratio
  • the value performs curve fitting on the boundary of the first region, the boundary of the second region, and the boundary of the third region.
  • Each of the first region, the second region, and the third region corresponds to a scale value; the image detection device
  • the center coordinates of the area, the center coordinates of the second area, and the center coordinates of the third area determine the center coordinates of the area where the target object is located
  • the center of the area where the target object is located can be determined according to the sum of the center coordinates of each area and the product of the corresponding weights coordinate.
  • the corresponding scale value and weight are configured.
  • the configuration can be higher.
  • the scale value and weight of ensure that the boundary coordinates and center coordinates of the area where the final target object is located are more accurate.
  • the image detection device may also perform a culling operation to remove part of the area; for example, the image detection device It is possible to exclude the areas that meet the preset conditions in the first area, the second area, and the third area.
  • the preset conditions are that the area of the area is less than the standard value, the area is contained in one or more other areas; and/or the area of the area is less than the standard value, The area is included in one or more other areas.
  • the areas that obviously do not contain the target object in the first area, the second area, and the third area can be removed to ensure the accuracy of the area where the target object is finally located.
  • the image detection device may also perform a culling operation to remove part of the area before integrating the first area and the second area to obtain the area where the target object is located.
  • the image detection device can exclude the first area and the area that meets the preset condition in the second area.
  • the preset condition is that the area of the area is smaller than the standard value, and the area is contained in one or more other areas; and/or the area of the area is smaller than the standard. Value, area is included in one or more other areas.
  • the first area and the area that obviously does not contain the target object in the second area are removed, and the area where the target object can be accurately located is ensured.
  • the image detection device obtains the area where the target object is located by integrating the first area, the second area, and the third area. It can be grouped, and then the first area, the second area, and the second area belonging to the same group are synthesized. Three areas to obtain the area where the target object is located; among them, when grouping, the overlap ratio between two adjacent areas in the first area, the second area and the third area can be calculated, and the image to be detected is within a preset range , The regions with overlap ratio greater than the first threshold are divided into a group. In this way, the overlap rate of any two of the first area, the second area, and the third area in the same group is greater than the first threshold.
  • the grouping method can be used to locate each target object, determine the area where each target object is located, and ensure accurate positioning of the target object.
  • the image detection device when the image detection device synthesizes the first area and the second area to obtain the area where the target object is located, it can group, and then synthesize the first area and the second area belonging to the same group to obtain the target object
  • the area where the grouping is performed, the overlap ratio between the first area and the two adjacent areas in the second area can be calculated, and the area with the overlap ratio greater than the first threshold in the preset range of the image to be detected Divide in a group. In this way, the overlap ratio of any two areas in the first area and the second area in the same group is greater than the first threshold.
  • the grouping method can be used to locate each target object, determine the area where each target object is located, and ensure accurate positioning of the target object.
  • the image detection device when the image detection device intercepts the image of the area where the target object is located from the image to be detected, it can be implemented in the following two ways:
  • the image detection device may use an image segmentation algorithm to segment the first image from the area where the target object is located in the image to be detected, and the first image includes the target object.
  • the image detection device may extract pixels of the first color from the area where the target object is located, and obtain the second image according to the pixels of the first color, where the first color is the color of the target object.
  • the image detection device can flexibly intercept the image of the area where the target object is located in different ways.
  • the image detection device uses the image segmentation algorithm to segment the first image from the area where the target object is located in the image to be detected, it may intercept the first rectangular area including the area where the target object is located from the image to be detected, The center of the first rectangular area coincides with the center of the area where the target object is located, the first rectangular area is used as the input value of the image segmentation algorithm, and the first image is determined according to the output value of the image segmentation algorithm.
  • the center of the first rectangular area coincides with the center of the area where the target object is located, which can ensure that the center of the area where the target object is located is at the center of the segmented first image. In this way, it can be ensured that the segmented first image can be better. Of covering the entire target object.
  • the image detection device extracts the pixels of the first color from the area where the target object is located, and when acquiring the second image based on the pixels of the first color, it can intercept the area where the target object is located from the image to be detected
  • the center of the second rectangular area coincides with the center of the area where the target object is located; then, the second rectangular area is mapped in the color space, and the target object in the second rectangular area is removed according to the boundary of the area where the target object is located Pixels outside the area, extract the pixels of the first color in the area where the target object is located, and obtain the second image.
  • the image detection algorithm can use the boundary of the area where the target object is located to remove the non-target object part in the second rectangular area, which can ensure that the segmented first image can better cover the entire target object, and includes less background.
  • the image detection device when it obtains the background image of the target object based on the image of the area where the target object is located, it can intercept the third image from the image to be detected according to the first image and the second image, and the third The image covers the area of the first image and the second image in the image to be detected; after that, the image detection device can grayscale the third image to obtain a grayscale image of the third image; and can also be based on the grayscale of the third image The gray distribution of the image, distinguish the target object and the background of the target object in the area where the target object is located, and extract the background image of the target object.
  • the area where the target object is located can be better distinguished between the target object and the background of the target object.
  • the gray value in the middle of the gray distribution interval can be regarded as the target object If the gray value is too high or too low, it can be considered as the background of the target object. In this way, a more accurate background image of the target object can be extracted.
  • the image detection device removes the background image of the target object from the image of the area where the target object is located based on the background image of the target object, and generates the image of the target object. It can compare the background image of the target object with the target object. The value of the pixel at the same position in the image of the area where the object is located, remove the pixel at the same position as the non-zero pixel in the back image of the target object from the image of the area where the target object is located, for non-zero pixels in the background image of the target object.
  • the dots can be considered as non-seal pixels, which can be directly removed from the image of the area where the target object is located, and the image with the background of the target object removed is the image of the target object.
  • the image detection device determines the image of the target object by comparing the image of the area where the target object is located and the pixels at the same position of the background image of the target object, so that the image of the target object includes less background of the target object and can obtain a comparison Pure target image.
  • the image detection device when it compares the image of the target object with the reference image, it can first rotate the image of the target object by matching the feature points of the image of the target object with the feature points of the reference image; After that, by comparing at least one of the main structure, image texture, pixel point, and angle of the reference image and the rotated target object image, the degree of similarity between the target object image and the reference image is determined.
  • the image detection device can compare the image of the target object with the reference image in a number of different aspects, and can achieve accurate comparison, thereby ensuring that the degree of similarity between the image of the target object and the reference image can be accurately determined.
  • the present application provides an image detection device that has the functions implemented in the first aspect and any one of the possible designs of the first aspect.
  • the device function can be realized by hardware, or by hardware executing corresponding software.
  • the hardware or software includes one or more modules corresponding to the above-mentioned functions.
  • the structure of the device includes a positioning unit, an interception unit, an acquisition unit, a generation unit, and a comparison unit. These units can perform the corresponding functions in the method examples of the first aspect above. For details, see the details in the method examples. Description, not repeat them here.
  • the present application also provides an image detection device.
  • the structure of the image detection device includes a processor and a memory, and the processor is configured to perform the corresponding function in the first aspect and any one of the possible design methods of the first aspect.
  • the memory is coupled with the processor, and it stores program instructions and data necessary for the image detection device.
  • the structure of the image detection device also includes a communication interface for communicating with other devices.
  • the present application also provides an image detection system, which includes any one of the possible designs of the image detection device as in the second aspect and the second aspect, and the image detection device can be used to execute the image detection device as in the first aspect.
  • the image detection system may further include a collection device and an access device.
  • the acquisition device is used to collect the image to be detected and send the image to be detected to the image detection device
  • the access device is used to send instructions to the image detection device
  • the instruction is used to instruct the image detection device to detect the image to be detected (for example, the Target audience).
  • the present application also provides an image detection system, which includes any one of the possible designs of the image detection device as in the second aspect and the second aspect, and the image detection device can be used to execute the image detection device as in the first aspect.
  • the image detection system may further include a data server storing a database for storing images; optionally, the image detection system may further include a collection device and an access device.
  • the collection device is used to collect the image to be detected, and send the image to be detected to the data server, and the data server saves the image to be detected in the database.
  • the access device can send an instruction to the image detection device.
  • the instruction is used to instruct the image detection device to detect the image to be detected (such as instructing to detect the target object in the image to be detected), and the instruction can include relevant information of the image to be detected (such as Identification, number, etc.); after the image detection device receives the instruction, it can connect to the data server to obtain the image to be detected from the database according to the relevant information of the image to be detected.
  • relevant information of the image to be detected such as Identification, number, etc.
  • the image detection device and the acquisition device can also form another image detection system.
  • the image detection device can acquire the image to be detected from the acquisition device and execute any possible design such as the first aspect and the first aspect.
  • the method; the image detection device and the access device can also constitute another image detection system, the access device is used to send an instruction to the image detection device, the instruction is used to instruct the image detection device to detect the image to be detected, the instruction may include the image to be detected Image (optionally, the access device can also send the image to be detected to the image detection device separately), the image detection device can obtain the image to be detected from the instruction and execute any possible design such as the first aspect and the first aspect Methods.
  • the present application also provides a computer-readable storage medium that stores instructions in the computer-readable storage medium, which when run on a computer, causes the computer to execute the methods of the above aspects.
  • the present application also provides a computer program product containing instructions, which when run on a computer, causes the computer to execute the methods of the above aspects.
  • the present application also provides a computer chip, which is connected to a memory, and the chip is used to read and execute a software program stored in the memory, and execute the methods of the foregoing aspects.
  • FIG. 1 is a schematic diagram of the architecture of an image detection system provided by this application.
  • FIG. 2 is a schematic diagram of an image detection method provided by this application.
  • FIG. 3 is a schematic diagram of a seal in an image to be detected provided by this application.
  • FIG. 4 is a schematic diagram of a seal in another image to be detected provided by this application.
  • FIG. 5 is a schematic diagram of an image of an area where a seal is located in an image to be detected provided by this application;
  • FIG. 6 is a schematic diagram of an image of an area where a seal is located in another image to be detected provided by this application;
  • FIG. 7 is a schematic diagram of the angle of the seal image provided by this application.
  • FIG. 8 is a schematic diagram of a first-level pixel block in an absolute pixel image provided by this application.
  • FIG. 9 is a schematic diagram of a secondary pixel block in an absolute pixel image provided by this application.
  • FIG. 10 is a schematic diagram of three-level pixel blocks in an absolute pixel image provided by this application.
  • FIG. 11-12 are schematic diagrams of the structure of the image detection device provided by this application.
  • the present application provides an image detection method, device, and system to efficiently detect the image to be detected.
  • FIG. 1 a schematic diagram of the architecture of an image detection system provided by an embodiment of this application.
  • the system architecture includes an image detection device 100 and a collection device 200.
  • it may also include one or more access devices 300.
  • the collection device 200 is used to collect images to be inspected.
  • the embodiment of the present application does not limit the device type of the collection device. It can be a copy with a scanning function, a scanner, a camera, a smart phone, a tablet computer, etc., which can have an image collection function.
  • the devices are all applicable to the embodiments of this application.
  • the image to be detected collected by the collecting device 200 may be a color image or a black and white image, which is not limited in the embodiment of the present application.
  • the image detection device 100 is used to execute the image detection method provided in the embodiments of the present application, locate the area where a target object (such as a seal) in the image to be detected is located (referred to as target object positioning for short); and extract the target object from the area where the target object is located Image (referred to as target object extraction for short), which includes obtaining the image of the area where the target object is located, extracting the background image of the target object, removing the background image of the target object from the image of the area where the target object is located, and obtaining the image of the target object; The image is compared with the reference image, and the comparison result is output (referred to as the target object comparison).
  • the image detection device 100 can be a single server, and a single server can have the functions of target object positioning, target object extraction, and target object comparison.
  • the image detection device 100 can also be a server cluster composed of multiple servers, and each server specifically includes For one or more functions of target object positioning, target object extraction, and target object comparison, multiple servers cooperate to execute the image detection method provided in the embodiments of the present application.
  • the image detection device 100 includes a positioning device 110, an extracting device 120, and a comparing device 130.
  • the positioning device 110 is used to implement a target object positioning function, and can also input location information of a region where the target object is located to the extracting device 120;
  • the extraction device 120 is used to implement the function of extracting the target object.
  • the image of the target object can be input to the comparison device 130.
  • the comparison device 130 can realize the function of comparing the target object, determine whether the image of the target object is consistent with the reference image, and output the The similarity between the image of the target object and the reference image (the similarity is used to characterize the degree of similarity between the image of the target object and the reference image).
  • One or more of the positioning device 110, the extraction device 120, and the comparison device 130 may be deployed in a server.
  • the embodiments of the present application do not limit the type of server.
  • it can be a super multi-core server, a large distributed computer, a cluster computer with hardware resource pooling, etc., which can achieve target object positioning, target object extraction or target object
  • the comparison equipment pairs are all applicable to the embodiments of this application.
  • the access device 300 can be connected to the image detection device 100 and can send instructions to the image detection device 100.
  • the instruction can be used to instruct the image detection device 100 to determine the image to be detected (the image to be detected may be stored locally by the image detection device 100).
  • the access device 300 may also have a display function, which can present the response information of the image detection device 100 to the instruction to the user.
  • the access device 300 has a display function, which is also convenient for the user to operate the access device 300 and trigger the access device 300 to send instructions and many more.
  • the access device 300 may be deployed on land, including indoor or outdoor, handheld or vehicle-mounted; it may also be deployed on the water (such as a ship, etc.); and it may also be deployed in the air (such as aeroplane, balloon, satellite, etc.).
  • the access device 300 may be a mobile phone (mobile phone), a tablet computer (pad), a notebook computer, a virtual reality (VR) terminal, an augmented reality (AR) terminal, and wireless in industrial control (industrial control). Terminals, wireless terminals in unmanned driving (self-driving), terminals in remote medical (remote medical), etc.
  • the collection device 200 can transmit the collected images to the image detection device 100.
  • the access device 300 can access the image detection device 100 to view the images collected by the collection device 200, and send instructions to the image detection device 100 for the images collected by the collection device 200.
  • the image collected by the collection device 200 can be stored in a database.
  • the database can be stored in a data server or in an image detection device.
  • the access device 300 sends an instruction for detecting the target object in the image to be detected to the image detection device 100, and the instruction can carry information such as the identification of the image to be detected; the image detection device 100 can connect to the data server, according to the instructions to be detected The image identification and other information obtain the image to be detected from the database.
  • the access device 300 can also access the images in the database through the image detection device 100 and send instructions to the image detection device 100 for the images in the database.
  • the collection device 200 can also be connected to the access device 300 and send the collected images to the access device 300.
  • the access device 300 can view the images collected by the collection device 200 and can also send to the image detection device 100
  • the image detection device 100 may first locate the area of the target object in the image to be detected; after that, the image detection device performs the image extraction operation of the target object, and first intercepts the area of the target object.
  • Image according to the image of the area where the target object is located, the background image of the target object is obtained.
  • the background of the target object is the image of the target object removed from the area where the target object is located.
  • the image detection device can be based on the background image of the target object from the area where the target object is located.
  • the image detection device can distinguish the target object in the area where the target object is located and the background of the target object through the background image of the target object, and can accurately determine the image of the target object. It is not only suitable for color images, but also Black and white images can expand the scope of application of image detection methods.
  • the embodiments of this application are not only applicable to seal positioning and seal comparison, but also applicable to other scenarios, such as the positioning and comparison of specific images.
  • the following is based on the system architecture shown in Figure 1, with the target object as The seal is taken as an example to illustrate an image detection method provided in an embodiment of the present application. As shown in FIG. 2, the method includes:
  • Step 201 The image detection device 100 locates the area where the seal in the image to be detected is located.
  • the image inspection device 100 can locate the area where the seal is located from the image to be inspected.
  • the area where the seal is located includes the seal and other contents other than the seal, such as text, graphics, and images covered on the seal.
  • the words, graphics, or images hidden by the seal the words, graphics, and images covered on the seal in the embodiments of the present application, and the words, graphics, or images hidden by the seal may be referred to as the background of the seal.
  • the image detection device 100 In this step, there are many ways for the image detection device 100 to locate the area where the seal in the image to be detected is located, three of which are listed below, and the following descriptions are made separately.
  • the image detection device 100 can use the target detection algorithm to locate the area where the seal in the image to be detected is located.
  • the embodiment of the application does not limit the type of target detection algorithm.
  • the target detection algorithm may be a target detection algorithm based on Deep Learning (DL), including but not limited to Region Convolutional Neural Network (R-CNN) ), SSD (single shot multibox detector), YOLO (You Only Look Once net).
  • DL Deep Learning
  • R-CNN Region Convolutional Neural Network
  • SSD single shot multibox detector
  • YOLO You Only Look Once net.
  • the target detection algorithm can extract the overall and local features of the image to be detected, predict the location of the seal in the image to be detected based on the extracted overall and local features, and then locate the area where the seal is located.
  • the target detection algorithm based on deep learning can be trained in advance.
  • the training set used for training is a number of different images manually labeled with the area where the seal is located; the images in the training set are input into the target detection algorithm, and the training is carried out through supervised learning .
  • the area where the seal is located in the image to be detected located by the image detection device 100 can be characterized by the center coordinates of the area where the seal is located and the boundary coordinates of the area where the seal is located.
  • the center of the area where the seal is located may be the center point of the seal
  • the boundary of the area where the seal is located is the outer ring of the seal
  • the center coordinates and boundary coordinates of the area where the seal is located are based on the common coordinate system of the image (such as image
  • the vertex of the upper left corner of is the origin, and the two straight lines that intersect at the origin are the coordinate system established by the coordinate axis.)
  • the center point of the seal and the outer ring of the seal are marked.
  • the embodiment of the present application does not limit the number of seals.
  • method one can be used to determine the area where each seal is located.
  • the image detection device 100 detects a preset graphic in the image to be detected in the image to be detected, and uses the area where the preset graphic in the image to be detected is located as the area where the seal is located.
  • the boundary of the seal (also called the outer ring) is usually a regular pattern, for example, the outer ring of the seal can be circular, elliptical, rectangular, etc.
  • the image detection device 100 can determine whether there is a preset pattern in the image to be detected, such as whether there is a circle, an ellipse, or a rectangle in the image detection device 100. If there is a preset pattern in the image to be detected, the preset pattern can be The area where the graphic is located is the area where the seal is located.
  • the process of determining the preset graphics in the image to be detected may be called shape detection.
  • the image detection device 100 when it performs shape detection, it may first perform grayscale on the image to be detected to generate a grayscale image of the image to be detected, and then use Hough transform to detect presets in the grayscale image of the image to be detected Graphics.
  • the Hough transform can transform the curve of the image (including a straight line) into a point in the Hough parameter space through a curve expression, and detect the curve in the image by detecting the point in the Hough parameter space.
  • the image detection device 100 can directly perform grayscale on the image to be detected, generate a grayscale image of the image to be detected, and detect a preset pattern from the grayscale image of the image to be detected; it can also extract only the image to be detected
  • the image of the specific color (the image formed by the pixels of the specific color in the image to be detected is called the image of the specific color), and then the image of the specific color is grayscaled, and then the preset is detected from the grayscale image of the image of the specific color Graphics; for example, if the color of the seal is red, a red image can be extracted; if the color of the seal is blue, a blue image can be extracted.
  • the area where the seal in the image to be detected is located can be located.
  • the center coordinates and boundary coordinates of the area where the seal is located can be used to characterize the area where the seal is located.
  • the description of the center coordinates and boundary coordinates of the area where the seal is located can be found in the foregoing content, which will not be repeated here.
  • the embodiment of the present application does not limit the number of seals.
  • the second method can be used to determine the area where each seal is located.
  • the image detection device 100 can locate the area of the seal in the image to be detected by detecting the color area in the image to be detected.
  • the seal in the image to be detected is composed of one or more color areas of the same color, for example, a red seal is composed of multiple red areas.
  • the blue seal is composed of multiple blue areas.
  • the image detection device 100 can detect one or more color regions of the same color that are relatively close in the image to be detected; and use the detected color region as the region where the seal is located.
  • the process of detecting the color area in the image to be detected may be referred to as color patch detection.
  • the image detection device 100 performs color block detection, it can map the image to be detected in a color space, and then extract a color image, which only includes an image of a specific color; then, the color image is subjected to multiple scales of pixels Dilation, generate multiple pixel dilated images.
  • a pixel expansion image is generated; for any pixel expansion image, each connected area in the pixel expansion image is filled, and the colorless area in each connected area is filled; based on the filling
  • the area of the connected area is equal to or close to the overlap rate between the connected areas of the set threshold to determine the area where the seal is located.
  • the set threshold can be an empirical value.
  • the set threshold can be the standard area or average of the seal obtained by statistics Area etc.
  • Pixel expansion refers to the area of a specific scale based on the pixel in the image as the center (such as the area composed of 3*3 pixels with the pixel in the image as the center, and the area composed of 5*5 pixels with the pixel in the image as the center.
  • the maximum value of the pixel point in) (that is, the maximum value of the pixel value of the pixel point), the way to re-assign the pixel point in the image.
  • the scale of pixel expansion is related to the size of the image to be detected. For example, for a 256*256 image to be detected, the scale of pixel expansion that can be selected is one or more of 3 pixels, 9 pixels, and 15 pixels. .
  • the embodiments of the present application do not limit the type of color space.
  • the color space is hue saturation value (HSV) color space, red green blue (RGB) color space, and printing four-color (cyan magenta yellow black, CMYK) color space, hue saturation lightness (HSL) color space.
  • HSV hue saturation value
  • RGB red green blue
  • CMYK cyan magenta yellow black
  • HSL hue saturation lightness
  • the red image is the pixel value of the HSV image (such as the H value, S value and V value of the pixel). Value) an image composed of pixels in a specific interval, where the H value of the pixel is in the interval (0-10, 136-180), the S value of the pixel is in the interval (10-255), and the V value of the pixel is (46-255).
  • the range of the above interval is just an example. In different scenarios, the interval of the H, S, and V values can be adjusted.
  • the red image is subjected to pixel expansion of 3 pixels, 9 pixels, 15 pixels, etc., to generate corresponding pixel expansion images.
  • the pixel expansion image has a connected area composed of multiple pixels, and the blank area inside the connected area can be filled with red. And calculate the area of the connected area after filling. For the connected area whose area is equal to or close to the set threshold, the center point coordinates and boundary coordinates of the connected area can be calculated.
  • the set threshold can be determined according to the standard size of the seal, usually the area of the seal on A4 paper is about 10 square centimeters (cm 2 ); 10cm 2 can be used as the set threshold, for an area equal to 10cm 2 or an area with 10cm If the difference of 2 is less than 1 cm 2 for a connected area, locate the connected area, and determine the center point and boundary coordinates of the connected area.
  • the probability of seal included in the connected area can be determined by the overlap ratio between the connected areas. When the overlap rate of two different connected areas is higher, it indicates that the two connected areas have the same seal, and the probability of existence of the seal is higher.
  • the overlap ratio of two connected regions is equal to the ratio of the area of the common area of the two connected regions to the area of the entire region formed by the two connected regions.
  • the center coordinates of the area where the seal is located are calculated based on the center coordinates of the multiple connected areas.
  • different weights can be configured for pixel expansion images of different scales, and the configured weights can be empirical values, or they can be set according to the accuracy of the probability of the existence of the seal that the pixel expansion images of different scales can reflect, such as scale The larger the pixel expansion image can reflect the accuracy of the probability of seal existence.
  • Exemplary such as the pixel expansion image under 3 pixels (referred to as 3 pixel expansion image), the pixel expansion image under 9 pixels (referred to as 9 pixel expansion image), the pixel expansion image under 15 pixels (referred to as 15 pixel expansion image)
  • the weights are 3/(3+9+15, 9/(3+9+15), 15/(3+9+15).
  • the weight of a 3-pixel dilated image is weight 1
  • the center coordinate of the middle connected area of a 3-pixel dilated image is coordinate 1
  • the weight of a 9-pixel dilated image is weight 2
  • 9 The center coordinate of the middle connected area of the pixel expansion image is coordinate 2
  • the weight of the 15-pixel expanded image is weight 3
  • the center coordinate of the middle connected area of the 15-pixel expanded image is coordinate 3.
  • the center coordinate of the area where the seal is located weight 1. *Coordinate 1+weight 2*coordinate 2+weight 3*coordinate 3.
  • Reverse corrosion is the opposite process of pixel expansion. Reverse corrosion is based on the area of a specific scale centered on the pixel in the image (such as the area composed of 3*3 pixels centered on the pixel in the image, and the pixel in the image The minimum value of the pixel point (that is, the minimum value of the pixel value of the pixel point) in the area consisting of 5*5 pixels in the center, and the method of re-assigning the pixel points in the image.
  • method three can be used to determine the area where each seal is located.
  • the image to be detected is a color image
  • one or more of the above three methods can be used to locate the area where the seal is located; when the image to be detected is a black-and-white image, one of method 1 and method 2 or A variety of positioning seal areas.
  • each method can locate the area where the seal is located.
  • the area where the seal is located by the above three methods can be integrated, and the area where the seal is located according to the three methods The overlap ratio between the two can accurately locate the area where the seal is located.
  • the area where the seal located by way 1 is called the first area
  • the area where the seal located by way 2 is called the second area
  • the area where the seal located by way 3 is called the third area.
  • the image detection device 100 can determine the center coordinates and boundary coordinates of the area where the seal is located through the first area, the second area, and the third area.
  • the image detection device 100 may perform curve fitting on the boundary of the first area, the boundary of the second area, and the boundary of the third area to determine the boundary of the area where the seal is located (referred to as boundary 1 for convenience of explanation), and then determine The boundary coordinates of the area where the seal is located.
  • Curve fitting refers to the process of combining multiple different curves into one curve.
  • the image detection device 100 can compare the boundary of the first region and the second region by a preset ratio value. Curve fitting is performed on the boundary of the third region and the boundary of the third region; wherein, each region of the first region, the second region, and the third region corresponds to a scale value, and the image detection device 100 can perform curve fitting according to the boundary of each region and the corresponding scale The sum of the products of the values determines the boundary of the area where the seal is located.
  • the scale value of an area can indicate the proportion of the boundary of the area when determining the boundary of the area where the seal is located.
  • the embodiment of this application does not limit the setting method of the scale value, it is an empirical value, or it can be based on the above
  • the ratio values corresponding to the first area, the second area, and the third area are 20%, 30%, and 50%, respectively.
  • the image detection device 100 may determine the center coordinates of the area where the seal is located according to the center coordinates of the first area, the center coordinates of the second area, and the center coordinates of the third area; it may be the center coordinates of the first area, the center coordinates of the second area, and The center coordinates of the third area are configured with weights, and the center coordinates of the area where the seal is located are determined by the sum of the products of the center coordinates of each area and the corresponding weights.
  • the weight of the configuration can be determined based on the detection accuracy of the above three methods, or based on the degree of deviation between the boundary of the area located in the three methods and the boundary of the area where the seal is determined after curve fitting, or it can be Determined according to the degree of deviation between the center of the area located in the three ways and the center of the area enclosed by the boundary 1.
  • the above description is based on the example that the image to be detected is a color image. If the image to be detected is a black-and-white image, there is no third area.
  • the above-mentioned similar method can also be used to determine the boundary of the area where the seal is located and the seal
  • the difference between the center coordinates of the area where it is located is that the boundary and center coordinates of the third area do not need to participate in the calculation, and the configured weight can be determined according to a specific scenario, which is not limited in the embodiment of the present application.
  • the seal in the image to be detected may be closer to other graphics in the paper, which may cause deviations in the area of the seal determined by the above three methods. As shown in Figure 3, there are fingerprints near the seal in the image to be detected. For the seal in the image to be detected as shown in Figure 3, one or more of the above three methods may not be able to accurately locate the seal your region.
  • method one locate two first areas, 301A (where the seal is located) and 301B (where the fingerprint is located); using method two, also locate two second areas, 302A (where the seal is located) and 302B (the area where the fingerprint is located); if the color of the fingerprint is similar to the color of the seal, method 3 is adopted, and a second area 303 will be located.
  • FIG. 3 only shows one of the possible situations, and there may also exist deviations in the above three positioning methods for the interruption of the seal, the blurring of the seal, and the light color in the image to be detected.
  • two different seals can be stamped in a file, such as inspection chapter 1 and inspection chapter 2.
  • these two seals can be superimposed and stamped, inspection chapter 1 and inspection There is overlap between Chapter 2.
  • one or more of the above three methods may not be accurately positioned.
  • using method one, two first areas, 401A and 401B, may be located; using method two, two second areas, 402A and 402B, respectively, and method three may be located in a third area.
  • first, second, and third regions in Figure 3 and Figure 4 are divided into rectangular regions.
  • first, second, and third regions can be bordered by the seal.
  • the matching area for example, may also be an ellipse; it may also be an area slightly larger than the seal.
  • the image detection device 100 may also classify the areas determined in the above three ways, and include the first area, second area, and third area of the same seal. Divide into a group.
  • the image detection device 100 may determine the probability of including the same seal through the overlap ratio between the first area, the second area, and the third area. If the overlap rate is greater than the first set value, it is considered that the same seal is included, otherwise it is not included.
  • the specific value of the first set value is not determined in the embodiment of this application. It can be an empirical value, or it can be based on image detection requirements. The accuracy is determined, for example, if the accuracy is high, a larger value can be set as the set value.
  • the image detection device 100 when the image detection device 100 locates the area where the seal is located according to the first area, the second area, and the third area, it needs to perform a culling operation and a grouping operation. After performing these two operations, the image detection device 100 can The first area, the second area and the third area belonging to a group locate the area where the seal is located. The following describes this operation:
  • the preset range can be determined according to the distribution of the first area, the second area, and the third area in the image to be detected, and the densely distributed areas in the first area, the second area, and the third area in the image to be detected are taken as The preset range.
  • the number of preset ranges is not limited in the embodiments of the present application. Multiple densely distributed areas in the first area, second area, and third area in the image to be detected may be used as a preset range.
  • the first area, the second area, and the third area within a preset range can be grouped.
  • Two adjacent areas means that the distance between the centers of the two areas is less than the distance from the boundary of any of the two areas to the center of the area.
  • the preset condition can be one or two of the following two conditions, which are explained separately below:
  • Preset condition 1 The area of the area is smaller than the standard value, and the area is contained in one or more other areas.
  • the area and other areas are any of the first area, the second area, and the third area.
  • the standard value can be the area of the standard seal, or it can be determined according to the area of the first area, the second area, and the third area in the set area. For example, you can set the area in the set area, the first area, and the second area. And the average value of the area of the third region is used as the standard value.
  • the area area can be calculated using the boundary coordinates of the area and the center coordinates of the area.
  • the area of a circle with the center of the area as the center and the radius of the largest distance from the center of the area to the boundary of the area is also approximated as the area area.
  • the seal is positioned in at least two areas (301A or 302B in Figure 3).
  • the areas of the first area 301B and the second area 302B are significantly smaller than the standard seal area, and both are included in the third area 303, and the first area 301B and the second area 302B can be eliminated.
  • preset condition 1 can also be expressed in the form of the diameter of the area.
  • preset condition 1 can be expressed as the diameter of the area is smaller than the standard diameter. The distance is less than half or a quarter of the diameter of other areas.
  • the standard diameter may be the diameter of a standard seal, or it may be determined according to the average value of the diameters of the first, second, and third areas in the set area.
  • the embodiment of this application does not limit the expression of other preset conditions 1. Any expression that can indicate the removal of the first area, the second area, and the third area with a smaller area and included in other areas is applicable to the implementation of this application example.
  • Preset condition 2 The area of the area is greater than the standard value, and the area includes one or more other areas.
  • the area and other areas are any of the first area, the second area, and the third area.
  • the standard value can refer to the description of the preset condition 1, which will not be repeated here.
  • the area of the third area 403 is significantly larger than the area of the standard seal, and includes the first area 401A and the first area 401B, and also includes the second area 402B and the second area 402B, and the third area 403 can be eliminated.
  • the preset condition 2 can also be expressed in terms of the diameter of the area.
  • the preset condition 2 can be expressed as the area diameter is greater than the standard diameter, and the distance between the center of the area and the other area The distance is greater than half or a quarter of the diameter of the area.
  • the standard diameter can be referred to the foregoing content, and will not be repeated here.
  • the embodiment of this application does not limit the expression of other preset condition 2. Any expression that can indicate the removal of the first area, the second area, and the third area which is larger in area and includes other areas is applicable to the implementation of this application example.
  • the first threshold can be an empirical value, or it can be determined according to the accuracy of the above three methods of locating the area of the seal in the image to be detected. If the accuracy of the above three methods is higher, you can set a higher one. Value (such as 80%), otherwise, you can choose a relatively small value (such as 70%). That is, the overlap rate of any two regions belonging to the same group is greater than the first threshold.
  • the grouping in addition to the overlap ratio, the grouping can also be performed according to the distance between the centers of two adjacent areas.
  • the image detection device 100 may compare the distance between the centers of two adjacent areas with the second If the size relationship of the set value is greater than the second set value, divide the areas with the distance between the centers of two adjacent areas greater than the second set value into different groups, and divide the distance less than or equal to the first set value.
  • the two set value areas are divided into the same group.
  • the second set value may be determined according to the size of the seal. For example, the second set value may be half or one-fourth of the diameter of the seal.
  • the distance between the centers of any two regions belonging to the same group is less than or equal to the second set value.
  • grouping can also be performed in combination with the overlap ratio between two adjacent areas and the distance between the centers of two adjacent areas within a preset range in the image to be detected; for example, In the preset range of the image to be detected, the overlap ratio is greater than the first threshold, and the distance between the centers of the two regions is less than or equal to the second set value, and the regions in the image to be detected can be classified into the same group; Within the range, regions where the overlap ratio is less than or equal to the first threshold and the distance between the centers of the two regions is greater than the second set value are divided into different groups.
  • the overlap rate of any two regions belonging to the same group is greater than the first threshold, and the distance between the centers of any two regions is less than or equal to the second set value.
  • the areas of the two regions need to be calculated.
  • the area of the circle is approximately the area of the area, so that the calculation efficiency of the area area can be accelerated, and the elimination operation can be performed more quickly.
  • For grouping operations it involves the possibility that two seals may overlap. When calculating the overlap ratio, the area of each area (such as the first area, the second area and the third area) can be accurately calculated, which can improve the accuracy of the grouping operation .
  • the description of the culling operation and the grouping operation takes the image to be detected as a color image as an example. If the image to be detected is a black and white image, there is no third area, and the culling operation and grouping can also be performed in a similar manner as described above Operation, the difference is that no third region is required to participate.
  • Step 202 The image detection device 100 intercepts an image of the area where the seal is located from the image to be detected.
  • the image of the area where the seal is captured by the image detection device 100 may also include a background image of the seal, such as text, graphics, images, and text, graphics, and images covered by the seal.
  • the image detection device 100 may directly capture the image of the area where the seal is located according to the area where the seal is located in step 201, or may use other methods to capture the image of the area where the seal is located, for example, using an image segmentation algorithm or a color gamut detection algorithm.
  • the image of the area where the seal is located can better reduce the background of the seal included in the image of the area where the seal is located through the image segmentation algorithm or the color gamut detection algorithm.
  • the image segmentation algorithm or color gamut detection algorithm will be introduced below.
  • the image detection device 100 uses an image segmentation algorithm to divide the image of the area where the seal is located.
  • the image detection device 100 uses the image segmentation algorithm to intercept the image of the area where the seal is located, it can intercept a rectangular area from the image to be detected.
  • the center coincides with the center of the area where the seal is located, and the rectangular area includes the area where the seal is located.
  • the rectangular area is used as the input value of the image segmentation algorithm, and the image of the area where the seal is located is determined according to the output value of the image segmentation algorithm.
  • the area where the seal is located can be any of the first area, the second area, and the third area in step 201, or it can be the area where the seal is determined by combining the first area and the second area (corresponding to the black and white image to be detected) Image or color image), it can also be the area where the seal is determined by integrating the first area, the second area, and the third area (corresponding to the case where the image to be detected is a color image), and the first area and the second area are combined.
  • the area where the seal is located and the area where the seal is determined by integrating the first area, the second area, and the third area can be referred to the relevant description in step 201, which will not be repeated here.
  • the embodiment of the application does not limit the type of image segmentation algorithm.
  • the image segmentation algorithm can be an image segmentation algorithm based on deep learning, including but not limited to U-Net, and mask region convolutional neural network. convolutional neural network, Mask-RCNN), semantic segmentation network (semantic segmentation net, SegNet).
  • the image segmentation algorithm can classify each pixel in the area where the seal is located, and determine the pixel of the seal (the pixel in the seal in the image to be detected) and the pixel of the non-seal (the pixel in the image to be detected except the seal) Other pixels), and then extract the image of the area where the seal is located.
  • the original image of the rectangular area (the original image of the rectangular area is the image containing the area where the seal is directly intercepted according to the boundary coordinates of the area where the seal is located) can be used as the input of the image segmentation algorithm, and the image segmentation algorithm can output the segmentation result.
  • image segmentation The algorithm can output a matrix, and one element in the matrix can mark the probability that one or more pixels corresponding to the original image of the rectangular area are the pixels of the seal. According to the value of each element in the matrix, the specific location of the seal can be determined, and then the image of the area where the seal is located can be extracted.
  • the image of the area where the seal is obtained by the image detection device 100 through the image segmentation algorithm is a binary image, and the pixel value of the pixel in the image has only two possible values of 0 and 1.
  • the image In the image of the area where the seal is obtained by the segmentation algorithm 1 indicates that the pixel is a seal pixel, and 0 indicates that the pixel is a non-seal pixel as an example.
  • the image segmentation algorithm can output a corresponding A 256*256 matrix, one element in the matrix can represent the probability that a pixel in the image of the area where the seal is located belongs to the seal, and the correspondence between the elements in the matrix and the pixels of the image in the rectangular area is preset.
  • the image in the rectangular area is consistent with the matrix output by the image segmentation algorithm, so that higher extraction accuracy can be achieved; as a possible implementation, the matrix output by the image segmentation algorithm can also be higher than the original image in the rectangular area.
  • the matrix of is small, so that an element in the matrix output by the image segmentation algorithm can represent the probability that the corresponding multiple pixels in the image of the rectangular area are the pixel points of the seal.
  • the image segmentation algorithm can correspondingly output a 128*128 matrix, and one element of the matrix can represent the probability that the corresponding 4 pixels in the image of the rectangular area are the pixels of the seal.
  • Image segmentation algorithms based on deep learning can be trained in advance, and the training set used for training can include one or two of the following two types of data.
  • the first type is an image including a seal. Each pixel in this image has been labeled, and the pixel is marked as a pixel of the seal, or the pixel is not a pixel of the seal.
  • the second type is the simulated image of the seal.
  • the simulated image of the seal simulates various possible presentation modes of the seal in the image. For example, there are fingerprints near the seal shown in FIG. 3 and the seal overlap shown in FIG. 4. In addition to Figure 3 and Figure 4, there are other different types of presentation. You can draw a seal on a blank image, and perform rotation, contrast adjustment, transparency adjustment, noise superposition (adding noise, such as small bright spots in night photos) and color adjustment of the seal, forming various possible seals in the image to be detected Way of presentation.
  • the embodiment of the application does not limit the number of simulated images of the seal.
  • the above-mentioned method can be used to generate as many simulated images of the seal as possible, so as to increase the number of images included in the training set and improve the training accuracy of the image segmentation algorithm, so that the image
  • the detection device 100 can accurately intercept the image of the area where the seal is located through an image segmentation algorithm.
  • the color gamut detection algorithm is to map the area where the seal is located in the color space, and then extract the pixels with the same color as the seal, and then obtain the image of the area where the seal is located.
  • the image detection device 100 uses the color gamut detection algorithm to extract the image of the area where the seal is located, it can capture a rectangular area including the area where the seal is located.
  • the center of the rectangular area coincides with the center of the area where the seal is located. Mapping in the color space, according to the boundary of the area where the seal is located, remove the pixels outside the area where the seal is located in the rectangular area, and only extract the pixels in the area where the seal is located with the same color as the seal to obtain the image of the area where the seal is located.
  • the area where the seal is located can be any of the first area, the second area, and the third area in step 201, or it can be the area where the seal is determined by combining the first area and the second area (corresponding to the black and white image to be detected) In the case of an image or a color image), it may also be the area where the seal is determined by integrating the first area, the second area, and the third area (corresponding to the case where the image to be detected is a color image).
  • the image detection device 100 can extract the pixels of different hues in the saturation and lightness range related to the seal through the color gamut detection algorithm, and integrate the pixel values and distributions of the pixels in any saturation and lightness range and different hues , To select pixels, and then generate an image of the area where the seal is located according to the reserved pixels.
  • the hue of a saturation and lightness range can be divided according to the hue of each pixel into Multiple segments, each segment corresponds to a tonal range.
  • the image detection device 100 can determine the saturation and the distribution of pixels in different segments in the range of lightness related to the seal through the color gamut detection algorithm, and integrate the pixel values of the pixels in different segments in the saturation and lightness range.
  • each segment can be selected. For example, the segment with less pixel distribution can be removed, and the segment with more pixel distribution can be retained, and then the image of the area where the seal is located is obtained according to the retained pixels of each segment.
  • the following takes the image of the area where the seal is located as an RGB image, the color space is the HSV color space, and the extracted red component is taken as an example to introduce the execution process of the color gamut detection algorithm.
  • the image detection device 100 maps the image of the rectangular area to the HSV color space, converts it into an image in HSV format, and extracts pixels with a red color from the HSV format image; Point segment extraction can be divided into 5 segments for extraction.
  • the HSV value of each segmented pixel (the HSV value is the pixel value of the pixel in the HSV space) is the first segment S(10-255), V(46-255), H(136-150); The second paragraph S(10-255), V(46-255), H(150-160); The third paragraph S(10-255), V( 46-255), H(160-170); the fourth paragraph S(10-255), V(46-255), H(170-180); the fifth paragraph S(10-255), V(46- 255), H(0-10).
  • the number of segments and the threshold of each segment can be empirical values, which are also configured according to the color distribution in the scene.
  • the image detection device 100 counts the number of pixels in each segment, and can only retain the pixels in the part of the segment with the largest number of pixels; usually, the distribution of pixels of one color and different tones is the normal distribution, and the distribution of pixels is selected as More pixels can more completely characterize the color in the image of the area where the seal is located; in the embodiment of the present application, the image detection device 100 may select three segments with more pixel points and superimpose them to generate the seal location. The image of the area.
  • the image of the area where the seal is obtained by the image detection device 100 through the color gamut detection algorithm may also be a binary image, and the pixel value of the pixel in the image has only two possible values of 0 and 1.
  • 1 indicates that the pixel is a seal pixel
  • 0 indicates that the pixel is a non-seal pixel as an example.
  • the rectangular area that can be intercepted may be the same or different; the embodiment of this application does not limit the number of rectangular areas to be intercepted.
  • the number of regions where the target object is located in the image to be detected is 1, a rectangular region is captured; when it is determined that the number of regions where the target object in the image to be detected is multiple, multiple rectangular regions are captured, and each rectangular region includes The area where a target object is located.
  • the image of the seal area obtained by the color gamut detection algorithm may include other red areas on the edge of the seal, or may include other areas that cover the seal. Red area; the area of the seal obtained by the image segmentation algorithm may lack part of the image covered by the seal, and it can also complete the part of the image covered by the seal; for this, it is necessary to remove the part of the image in the area where the seal is not part of the seal.
  • Step 203 The image detection device 100 obtains a background image of the seal according to the image of the area where the seal is located.
  • the background image of the seal is the image of the seal in the area where the seal is located.
  • the image detection device 100 can grayscale the image of the area where the seal is located, generate a grayscale image of the image of the area where the seal is located, and distinguish the seal in the area where the seal is located and the background of the seal based on the grayscale image of the image of the area where the seal is located;
  • the background image of the seal may be an image that is directly intercepted from the image to be detected according to the boundary coordinates of the area where the seal is located.
  • the image detection device 100 may also obtain the background image of the seal based on the image of the area where the seal is obtained using the image segmentation algorithm and the color gamut detection algorithm;
  • the image of the seal area is called the first image
  • the image of the seal area obtained by the color gamut detection algorithm is called the second image.
  • the image detection device 100 can integrate the first image and the second image, and according to the position of the first image in the image to be detected and the position of the second image in the image to be detected, the first image and the second image are cut from the image to be detected.
  • the image of the second image in the area of the image to be detected (for convenience of description, referred to as the third image for short); the image detection device 100 can grayscale the third image to generate a grayscale image of the third image, based on the third image Grayscale image, distinguish the seal in the area where the seal is located, and the background of the seal, and generate the background image of the seal.
  • the image detection device 100 needs to use the grayscale image to distinguish the seal and the background of the seal in the area where the seal is located.
  • the image detection device 100 can perform a binarization operation on the third image according to the gray distribution of the gray image of the third image. Specifically, it can calculate the average gray of the gray image of the third image. It can characterize the average gray value of the seal in the gray image of the third image after the gray level of the third image, and divide the pixel points in the gray image of the third image according to the offset value; the offset value can be characterized After the grayscale of the third image, the offset between the maximum grayscale value or the minimum grayscale value and the average grayscale of the seal in the grayscale image of the third image. Exemplarily, the average gray level may be 150, and the offset value is 30. 130 is the average gray value of the seal in the gray level image of the third image after the gray level of the third image.
  • the average gray level is 150 and the offset value is 30.
  • the difference of the setting value of 30 can represent the minimum gray value of the seal in the gray image of the third image after the gray level of the third image, the minimum gray value is 120, the difference between the average gray value of 120 and the offset value of 30 It can characterize the maximum gray value of the seal in the gray image of the third image after the gray level of the third image is 180; in other words, after the gray level of the third image, the seal in the gray level image of the third image
  • the gray value in the range is between 120 and 180, and the remaining gray values can be considered as the gray values of non-seal pixels.
  • the higher the gray value of the pixel indicates the darker color of the pixel, and the presence of images, text, and graphics can be considered as the background of the seal; the lower gray value of the pixel indicates the The color of the pixel is lighter, which represents the blank here.
  • the pixels in the grayscale image of the third image whose grayscale value is greater than the maximum grayscale value of the seal assign the value of the pixel at the same position in the third image to 1, which represents the background of the seal;
  • the pixel value of the remaining pixels of the image is assigned a value of 0, which means that there is a blank or a pixel of the seal.
  • the binary image of the third image is the background image of the seal.
  • Step 204 The image detection device 100 removes the background of the seal from the image of the area where the seal is located, and generates a seal image.
  • the image detection device 100 may determine the background image of the seal in the image of the area where the seal is located from the image of the area where the seal is located in step 203 according to the background image based on the seal, and remove it.
  • the image detection device 100 can directly compare the background image of the seal with the pixels at the same position in the image of the seal area. Value, remove the pixels at the same position as the non-zero pixels in the back image of the seal from the image of the area where the seal is located, and the image with these pixels removed is the seal image.
  • the background image of the seal since the background image of the seal is obtained, the gray scale and the binarization of the third image are used. This may be due to the selection of the offset value when dividing the pixel interval according to the gray value. Deviations may ignore part of the seal background, or use part of the seal as the seal background, so that the background image of the seal cannot accurately represent the background of the seal.
  • the seal image obtained based on the background image of the seal may have some errors, but Compared with the original image of the area where the seal is located, the seal image can represent the seal more completely and clearly, and contains a small amount of seal background, even without the seal background. In this way, when the subsequent comparison is based on the seal image and the reference image, a more accurate comparison result can also be obtained.
  • the seal image can also be obtained from the image of the seal area in the above manner .
  • the image segmentation algorithm based on deep learning is used in the process of acquiring the first image, and if the image segmentation algorithm based on deep learning is being trained, the data in the training set includes the second type of data, and the training is completed
  • the image segmentation algorithm can recover the covered part of the seal in the area where the seal is located; for example, as shown in Figure 5, the seal in the area where the seal is located is a detection chapter, and the detection chapter is covered by a figure A in the area where the seal is located.
  • the part of the seal covered by the figure A is restored and restored to the same or similar to the standard seal.
  • image algorithms based on deep learning may have excessive recovery. That is to say, if the part of the seal in the area where the seal is not covered, the image algorithm based on deep learning may overcomplete the seal; for example, as shown in Figure 6.
  • the seal in the area where the seal is located is a detection chapter.
  • the outer ring of the detection chapter has a certain width.
  • the blank part B exists in the standard seal, based on deep learning image algorithm It may be certified that the blank part B is the part covered by the seal, and the blank part B is filled, so that the extracted first image is different from the standard seal.
  • the image detection device 100 obtains the second image through the color gamut detection algorithm, it extracts the pixels of the color related to the seal; the second image can better characterize the part that is not covered by the seal, and for the part that is covered by the seal. The characterization is poor.
  • the first image and the second image may also have a certain deviation.
  • the image detection device 100 can distinguish the seal area based on the background image, the first image, and the second image of the seal. The uncovered part of the seal and the covered part of the seal, and then obtain the seal image. Since the background image, the first image, and the second image of the seal are all binarized images, after distinguishing the uncovered part of the seal and the covered part of the seal in the area where the seal is located, you can adjust the pixel of the seal The value of 1 is assigned, and the pixel value of the non-seal pixel is assigned 0 to obtain the seal image. In this way, the seal image is also a binary image.
  • the value of the pixel in the background image of the seal is 1 (indicating that the pixel is the background of the seal)
  • the first The value of the pixel in the image is 1 (indicating that the pixel in the first image is a seal pixel)
  • the value of the pixel in the second image is 0 (indicating that the pixel in the second image is not a seal Pixel)
  • the pixel is the covered part of the seal and does not belong to the background of the seal, and the pixel is the seal pixel.
  • the value of the pixel in the background image of the seal is 0 (indicating that the pixel is not the background of the seal)
  • the value of the pixel in the first image is 1 (indicating that the pixel in the first image indicates that the pixel is a seal pixel)
  • the value of the pixel in the second image is 0 (indicating that the pixel in the second image is not a stamp pixel), that is to say, there is excessive recovery in the first image, and the pixel is not a stamp pixel .
  • the image detection device 100 can better distinguish the seal pixels in the area where the image is located, and further can obtain the seal image from the first image and the second image.
  • Steps 202 to 204 are the seal image extraction operations performed by the image detection device 100.
  • Step 205 After the image detection device 100 obtains the seal image, it can compare with the reference image to determine the degree of similarity between the seal image and the reference image.
  • the embodiment of the application does not limit the type of reference image.
  • the reference image can be a standard image of a seal, that is, an image that is complete and does not have a background of the seal.
  • a seal library can be established, and the seal library includes one or more
  • the image detection device 100 can compare the seal image with the standard image of any seal in the seal library, and determine the standard image of the seal with a greater similarity to the seal image.
  • the reference image may also be another seal image acquired by the image detection device 100 from other images.
  • the image detection device 100 needs to compare the degree of similarity between the seal in the image 1 and the seal in the image 2, and the image detection device 100 adds The obtained seal image is used as a reference image and compared with the seal image in image 1.
  • the manner in which the image detection device 100 obtains the seal image from the image 2 is not limited in this embodiment of the present application.
  • the steps of steps 201 to 204 may be used to extract the seal image in the image 2, or other methods may be used.
  • the angle of the stamp has a certain degree of randomness. As shown in Figure 7, the angle between the center line and the horizontal line of the stamp in the image to be detected is not ninety degrees, but greater than ninety degrees. ; And the angle between the center line of the seal and the horizontal line in the seal image extracted through steps 202 to 204 is the same as that in the image to be detected. However, if the center line of the seal in the reference image is perpendicular to the horizontal line, in order to compare the seal image with the reference image, it is necessary to convert the seal image and the reference image, such as rotating, so that the center line of the seal in the seal image and the seal in the reference image The center lines of the seal are overlapped or parallel.
  • FIG. 7 only uses the angle between the center line of the seal and the horizontal line to measure the angle of the seal in the seal image and the angle of the seal in the reference image as an example for description.
  • the embodiment of the present application does not limit the measurement of the seal in the seal image and the reference image.
  • the angle of the seal for example, you can also measure the angle of the seal in the seal image and the seal in the reference image by the position of the specific image of the seal in the seal; for example, for some seals, there are fixed words, such as "company” and "chapter".
  • the position of these fixed texts in the seal image and the reference image can be used to measure the seal in the seal image and the seal in the reference image.
  • the “chapter” in the seal image is located above the seal image.
  • the “chapter” in is located on the right side of the reference image, and there is a 90 degree angle difference between the seal of the seal image and the seal in the reference image.
  • FIG. 7 only shows a presentation manner of the seal in the image to be detected.
  • other presentation manners may also be used, such as the seal may be deformed.
  • the image detection device 100 may first rotate the seal image to the same or similar angle as the reference image, and then compare the rotated seal image with the reference image.
  • the image detection device 100 may also stretch the seal image to ensure that the image of the target object has the same size as the reference image.
  • the image detection device 100 can determine the relative position between the seal in the seal image and the seal in the reference image through the feature points in the seal image and the reference image, and rotate the seal image based on the feature points in the seal image and the reference image ( Corresponding to the stamp image and the reference image, the angle of the stamp is inconsistent, rotate to make the angle the same or similar) and stretch (corresponding to the stamp image and the reference image of the stamp is deformed, the stamp image and the reference image are stretched to make the stamp image consistent with the shape of the stamp in the reference image Or similar).
  • the manner in which the image detection device 100 extracts the feature points in the seal image and the reference image is not limited.
  • a scale-invariant feature transform SIFT
  • SURF speeded up
  • Robust features ORB (ORiented Brief)
  • FAST features from accelerated segment test
  • the difference between the rotated seal image and the reference image can be compared to determine the degree of similarity between the seal image and the reference image.
  • the image detection device 100 can determine the degree of similarity between the seal image and the reference image by comparing part or all of the main structure, image texture, pixels, and angles of the rotated seal image with the reference image.
  • the main structure is the structural feature of the image, and the main structure can be characterized as the relative position between the feature points of the image, and information such as the scale and size.
  • the image detection device 100 compares the main structure of the seal image with the reference image, it can adopt a structure similarity algorithm.
  • the embodiment of the present application does not limit the type of structure similarity algorithm.
  • the structure similarity algorithm includes, but is not limited to, discrete cosine transform (discrete cosine transform). , DCT), perceptual hash, structural similarity algorithm (structural similarity index, SSIM) algorithm.
  • the output value of the structural similarity algorithm is used as the result value of comparing the main structure of the seal image and the reference image.
  • Image texture is used to indicate the detailed information in the image, the ripples, curves, and corners in the image.
  • the image detection device 100 may extract the feature points of the seal image and the feature points of the reference image, and then determine the image texture difference between the seal image and the reference image based on the matching relationship between the feature points of the seal image and the feature points of the reference image.
  • the relative position and relative distance between the feature points of the seal image and the relative position and relative distance between the feature points of the reference image are the same or similar, it can be considered that the feature points of the seal image match the feature points of the reference image, otherwise, It is considered that the feature points of the seal image do not match the feature points of the reference image; the feature points with a better matching relationship between the feature points of the seal image and the feature points of the reference image account for the total feature points (the feature points of the seal image and the reference image).
  • the ratio of the sum of the feature points) is used as the result value of the comparison of the image texture difference between the seal image and the reference image. It should be noted that the above method is only an example, and the embodiment of this application does not limit the characterization of the seal image and the reference image. The way the image texture differs.
  • the manner in which the image detection device 100 extracts the feature points in the rotated seal image and the reference image is not limited.
  • algorithms such as SIFT, SURF, ORB, GIST, etc. may be used.
  • the feature points extracted by comparing the image texture of the seal image and the reference image are feature points that can reflect the details of the image. For example, some small ripples and curves in the two images can be extracted.
  • the feature points extracted by comparing the main structure of the seal image and the reference image are feature points that can reflect the overall structure of the image.
  • Any image includes multiple pixels, and each pixel has a pixel value.
  • the absolute pixel refers to the pixel difference between the rotated seal image and the pixel at the same position of the reference image.
  • the image detection device 100 can calculate the pixel difference between two pixels at the same position of the seal image and the reference image after rotation, and generate an absolute difference image.
  • the pixel value of one pixel on the absolute difference image is the same position of the seal image.
  • the pixel distribution probability is calculated as a result value of comparing the pixel points of the seal image and the reference image.
  • the reference image is also a binarized image.
  • the absolute difference image is also a binarized image.
  • the pixel distribution probability of the absolute difference image can be equal to the pixel value indicating the absolute value image The ratio of pixels with a value of 1. The larger the ratio, the greater the difference between the seal image and the reference image after rotation.
  • the image detection device 100 can compare the difference between the pixel block at the same position in the rotated seal image and the reference image, and then determine the degree of similarity between the seal image and the reference image.
  • the pixel block is composed of multiple adjacent pixels.
  • the embodiment of the present application does not limit the size of the pixel block, and pixel blocks of different sizes reflect different difference information between the rotated seal image and the reference image. For example, a smaller pixel block can reflect the difference information between the details of the rotated seal image and the reference image; a larger pixel block can reflect the difference information between the overall structure of the rotated seal image and the reference image.
  • first-level pixel block divides the absolute pixel image into multiple first-level pixel blocks (for example, a pixel block composed of 4 pixels is called a first-level pixel block), as shown in Figure 8, divide the adjacent 4 pixels Form a first-level pixel block (can be regarded as a selection rule), take one pixel as the step distance, and according to the same selection rule, separate other first-level pixel blocks from the absolute value image; calculate the pixel value in the first-level pixel block The ratio of 1 pixel to the total pixel is used as the difference value of the first-level pixel block.
  • the first-level pixel block is combined into a second-level pixel block (for example, the second-level pixel block is composed of 4 adjacent first-level pixel blocks, that is, it includes 16 pixels).
  • the embodiment of the application does not limit the selection of the second-level pixel
  • the block selection rule can be four adjacent first-level pixel blocks to form a second-level pixel block, or two adjacent first-level pixel blocks to form a second-level pixel block; as shown in Figure 9, Combine 4 adjacent first-level pixel blocks to form a second-level pixel block (can be regarded as a selection rule), use two pixels as the step distance, and according to the same selection rule, separate other second-level pixels from the absolute value image Block: Calculate the ratio of pixels with a pixel value of 1 in the secondary pixel block to the total pixel points as the difference value of the secondary pixel block.
  • a similar method can be used to combine the second-level pixel blocks into a third-level pixel block.
  • four adjacent second-level pixel blocks form a third-level pixel block (can be regarded as a selection rule) , With 4 pixels as the stepping distance, according to the same selection rules, the other three-level pixel blocks are segmented from the absolute value image; the ratio of pixels with a pixel value of 1 in the second-level pixel block to the total pixels is calculated as The difference value of the three-level pixel block.
  • a plurality of three-level pixel blocks can also be formed into a four-level pixel block.
  • the pixel blocks of the same level (such as the first-level pixel block, the second-level pixel block, the third-level pixel block, or the fourth-level pixel block, etc.) divided by the above method need to cover all the pixels in the absolute pixel image whose pixel value is not zero.
  • the above-mentioned method of capturing pixel blocks of different sizes is only an example, and the embodiment of the present application is not limited; for example, other selection rules may be adopted, or pixel blocks of different sizes may be selected by a step distance.
  • the first-level pixel block and the second-level pixel block can represent the difference between the text on the seal and the graphic details in the seal image and the reference image;
  • the third-level pixel block and the fourth-level pixel block can represent the seal The overall difference between the text on the stamp and the graphics in the image and the reference image.
  • the maximum value of the difference value with the largest pixel block level is selected as the result value of the pixel block comparison.
  • the image detection device 100 can compare the angle difference between the rotated seal image and the reference image. Yes, the image detection device 100 can extract the feature points of the rotated seal image and the reference image, calculate the affine change matrix of the rotated and stretched seal image and the reference image, and determine the rotated and stretched The angle difference between the stamp image and the reference image.
  • the affine change matrix is used to indicate the angular difference between the feature points of the rotated seal image and the reference image.
  • the image detection device 100 After the image detection device 100 has performed the above comparison, it can determine the degree of similarity between the seal image and the reference image based on the result value of the comparison.
  • the image detection device 100 may combine the multiple result values generated by the above-mentioned image feature comparison to determine the degree of similarity between the seal image and the reference image.
  • the following takes the result of comparing the main structure of the seal image and the reference image as SIM, the result of comparing the image feature points of the seal image and the reference image is ST, and the result of comparing the absolute pixels of the seal image and the reference image is the value ABS, the result value of the comparison between the seal image and the pixel block of the reference image is BK, and the result of the angle comparison between the seal image and the reference image after rotation is SF as an example.
  • the degree of similarity S between the seal image and the reference image can be determined by the following formula:
  • the degree of similarity S between the seal image and the reference image can be determined by the following formula:
  • the above two methods are merely examples, and the embodiments of the present application do not limit the method of determining the degree of similarity between the seal image and the reference image based on the result value of the comparison of the main structure, image texture, and pixel of the seal image and the reference image.
  • the image detection device 100 may also select only some of the result values to determine the degree of similarity between the seal image and the reference image.
  • the image detection device 100 may characterize the degree of similarity between the seal image and the reference image through any of SIM, ST, ABS, BK, and SF.
  • the image detection device 100 may determine the degree of similarity between the seal image and the reference image by comparing the main structure of the seal image and the reference image after the rotation and the absolute pixel comparison result value.
  • the degree of similarity S between the seal image and the reference image can be determined by the following formula:
  • the image detection device 100 may determine the degree of similarity between the seal image and the reference image based on the comparison result value of the main structure and the image texture of the seal image and the reference image after rotation.
  • the degree of similarity S between the seal image and the reference image is represented in the form of a product, and the embodiment of the present application does not limit the use of other calculation methods to determine the degree of similarity S between the seal image and the reference image.
  • the embodiment of the present application also provides an image detection device for executing the method executed by the image detection device in the above method embodiment.
  • the device includes a positioning unit 1101, an intercepting unit 1102, an acquiring unit 1103, a generating unit 1104, and a comparing unit 1105:
  • the positioning unit 1101 is used to locate the area where the target object in the image to be detected is located.
  • the positioning unit 1101 may be used to execute step 201 in the embodiment shown in FIG. 2.
  • the intercepting unit 1102 is used to intercept the image of the area where the target object is located from the image to be detected.
  • the intercepting unit 1102 may be used to execute step 202 in the embodiment shown in FIG. 2.
  • the acquiring unit 1103 is configured to acquire a background image of the target object, the background image of the target object is an image of the target object removed from the area where the target object is located; the acquiring unit 1103 may be used to perform step 203 in the embodiment shown in FIG. 2.
  • the generating unit 1104 is configured to remove the background of the target object from the image of the area where the target object is located to generate an image of the target object; the generating unit 1104 may be used to perform step 204 in the embodiment shown in FIG. 2.
  • the comparing unit 1105 is used to determine the similarity between the image of the target object and the reference image by comparing the image of the target object with the reference image.
  • the comparison unit 1105 can be used to execute step 205 in the embodiment shown in FIG. 2.
  • the positioning unit 1101 can use two different methods to locate the area where the target object is located in the image to be detected.
  • the area where the target object is located determines the more accurate area where the target object is located.
  • the positioning unit 1101 may detect the target object in the image to be detected through the target detection algorithm, and locate the first area in the image to be detected, the first area including the target object; the positioning unit 1101 may also detect the object in the image to be detected Detect the preset graphic in the image, the area where the preset graphic is located in the image to be detected is the second area, and the preset graphic is the boundary shape of the target object; after that, the positioning unit 1101 combines the first area and the second area to obtain the area where the target object is located .
  • the positioning unit 1101 when the positioning unit 1101 synthesizes the first area and the second area to determine the area where the target object is located, it may perform curve fitting on the boundary of the first area and the boundary of the second area to determine the boundary of the area where the target object is located; and Determine the center coordinates of the area where the target object is located according to the center coordinates of the first area and the center coordinates of the second area.
  • the positioning unit 1101 when it performs curve fitting on the boundary of the first area and the boundary of the second area to determine the boundary of the area where the target object is located, it may compare the boundary of the first area and the second area according to a preset ratio value.
  • the boundary of the region is curve-fitted, and each region in the first region and the second region corresponds to a ratio value.
  • the positioning unit 1101 determines the center coordinates of the area where the target object is located according to the center coordinates of the first area and the center coordinates of the second area, it may be based on the sum of the product of the center coordinates of each area in the first area and the second area and the corresponding weights. Determine the center coordinates of the area where the target object is located.
  • the positioning unit 1101 may use three different methods to locate the area where the target object is located in the area where the target object in the image to be detected is located, and the target object is located in the three ways. The location determines the location of the more accurate target object.
  • the positioning unit 1101 may detect the target object in the image to be detected through a target detection algorithm, and locate the first area in the image to be detected, the first area including the target object; the positioning unit 1101 may also detect the target object in the image to be detected The preset graphic in the detected image, the area where the preset graphic is located in the image to be detected is the second area, and the preset graphic is the boundary shape of the target object; the positioning unit 1101 may also determine the first image from the image to be detected according to the color of the target object Three regions, the color of the third region is the color of the target object; after that, the positioning unit 1101 integrates the first region, the second region, and the third region to obtain the region where the target object is located.
  • the positioning unit 1101 when the positioning unit 1101 synthesizes the first area, the second area, and the third area to obtain the area where the target object is located, it may perform curve fitting on the boundary of the first area, the boundary of the second area, and the boundary of the third area. , Determine the boundary of the area where the target object is located; and determine the center coordinates of the area where the target object is located according to the center coordinates of the first area, the center coordinates of the second area, and the center coordinates of the third area.
  • the positioning unit 1101 when it performs curve fitting on the boundary of the first area, the boundary of the second area, and the boundary of the third area to determine the boundary of the area where the target object is located, it may compare the first area according to a preset ratio value.
  • the boundary of the region, the boundary of the second region, and the boundary of the third region are curve-fitted, and each region of the first region, the second region, and the third region corresponds to a ratio value.
  • the positioning unit 1101 determines the center coordinates of the area where the target object is located according to the center coordinates of the first area, the center coordinates of the second area, and the center coordinates of the third area, according to each of the first area, the second area, and the third area
  • the sum of the center coordinates of and the product of the corresponding weights determines the center coordinates of the area where the target object is located.
  • the positioning unit 1101 may perform a culling operation before integrating the first area, the second area, and the third area to obtain the area where the target object is located; for example, the positioning unit 1101 may remove the first area, the second area, and the second area. The area that meets the preset conditions among the three areas.
  • At least one of the following conditions is preset:
  • Condition 1 The area of the area is smaller than the standard value, and the area is contained in one or more other areas;
  • the area of the area is less than the standard value, and the area is included in one or more other areas.
  • the positioning unit 1101 may perform a culling operation before determining the area where the target object is located by combining the first area and the second area; for example, the locating unit 1101 may remove the first area and the second area that meet the preset conditions. area.
  • At least one of the following conditions is preset:
  • Condition 1 The area of the area is smaller than the standard value, and the area is contained in one or more other areas;
  • the area of the area is less than the standard value, and the area is included in one or more other areas.
  • the positioning unit 1101 may perform a grouping operation when integrating the first area, the second area, and the third area to obtain the area where the target object is located; exemplary, the positioning unit 1101 may calculate the first area, the second area, and The overlap ratio between two adjacent areas in the third area is divided into a group within the preset range of the image to be detected, the area with an overlap ratio greater than the first threshold, and the overlap of any two areas in the same group The rate is greater than the first threshold; then, the first area, the second area, and the third area belonging to the same group are synthesized to obtain the area where the target object is located.
  • the positioning unit 1101 may perform a grouping operation before integrating the first area and the second area to obtain the area where the target object is located; for example, the positioning unit 1101 may calculate two adjacent ones of the first area and the second area.
  • the overlap ratio between the regions is divided into a group in a preset range of the image to be detected with an overlap ratio greater than the first threshold, and the overlap ratio of any two regions in the same group is greater than the first threshold; Then integrate the first area and the second area belonging to the same group to obtain the area where the target object is located.
  • the intercepting unit 1102 can intercept the image of the area where the target object is located in the following two different ways:
  • Manner 1 The first image is segmented from the image to be detected by an image segmentation algorithm, and the first image includes the target object.
  • Manner 2 Extract the pixels of the first color from the area where the target object is located, and obtain the second image according to the pixels of the first color, where the first color is the color of the target object.
  • the intercepting unit 1102 uses an image segmentation algorithm to segment the first image from the area where the target object is located in the image to be detected.
  • the first rectangular area may be intercepted from the image to be detected.
  • the center of the area coincides with the center of the area where the target object is located, and the first rectangular area includes the area where the target object is located; after that, the first rectangular area is used as the input value of the image segmentation algorithm, and the first image is determined according to the output value of the image segmentation algorithm.
  • the intercepting unit 1102 may extract pixels of the first color from the area where the target object is located, obtain the second image according to the pixels of the first color, and may intercept the second rectangle including the area where the target object is located from the image to be detected. Area, the center of the second rectangular area coincides with the center of the area where the target object is located; the second rectangular area is mapped in the color space, and the pixels outside the area where the target object is located in the second rectangular area are removed according to the boundary of the area where the target object is located Point, extract the pixel points of the first color in the area where the target object is located, and obtain the second image.
  • the acquiring unit 1103 when the acquiring unit 1103 acquires the background image of the target object based on the image of the area where the target object is located, it may intercept the third image from the image to be detected based on the first image and the second image, and the third image includes the first image. Image and the second image; then, the third image is grayscaled to obtain the grayscale image of the third image; and based on the grayscale distribution of the grayscale image of the third image, distinguish the target object and the target in the area where the target object is located Object background, extract the background image of the target object.
  • the generating unit 1104 when the generating unit 1104 removes the background of the target object from the image of the area where the target object is located to generate the image of the target object, it can compare the background image of the target object with the pixels at the same position in the image of the area where the target object is located. The value of is removed from the image of the area where the target object is located, and the pixel at the same position as the non-zero pixel in the back image of the target object is removed to obtain the image of the target object.
  • the comparing unit 1105 determines the degree of similarity between the image of the target object and the reference image by comparing the image of the target object with the reference image, it may first match the feature points of the image of the target object with the feature points of the reference image. , Rotate the image of the target object; Afterwards, by comparing the main structure, image texture, pixel and angle of the image of the reference image and the rotated target object, the degree of similarity between the image of the target object and the reference image is determined.
  • the positioning unit 1101 locates the area where the target object is located, the intercepting unit 1102 intercepts the image of the area where the target object is located, the obtaining unit 1103 obtains the background image of the target object, the generating unit 1104 generates the image of the target object, and the comparing unit 1105 compares the image of the target object with
  • the image detection device 100 in the embodiment shown in FIG. 2 to locate the area where the seal is located, intercept the image of the area where the seal is located, obtain the background image of the seal, generate the seal image, and compare the seal image with the reference image
  • the division of units in the embodiments of the present application is illustrative, and is only a logical function division, and there may be other division methods in actual implementation.
  • the functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the foregoing embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination.
  • the above-mentioned embodiments may be implemented in the form of a computer program product in whole or in part.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from a website, computer, server, or data center.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more sets of available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium.
  • the semiconductor medium may be a solid state drive (SSD).
  • FIG. 12 is a schematic diagram of an image detection device 1200 provided by an embodiment of the application.
  • the image detection device 1200 includes a processor 1201 and a memory 1202.
  • the image detection device 1200 may further include a communication interface 1203.
  • the number of the processor 1201, the memory 1202, and the communication interface 1203 does not constitute a limitation to the embodiment of the present application, and can be configured arbitrarily according to business requirements during specific implementation.
  • the memory 1202 may be a volatile memory, such as a random access memory; the memory may also be a non-volatile memory, such as a read only memory, flash memory, hard disk drive (HDD) or solid-state drive (SSD) Or, the memory 1202 is another medium that can store computer program instructions.
  • volatile memory such as a random access memory
  • non-volatile memory such as a read only memory, flash memory, hard disk drive (HDD) or solid-state drive (SSD)
  • the memory 1202 is another medium that can store computer program instructions.
  • connection medium between the foregoing processor 1201 and the memory 1202 is not limited in the embodiment of the present application.
  • the processor 1201 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or artificial intelligence (AI). ) Chips, system on chip (system on chip, SoC), complex programmable logic device (CPLD), graphics processing unit (GPU), etc.
  • CPU central processing unit
  • ASIC application specific integrated circuit
  • FPGA field programmable gate array
  • AI artificial intelligence
  • an independent data transceiver module can also be set, such as a communication interface 1203 for sending and receiving data; when the processor 1201 communicates with other devices, data can be transmitted through the communication interface 1203, such as from an access device Instructions are received in 300, and images to be detected are obtained from the database of the collection device 100 or the data server.
  • the processor 1201 in FIG. 12 can call the computer execution instructions stored in the memory 1202, so that the image detection device can execute the image detection in the embodiment shown in FIG. Steps 201 to 205 performed by the device 100.
  • the functions/implementation processes of the positioning unit 1101, the interception unit 1102, the acquisition unit 1103, the generation unit 1104, and the comparison unit 1105 in FIG. 11 can all be implemented by calling the computer execution instructions stored in the memory 1202 by the processor 1201 in FIG. 12 .
  • the disclosed system, device, and method may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.

Landscapes

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

Abstract

图像检测方法、设备以及***,用以实现高效的图像检测。图像检测设备可以从待检测图像中定位目标对象所在区域(201),并截取目标对象所在区域的图像(202);之后,从目标对象所在区域中提取目标对象的背景图像(203);图像检测设备通过目标对象的背景图像,可以区分目标对象所在区域的图像中的目标对象以及目标对象的背景,进而可以获取较为纯净的目标对象的图像,使得目标对象的图像中包含较少的背景,甚至不包含背景;在获取目标对象的图像后,可以对目标对象的图像与参考图像进行比对,确定目标对象的图像与参考图像的相似程度(205)。该方法不仅适用于彩色图像的检测,也适用于黑白图像的检测,能够扩展图像检测方法的适用范围。

Description

图像检测方法、设备以及***
本申请要求于2019年06月29日提交中国专利局、申请号为201910581381.X、发明名称为“图像检测方法、设备以及***”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及信息技术领域,尤其涉及一种图像检测方法、设备以及***。
背景技术
在商业活动或日常生活中存在大量的文书、表单、合同等文件,这些文件中均盖有***,***(也称为印鉴)具有一定的法律效益,可以表征各类文件的合法性和真实性。
为了验证这些文件的合法性和真实性,需要对这些文件中的***进行识别和比对,之前,***的识别和比对主要依赖人工操作,但人工完成这些工作的准确度和效率有限,为此提出借助基于信息技术(information technology,IT)的方案。
具体的,首先需要对文件进行扫描,在扫描后产生的图像中检测红色像素(如***颜色为红色)或蓝色像素(如***颜色为蓝色),根据检测到的红色像素生成***图像,基于***图像,与标准***图像比对,判断该文件中的***是否为真实***,进而确定该文件的真实性。
但是采用上述方式生成的***图像中存在较多的不属于***的无效部分,导致***图像的准确率较差,之后进行***比对时,容易产生错误结果,无法准确的验证文件的真实性和合法性。
发明内容
本申请提供一种图像检测方法、设备以及***,用以实现高效的图像检测。
第一方面,本申请提供了一种图像检测方法,该方法可以由图像检测设备执行,该方法包括,图像检测设备可以先定位待检测图像中目标对象所在区域;之后,从待检测图中截取目标对象所在区域的图像;图像检测设备还可以从待检测图像中目标对象所在区域中获取目标对象的背景图像,目标对象的背景图像为目标对象所在区域中除去目标对象的图像;例如,目标对象的背景可以是目标对象覆盖的文字、图形以及图像,还可以是目标对象所遮盖的文字、图形以及图像等。之后,图像检测设备可以通过目标对象的背景图像区分目标对象所在区域中的目标对象以及目标对象的背景,从目标对象所在区域的图像中去除目标对象的背景,生成目标对象的图像;并通过比对目标对象的图像与参考图像,确定目标对象的图像与参考图像的相似程度。
通过上述方法,图像检测设备可以通过目标对象的背景图像区分目标对象所在区域中的目标对象以及目标对象的背景,可以使得目标对象的图像中包含较少的背景,甚至不包含背景,能够较为精确的确定目标对象的图像,该方法不仅适用于彩色图像的检测,也适用于黑白图像的检测,能够扩展图像检测方法的适用范围。
在一种可能的设计中,图像检测设备在定位待检测图像中目标对象所在区域时,可 以通过两种不同的方式进行定位,示例性的,图像检测设备可以通过目标检测算法检测待检测图像中的目标对象,定位待检测图中的第一区域,第一区域包括目标对象;图像检测设备也可以在待检测图像中检测待检测图像中的预设图形,待检测图像中预设图形所在区域为第二区域,预设图形为目标对象的边界形状;之后,图像检测设备再综合第一区域、第二区域以获取目标对象所在区域。图像检测设备在定位待检测图像中目标对象所在区域时,可以通过两种不同的方式进行定位,并综合这两种方式确定的目标对象所在区域,以保证可以精确定位目标对象所在区域。
在一种可能的设计中,图像检测设备在综合第一区域以及第二区域以获取目标对象所在区域可以分别确定目标对象所在区域的边界以及中心:示例性的,图像检测设备可以对第一区域的边界以及第二区域的边界进行曲线拟合,确定目标对象所在区域的边界;以及根据第一区域的中心坐标和第二区域的中心坐标确定目标对象所在区域的中心坐标。
通过上述方法,通过对不同方式定位的区域整合确定目标对象所在区域的边界坐标以及中心坐标,使得最终定位的目标对象的区域较为精确。
在一种可能的设计中,图像检测设备在对第一区域的边界以及第二区域的边界进行曲线拟合,确定目标对象所在区域的边界时,可以根据预设的比例值对第一区域的边界以及第二区域的边界进行曲线拟合,第一区域以及第二区域中每个区域对应一个比例值;图像检测设备根据第一区域的中心坐标和第二区域的中心坐标确定目标对象所在区域的中心坐标时,可以根据每个区域的中心坐标以及对应权重的乘积之和确定目标对象所在区域的中心坐标。
通过上述方法,在对不同方式定位的区域整合确定目标对象所在区域的边界坐标以及中心坐标时,配置对应的比例值以及权重,对于准确度较高的定位方式下定位的区域,可以配置较高的比例值以及权重,使得最终定位的目标对象所在区域的边界坐标以及中心坐标较为准确。
在一种可能的设计中,对待检测图像为彩色图像的情况下,图像检测设备在定位待检测图像中目标对象所在区域时,可以通过三种不同的方式进行定位;示例性的,图像检测设备可以通过目标检测算法检测待检测图像中的目标对象,定位待检测图中的第一区域,第一区域包括目标对象;图像检测设备还可以在待检测图像中检测待检测图像中的预设图形,待检测图像中预设图形所在区域为第二区域,预设图形为目标对象的边界形状;图像检测设备也可以根据目标对象的颜色,从待检测图像中确定第三区域,第三区域的颜色为目标对象的颜色;之后,再综合第一区域、第二区域以及第三区域以获取目标对象所在区域。图像检测设备在定位待检测图像中目标对象所在区域时,可以综合这三种方式确定的区域,实现精确定位目标对象所在区域。
在一种可能的设计中,图像检测设备在综合第一区域、第二区域以及第三区域获取目标对象所在区域时,可以分别确定目标对象所在区域的边界以及中心;示例性的,图像检测设备可以对第一区域的边界、第二区域的边界以及第三区域的边界进行曲线拟合,确定目标对象所在区域的边界;以及根据第一区域的中心坐标、第二区域的中心坐标以及第三区域的中心坐标确定目标对象所在区域的中心坐标。
通过上述方法,通过对不同方式定位的区域整合确定目标对象所在区域的边界坐标 以及中心坐标,保证可以精确定位的目标对象的区域。
在一种可能的设计中,图像检测设备在对第一区域的边界、第二区域的边界以及第三区域的边界进行曲线拟合,确定目标对象所在区域的边界时,可以根据预设的比例值对第一区域的边界、第二区域的边界以及第三区域的边界进行曲线拟合,第一区域、第二区域以及第三区域中每个区域对应一个比例值;图像检测设备根据第一区域的中心坐标、第二区域的中心坐标以及第三区域的中心坐标确定目标对象所在区域的中心坐标时,可以根据每个区域的中心坐标以及对应权重的乘积之和确定目标对象所在区域的中心坐标。
通过上述方法,在对不同方式定位的区域整合确定目标对象所在区域的边界坐标以及中心坐标时,配置对应的比例值以及权重,对于准确度较高的定位方式下定位的区域,可以配置较高的比例值以及权重,确保最终定位的目标对象所在区域的边界坐标以及中心坐标较为准确。
在一种可能的设计中,图像检测设备在综合第一区域、第二区域以及第三区域以获取目标对象所在区域之前,还可以执行剔除操作,去除其中部分区域;示例性的,图像检测设备可以剔除第一区域、第二区域以及第三区域中满足预设条件的区域,预设条件为区域面积小于标准值、区域包含在一个或多个其他区域;和/或区域面积小于标准值、区域包括在一个或多个其他区域。
通过上述方法,对于第一区域、第二区域以及第三区域中明显不包含目标对象的区域可以进行去除,保证最终定位的目标对象所在区域的准确性。
在一种可能的设计中,图像检测设备在综合第一区域、第二区域获取目标对象所在区域之前,还可以执行剔除操作,去除其中部分区域。示例性的,图像检测设备可以剔除第一区域以及第二区域满足预设条件的区域,预设条件为区域面积小于标准值、区域包含在一个或多个其他区域;和/或区域面积小于标准值、区域包括在一个或多个其他区域。
通过上述方法,去除第一区域、以及第二区域中明显不包含目标对象的区域,保证可以准确定位的目标对象所在区域。
在一种可能的设计中,图像检测设备在综合第一区域、第二区域以及第三区域获取目标对象所在区域,可以进行分组,之后再综合属于同一组的第一区域、第二区域以及第三区域获取目标对象所在区域;其中,在进行分组时,可以计算第一区域、第二区域以及第三区域中相邻的两个区域之间的重叠率,将待检测图像中预设范围内,重叠率大于第一阈值的区域划分在一个组。这样,同一个组内的第一区域、第二区域以及第三区域中的任意两个区域的重叠率大于第一阈值。
通过上述方法,对于待检测图像中存在多个目标对象的情况,采用分组的方式,可以针对每一个目标对象进行定位,确定每一个目标对象所在区域,能够保证目标对象的精确定位。
在一种可能的设计中,图像检测设备在综合第一区域和第二区域获取目标对象所在区域时,可以进行分组,之后再综合属于同一组的第一区域和以及第二区域,获取目标对象所在区域;其中在进行分组时,可以计算第一区域、以及第二区域中相邻的两个区域之间的重叠率,将待检测图像中预设范围内,重叠率大于第一阈值的区域划分在一个 组。这样,同一个组内的第一区域以及第二区域中的任意两个区域的重叠率大于第一阈值。
通过上述方法,对于待检测图像中存在多个目标对象的情况,采用分组的方式,可以针对每一个目标对象进行定位,确定每一个目标对象所在区域,能够保证目标对象的精确定位。
在一种可能的设计中,图像检测设备在从待检测图像中截取目标对象所在区域的图像时,可以通过如下两种方式实现:
方式一、图像检测设备可以通过图像分割算法从待检测图像中目标对象所在区域分割出第一图像,第一图像包括目标对象。
方式二、图像检测设备可以从目标对象所在区域中提取第一颜色的像素点,根据第一颜色的像素点获取第二图像,第一颜色为目标对象的颜色。
通过上述方法,图像检测设备可以灵活的通过不同的方式截取目标对象所在区域的图像。
在一种可能的设计中,图像检测设备在通过图像分割算法从待检测图像中目标对象所在区域分割出第一图像时,可以从待检测图像中截取包括目标对象所在区域的第一矩形区域,第一矩形区域的中心与目标对象所在区域的中心重合,将第一矩形区域作为图像分割算法的输入值,根据图像分割算法的输出值确定第一图像。
通过上述方法,第一矩形区域的中心与目标对象所在区域的中心重合,可以确保目标对象所在区域的中心在分割出的第一图像的中心,这样,可以保证分割出的第一图像能够较好的覆盖整个目标对象。
在一种可能的设计中,图像检测设备在从目标对象所在区域中提取第一颜色的像素点,根据第一颜色像素点获取第二图像时,可以从待检测图像中截取包括目标对象所在区域的第二矩形区域,第二矩形区域的中心与目标对象所在区域的中心重合;之后,将第二矩形区域映射在色彩空间中,根据目标对象所在区域的边界去除第二矩形区域内目标对象所在区域之外的像素点,提取目标对象所在区域内第一颜色的像素点,获取第二图像。
通过上述方法,图像检测算可以利用目标对象所在区域的边界去除非第二矩形区域中非目标对象的部分,可以保证分割出的第一图像能够较好的覆盖整个目标对象,且包括较少的背景。
在一种可能的设计中,图像检测设备在根据目标对象所在区域的图像,获取目标对象的背景图像时,可以根据第一图像与第二图像,从待检测图像中截取第三图像,第三图像覆盖第一图像和第二图像在待检测图像中的区域;之后,图像检测设备可以对第三图像进行灰度,获取第三图像的灰度图像;并且还可以基于第三图像的灰度图像的灰度分布情况,在目标对象所在区域区分目标对象以及目标对象的背景,提取目标对象的背景图像。
通过上述方法,通过对第三图像进行灰度的方式,可以较好的区分目标对象所在区域区分目标对象以及目标对象的背景,例如灰度值处于灰度分布区间的中间位置可以认为是目标对象,灰度值过高或过低可以认为是目标对象的背景,采用这种方式,能保证提取出较为准确的目标对象的背景图像。
在一种可能的设计中,图像检测设备在基于目标对象的背景图像,从目标对象所在区域的图像中去除目标对象的背景,生成目标对象的图像时,可以比对目标对象的背景图像与目标对象所在区域的图像中相同位置的像素点的值,从目标对象所在区域的图像中去除与目标对象的背影图像中非零像素点相同位置的像素点,对于目标对象的背景图像中非零像素点可以认为是非***像素点,这样可以直接从目标对象所在区域的图像中去除,去除了目标对象的背景的图像为目标对象的图像。
通过上述方法,图像检测设备通过比较目标对象所在区域的图像以及目标对象的背景图像相同位置的像素点,确定目标对象的图像,使得目标对象的图像包括的目标对象的背景较少,可以得到较为纯净的目标对象的图像。
在一种可能的设计中,图像检测设备在对目标对象的图像与参考图像比对时,可以先通过匹配目标对象的图像的特征点与参考图像的特征点,对目标对象的图像进行旋转;之后,再通过比对参考图像与旋转后的目标对象的图像的主体结构、图像纹理、像素点以及角度中的至少一个,确定目标对象的图像与参考图像的相似程度。
通过上述方法,图像检测设备可以通过多个不同的方面对目标对象的图像与参考图像进行比对,可以实现精确比对,进而保证可以准确确定目标对象的图像与参考图像的相似程度。
第二方面,本申请提供了一种图像检测设备,该设备具有实现第一方面及第一方面任意一种可能的设计中所实现的功能。该设备功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。硬件或软件包括一个或多个与上述功能相对应的模块。在一个可能的设计中,装置的结构中包括定位单元、截取单元、获取单元、生成单元以及比对单元,这些单元可以执行上述第一方面方法示例中的相应功能,具体参见方法示例中的详细描述,此处不做赘述。
第三方面,本申请还提供了一种图像检测设备,有益效果可以参见第一方面及第一方面任意一种可能的设计的描述此处不再赘述。图像检测设备的结构中包括处理器和存储器,处理器被配置为执行上述第一方面及第一方面任意一种可能的设计的方法中相应的功能。存储器与处理器耦合,其保存图像检测设备必要的程序指令和数据。图像检测设备的结构中还包括通信接口,用于与其他设备进行通信。
第四方面,本申请还提供了一种图像检测***,该***中包括如第二方面及第二方面任意一种可能的设计中图像检测设备,该图像检测设备可以用于执行如第一方面及第一方面任意一种可能的设计的方法,图像检测***还可以包括采集设备以及访问设备。采集设备用于采集待检测图像,将待检测图像发送至图像检测设备,访问设备用于向图像检测设备发送指令,指令用于指示图像检测设备对待检测图像进行检测(如指示检测待检测图像中的目标对象)。
第五方面,本申请还提供了一种图像检测***,该***中包括如第二方面及第二方面任意一种可能的设计中图像检测设备,该图像检测设备可以用于执行如第一方面及第一方面任意一种可能的设计的方法,图像检测***还可以包括存储有数据库的数据服务器,该数据库用于存储图像;可选的,图像检测***还可以包括采集设备以及访问设备。采集设备用于采集待检测图像,将待检测图像发送至数据服务器,数据服务器将待检测图像保存在数据库中。访问设备可以向图像检测设备发送指令,该指令用于指示图像检 测设备对待检测图像进行检测(如指示检测待检测图像中的目标对象),且该指令中可以包括待检测图像的相关信息(如标识、编号等);图像检测设备接收到指令后,可以通过连接数据服务器,根据待检测图像的相关信息从数据库中获取待检测图像。
需要说明的是,图像检测设备与采集设备也可以构成另一种图像检测***,图像检测设备可以从采集设备中获取待检测图像,并执行如第一方面及第一方面任意一种可能的设计的方法;图像检测设备与访问设备也可以构成另一种图像检测***,访问设备用于向图像检测设备发送指令,指令用于指示图像检测设备对待检测图像进行检测,该指令中可以包括待检测图像(可选的,访问设备也可以单独将待检测图像发送给图像检测设备),图像检测设备可以从该指令中获取待检测图像并执行如第一方面及第一方面任意一种可能的设计的方法。
第六方面,本申请还提供一种计算机可读存储介质,计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述各方面的方法。
第七方面,本申请还提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述各方面的方法。
第八方面,本申请还提供一种计算机芯片,芯片与存储器相连,芯片用于读取并执行存储器中存储的软件程序,执行上述各方面的方法。
附图说明
图1为本申请提供的一种图像检测***的架构示意图;
图2为本申请提供的一种图像检测方法示意图;
图3为本申请提供的一种待检测图像中***示意图;
图4为本申请提供的另一种待检测图像中***示意图;
图5为本申请提供的一种待检测图像中***所在区域的图像示意图;
图6为本申请提供的另一种待检测图像中***所在区域的图像示意图;
图7为本申请提供的***图像的角度的示意图;
图8为本申请提供的绝对像素图像中的一级像素块的示意图;
图9为本申请提供的绝对像素图像中的二级像素块的示意图;
图10为本申请提供的绝对像素图像中的三级像素块的示意图;
图11~图12为本申请提供的图像检测设备的结构示意图。
具体实施方式
本申请提供了一种图像检测方法、装置以及***,用以高效检测待检测图像。
如图1所示,为本申请实施例提供的一种图像检测***架构示意图,该***架构中包括图像检测设备100以及采集设备200,可选的,还可以包括一个或多个访问设备300。
采集设备200用于采集待检测图像,本申请实施例并不限定采集设备的设备类型,可以是具有扫描功能的复印件、扫描仪、相机、智能手机、平板电脑等,凡是可以具备图像采集功能的设备均适用于本申请实施例。对于采集设备200采集的待检测图像可以是彩色图像、也可以是黑白图像,本申请实施例并不限定。
图像检测设备100用于执行本申请实施例提供的图像检测方法,定位待检测图像中 的目标对象(如***)所在区域(简称为目标对象定位);并从目标对象所在区域中提取该目标对象的图像(简称为目标对象提取),其中包括获取目标对象所在区域的图像,提取目标对象的背景图像,从目标对象所在区域的图像去除目标对象的背景,获取目标对象的图像;基于目标对象的图像与参考图像进行比对,输出比对结果(简称为目标对象比对)。图像检测设备100可以是单个服务器,单个服务器可以兼具目标对象定位、目标对象提取以及目标对象比对的功能,图像检测设备100也可以是由多个服务器构成的服务器集群,每个服务器具体包括目标对象定位、目标对象提取以及目标对象比对中的一个或多个功能,多个服务器共同配合执行本申请实施例提供的图像检测方法。
示例性的,图像检测设备100包括定位装置110、提取装置120以及比对装置130,定位装置110用于实现目标对象定位功能,还可以将目标对象的所在区域的位置信息输入至提取装置120;提取装置120用于实现目标对象提取功能,可以将目标对象的图像输入至比对装置130,比对装置130可以实现目标对象比对功能,确定该目标对象的图像与参考图像是否一致,输出该目标对象的图像与参考图像的相似度(相似度用于表征目标对象的图像与参考图像的相似程度)。定位装置110、提取装置120以及比对装置130中的一个或多个可以部署在一个服务器中。
本申请实施例并不限定服务器的类型,示例性的,可以是超多核服务器、大型的分布式计算机、硬件资源池化的集群计算机等等,凡是可以实现标对象定位、目标对象提取或目标对象比的设备对均适用于本申请实施例。
访问设备300可以与图像检测设备100连接,能够向图像检测设备100发送指令,例如,该指令可以用于指示图像检测设备100确定待检测图像(该待检测图像可以是图像检测设备100本地保存的,也可以是访问设备300携带在所述指令中的)中的目标对象与参考图像的相似程度,也可以发送其他指令,例如用于指示定位待检测图像中目标对象所在区域的指令、用于指示提取待检测图像中目标对象的图像的指令、用于指示检测待检测图像中目标对象的指令等。可选的,访问设备300还可以具有显示功能,能够向用户呈现图像检测设备100针对指令的响应信息,访问设备300具备显示功能,也便于用户对访问设备300进行操作,触发访问设备300发送指令等等。示例性的,访问设备300可以部署在陆地上,包括室内或室外、手持或车载;也可以部署在水面上(如轮船等);还可以部署在空中(例如飞机、气球和卫星上等)。访问设备300可以是手机(mobile phone)、平板电脑(pad)、笔记本型电脑、虚拟现实(virtual reality,VR)终端、增强现实(augmented reality,AR)终端、工业控制(industrial control)中的无线终端、无人驾驶(self driving)中的无线终端、远程医疗(remote medical)中的终端等。
采集设备200可以将采集到的图像传输至图像检测设备100,访问设备300可以通过访问图像检测设备100查看采集设备200采集的图像,并针对采集设备200采集的图像向图像检测设备100发送指令。
作为一种可能的实施方式,采集设备200采集到的图像(如本申请实施例的待检测图像)可以存放在数据库中,例如该数据库可以存储在数据服务器中,也可以存储在图像检测设备中。访问设备300向图像检测设备100发送用于检测待检测图像中目标对象的指令,该指令中可以携带有待检测图像的标识等信息;图像检测设备100可以连接数据服务器,根据该指令中的待检测图像的标识等信息从该数据库中获取待检测图像。访 问设备300也可以通过图像检测设备100访问数据库中的图像,并针对数据库的图像向图像检测设备100发送指令。
作为一种可能的实施方式,采集设备200也可以与访问设备300连接,将采集到的图像发送给访问设备300,访问设备300可以查看采集设备200采集的图像,还可以向图像检测设备100发送携带有采集设备200采集的图像的指令,指示图像检测设备对指令中携带的图像进行检测,如指示比对该图像与参考图像的相似程度、定位该图像中的目标对象以及提取该图像中目标对象的图像等。
在本申请实施例中,为了能够提高图像检测精度,图像检测设备100可以先定位待检测图像中目标对象所在区域;之后,图像检测设备执行目标对象的图像提取操作,先截取目标对象所在区域的图像,根据目标对象所在区域的图像,获取目标对象的背景图像,目标对象的背景为目标对象所在区域中除去目标对象的图像,图像检测设备可以基于目标对象的背景图像,从目标对象所在区域的图像中去除目标对象的背景,生成目标对象的图像;之后对目标对象的图像与参考图像进行比对,确定目标对象的图像与参考图像的相似程度。在本申请实施例中,图像检测设备可以通过目标对象的背景图像区分目标对象所在区域中的目标对象以及目标对象的背景,可以准确的确定目标对象的图像,不仅适用于彩色图像,也适用于黑白图像,能够扩展图像检测方法的适用范围。
应需理解的是本申请实施例并不仅适用于***定位、***对比,还适用于其他场景,如特定图像的定位、比对等,下面基于如图1所示的***架构,以目标对象为***为例,对本申请实施例提供的一种图像检测方法进行说明,如图2所示,该方法包括:
步骤201:图像检测设备100定位待检测图像中***所在区域。
在该步骤中,图像检测设备100可以从待检测图像中定位***所在区域,***的所在区域包括该***,以及除该***的外的其他内容,如覆盖在***上的文字、图形、图像,以及***遮挡的文字、图形或图像等,在本申请实施例中覆盖在***上的文字、图形、图像,以及***遮挡的文字、图形或图像可称为***的背景。
在该步骤中,图像检测设备100定位待检测图像中***所在区域的方式有许多种,下面列举其中三种,下面分别进行说明。
方式一、图像检测设备100可以通过目标检测算法,定位待检测图像中的***所在区域。
本申请实施例并不限定目标检测算法的类型,目标检测算法可以是基于深度学习(Deep Learning,DL)的目标检测算法,包括但不限于区域卷积神经网络(Region convolutional neural network,R-CNN)、SSD(single shot multibox detector)、YOLO(You Only Look Once net)。
目标检测算法可以提取待检测图像的整体以及局部特征,基于提取的整体以及局部特征预测***在待检测图像的位置,进而定位***所在区域。
基于深度学习的目标检测算法可以预先进行训练,训练使用的训练集为人工标注有***所在区域的多个不同的图像;将训练集中的图像输入至目标检测算法中,通过监督学习的方式进行训练。
在该方式中,图像检测设备100定位的待检测图像中的***所在区域可以通过***所在区域的中心坐标以及***所在区域的边界坐标表征。
在本申请实施例中,***所在区域的中心可以是***的中心点,***所在区域的边界为***的外环,***所在区域的中心坐标和边界坐标是基于图像通用的坐标系(如以图像的左上角的顶点为原点,原点处相交的两条直线为坐标轴建立的坐标系)对***的中心点以及***的外环标注形成。
需要说明的是,本申请实施例并不限定***的数量,当待检测图像中存在多个***时,采用方式一可以分别确定每个***所在区域。
方式二、图像检测设备100在待检测图像中检测待检测图像中的预设图形,将待检测图像中预设图形所在区域作为***所在区域。
由于***的边界(也可以称为外环)通常为规则图形,如***的外环可以是圆形、椭圆形以及矩形等。图像检测设备100可以在待检测图像中确定是否存在预设图形,如检测图像检测设备100中是否存在圆形、椭圆形以及矩形,若待检测图像中存在预设图形,则可以将该预设图形所在区域作为***所在区域。
在本申请实施例中可以将在待检测图像中确定待检测图像中的预设图形的过程称为形状检测。
示例性的,图像检测设备100在进行形状检测时,可以先对待检测图像进行灰度,生成待检测图像的灰度图像,之后,利用霍夫变换检测待检测图像的灰度图像中的预设图形。其中,霍夫变换可以将图像的曲线(包括直线)通过曲线表达式变换为霍夫参数空间中的一个点,通过检测霍夫参数空间中的点来检测图像中的曲线。
需要说明的是,图像检测设备100可以直接将待检测图像进行灰度,生成待检测图像的灰度图像,从待检测图像的灰度图像中检测预设图形;也可以仅提取待检测图像中的特定颜色的图像(待检测图像中特定颜色的像素点构成的图像称为特定颜色的图像),之后对特定颜色的图像进行灰度,再从特定颜色的图像的灰度图像中检测预设图形;例如,若***的颜色为红色,则可以提取红色图像;若***的颜色为蓝色,则可以提取蓝色图像。
对待检测图像进行形状检测后,可以定位到待检测图像中***所在区域。可以用***所在区域的中心坐标和边界坐标表征***所在区域。***所在区域的中心坐标和边界坐标的描述可以参见前述内容,此处不再赘述。
需要说明的是,本申请实施例并不限定***的数量,当存在多个***时,采用方式二可以确定每个***所在区域。
方式三、图像检测设备100可以通过检测待检测图像中的颜色区域定位待检测图像中的***所在区域。
由于通常待检测图像中的***是由一个或多个相同颜色的颜色区域构成的,如红色***,是由多个红色区域构成。蓝色***,是由多个蓝色区域构成的。图像检测设备100可以检测在待检测图像中一个或多个距离较近的、相同颜色的颜色区域;将检测到的颜色区域作为***所在区域。
在本申请实施例中可以将检测待检测图像中的颜色区域的过程称为色块检测。图像检测设备100在进行色块检测时,可以将待检测图像映射在色彩空间中,之后提取色彩图像,该色彩图像只包括一种特定颜色的图像;之后对该色彩图像进行多个尺度的像素膨胀,生成多个像素膨胀图像。每进行一个尺度的像素膨胀,会生成一个像素膨胀图像; 对于任一像素膨胀图像,对该像素膨胀图像内的各个连通区域进行填充,填充各个连通区域内的无颜色的区域;基于该填充后连通区域的面积等于或接近于设定阈值的连通区域之间的重叠率,确定***所在区域,其中,设定阈值可以是经验值,如设定阈值可以为统计获得的***的标准面积或平均面积等。
像素膨胀指基于图像中像素点为中心的特定尺度的区域(如以图像中像素点为中心的3*3像素点构成的区域、以图像中像素点为中心的5*5像素点构成的区域)内的像素点的最大值(也就是像素点的像素值的最大值),对图像中像素点重新赋值的方式。
以像素膨胀的尺度为3个像素,对像素膨胀的方式进行简单说明:以图像A为需要进行像素膨胀的图像,对于图像A中的任一像素点B,以该像素点B为中心,在图像A中划分一个3*3像素点构成的区域,确定该区域内像素点的最大值,将该像素点B的像素值赋值为该最大值。
像素膨胀的尺度与待检测图像的大小有关,示例性的,如对于256*256的待检测图像可以选用的像素膨胀的尺度为3个像素、9个像素、15个像素中的一个或多个。
本申请实施例并不限定色彩空间的类型,该色彩空间是色调饱和度明度(hue saturation value,HSV)色彩空间、三原(red green blue,RGB)色彩空间、印刷四色(cyan magenta yellow black,CMYK)色彩空间、色调饱和度亮度(hue saturation lightness,HSL)色彩空间。
下面以待检测图像为RGB图像,色彩空间为HSV色彩空间,提取的色彩图像为红色图像为例对色块检测进行介绍。
首先,将待检测图像映射到HSV色彩空间,转换为HSV格式的图像,从该HSV格式的图像中提取红色图像,红色图像为HSV图像中像素值(如像素点的H值、S值以及V值)处于特定区间的像素点构成的图像,其中,像素点的H值处于(0-10,136-180)区间、像素点的S值处于(10-255)区间,像素点的V值处于(46-255)。上述区间的范围仅是举例,不同的场景下,对于H、S、V值的区间可以进行调整。
之后,对红色图像分别进行3像素、9像素、15像素等尺度的像素膨胀,生成对应的像素膨胀图像。
对于任意像素膨胀图像,该像素膨胀图像存在有多个像素点构成的连通区域,对于连通区域内部的空白区域,可以进行填充,填充为红色。并计算填充后的连通区域的面积,对于面积等于或接近于设定阈值的连通区域,可以计算该连通区域的中心点坐标以及边界坐标。
设定阈值可以是根据***的标准大小确定的,通常在A4纸上的***的面积大约为10平方厘米(cm 2);可以将10cm 2作为设定阈值,对于面积等于10cm 2或面积与10cm 2的差值小于1cm 2的连通区域,定位该连通区域,确定该连通区域中心点坐标和边界坐标。
对于之前定位的各个连通区域,可以通过连通区域之间的重叠率,确定连通区域内包括***的概率。当两个不同的连通区域的重叠率越高,表明这两个连通区域存在同一个***,且存在***的概率较高。
两个连通区域的重叠率等于这两个连通区域的共同区域面积与这两个连通区域构成的整体区域的面积的比值。
对于包括同一***的多个连通区域,也即重叠率较高的多个连通区域,基于该多个连通区域的中心坐标计算***所在区域的中心坐标。示例性的,可以对不同尺度的像素膨胀图像配置不同的权重,配置的权重可以是经验值,也可以是根据不同尺度下的像素膨胀图像所能反映***存在概率的精确程度设置的,如尺度越大,像素膨胀图像所能反映***存在概率的精确程度。示例性的,如3像素下的像素膨胀图像(简称3像素膨胀图像),9像素下的像素膨胀图像(简称9像素膨胀图像),15像素下的像素膨胀图像(简称15像素膨胀图像)的权重分别为3/(3+9+15、9/(3+9+15)、15/(3+9+15)。
对于包括同一***的不同像素膨胀图像的连通区域,如3像素膨胀图像的权重为权重1,3像素膨胀图像的中连通区域的中心坐标为坐标1,9像素膨胀图像的权重为权重2,9像素膨胀图像的中连通区域的中心坐标为坐标2,15像素膨胀图像的权重为权重3,15像素膨胀图像的中连通区域的中心坐标为坐标3,则该***所在区域的中心坐标=权重1*坐标1+权重2*坐标2+权重3*坐标3。
在定位***所在区域时需要确定***所在区域的中心坐标之外,还可以确定***所在区域的边界。对于包括同一***的不同像素膨胀图像的连通区域,按照各自的像素膨胀尺度进行反向腐蚀,对连通区域进行收缩,确定收缩后的连通区域的边界,这几个收缩后的连通区域的边界进行曲线拟合,拟合后的曲线为***所在区域的边界。
反向腐蚀为像素膨胀的相反过程,反向腐蚀基于以图像中像素点为中心的特定尺度的区域(如以图像中像素点为中心的3*3像素点构成的区域、以图像中像素点为中心的5*5像素点构成的区域)内的像素点的最小值(也就是像素点的像素值的最小值),对图像中像素点重新赋值的方式。
需要说明的是,本申请实施例并不限定***的数量,当存在多个***时,采用方式三可以确定每个***所在区域。另外,当待检测图像为彩色图像时,可以采用上述三种方式中的一种或多种定位***所在区域;当待检测图像为黑白图像时,可以采用方式一以及方式二中的一种或多种定位***所在区域。
通过上述三种方式,每种方式均可以定位***所在区域,为了提高定位***所在区域的准确率,可以综合上述三种方式所定位的***所在区域,根据三种方式所定位的***所在区域之间的重叠率,精确定位***所在区域。
为方便说明将通过方式一定位的***所在区域称为第一区域,将通过方式二定位的***所在区域称为第二区域,将通过方式三定位的***所在区域称为第三区域。
图像检测设备100可以通过第一区域、第二区域以及第三区域确定***所在区域的中心坐标以及边界坐标。
示例性的,图像检测设备100可以对第一区域的边界、第二区域的边界以及第三区域的边界进行曲线拟合,确定***所在区域的边界(为方便说明简称边界1),进而可以确定***所在区域的边界坐标。曲线拟合是指将多个不同的曲线合并为一条曲线的过程。
图像检测设备100在对第一区域的边界、第二区域的边界以及第三区域的边界进行曲线拟合时,图像检测设备100可以通过预设的比例值对第一区域的边界、第二区域的边界以及第三区域的边界进行曲线拟合;其中,第一区域、第二区域以及第三区域中每个区域对应一个比例值,图像检测设备100可以根据每个区域的边界以及对应的比例值 的乘积之和,确定***所在区域的边界。也就是说,一个区域的比例值可以指示该区域的边界在确定***所在区域的边界时所占的比重,本申请实施例并不限定比例值的设置方式,是经验数值,也可以是根据上述三种定位***所在区域的方式的检测精度确定的数值。示例性的,第一区域、第二区域以及第三区域对应的比例值,分别为20%、30%以及50%。
图像检测设备100可以根据第一区域的中心坐标、第二区域的中心坐标以及第三区域的中心坐标确定***所在区域的中心坐标;可以为第一区域的中心坐标、第二区域的中心坐标以及第三区域的中心坐标配置权重,通过各个区域的中心坐标与对应权重的乘积之和确定***所在区域的中心坐标。配置的权重可以是根据上述三种方式的检测精度确定的,也可以是根据三种方式定位的区域的边界与曲线拟合后确定的***所在区域的边界的偏移程度确定的,还可以是根据三种方式定位的区域的中心与边界1所围成区域的中心的偏移程度确定的。
需要说明的是,上述说明是以待检测图像为彩色图像为例进行说明,若待检测图像为黑白图像,则不存在第三区域,也可以采用上述相似的方式确定***所在区域的边界以及***所在区域的中心坐标,区别在于不需要第三区域的边界以及中心坐标参与计算,配置的权重可以根据具体场景确定,本申请实施例并不限定。
由于待检测图像中的***的呈现状态不清晰以及上述三种方式的检测精度不同,会导致采用上述三种方式确定第一区域、第二区域以及第三区域存在偏差。
在加盖***时,由于人为原因或纸张影响,可能导致待检测图像中的***可能与纸张中的其他图形距离较近,可能会使得采用上述三种方式确定的***所在区域存在偏差,示例性的,如图3所示,待检测图像中的***附近存在指纹,对于如图3所示的待检测图像中的***,可能导致上述三种方式中的一种或多种不能准确的定位***所在区域。例如,采用方式一,定位两个第一区域,分别为301A(***所在区域)和301B(指纹所在区域);采用方式二,也定位两个第二区域,分别为302A(***所在区域)和302B(指纹所在区域);若指纹颜色与***颜色相近,采用方式三,会定位一个第二区域303。
其中,方式三定位出错,为此,需要剔除上述三种方式定位的区域中定位出错的区域。需要说明的是,如图3仅示出了其中一种可能的情况,对于待检测图像中***中断、***模糊、颜色浅淡等也可以存在导致上述三种定位方式出现偏差。
又例如,如图4所示,可以在一个文件中加盖两个不同的***,如检测章1以及检测章2,这两个***在加盖时,可以叠加盖章,检测章1以及检测章2之间存在重叠。
对于如图4所示的待检测图像中的***,可能导致上述三种方式中的一种或多种不能准确的定位。例如,采用方式一,可能会定位两个第一区域,分别为401A和401B;采用方式二可能会定位到两个第二区域,分别为402A和402B,采用方式三可能会定位到一个第三区域403,方式二和方式三定位出错;为此,需要剔除上述三种方式定位的区域中定位出错的区域。
需要说明的是,为了便于绘制,如图3和图4中第一区域、第二区域以及第三区域分为矩形区域,实际上,第一区域、第二区域以及第三区域可以与***边界相吻合的区域,例如也可以为椭圆形;也可以是比***稍大的区域。
另外,由于待检测图像中可能存在多个不同的***,图像检测设备100还可以对上 述三种方式确定的区域进行归类,将包括同一个***的第一区域、第二区域以及第三区域划分为一组。图像检测设备100可以通过第一区域、第二区域以及第三区域之间的重叠率确定包括同一个***的概率。如果重叠率大于第一设定值,则认为包括同一个***,否则不包括,第一设定值的具体数值本申请实施例并不确定,可以为经验数值,也可以根据图像检测所要求的精确度确定,例如,若精确度较高,可以设置较大的数值作为设定值。
综上,在图像检测设备100在根据第一区域、第二区域以及第三区域定位***所在区域时,需要执行剔除操作和分组操作,在执行了这两个操作后,图像检测设备100可以根据属于一个组的第一区域、第二区域以及第三区域定位***所在区域。下面对这种操作进行说明:
操作1、剔除操作。
计算预设范围内,第一区域、第二区域以及第三区域中各个区域的面积与标准值的大小关系,以及各个区域之间的包含关系剔除不满足预设条件的区域。预设范围可以是根据第一区域、第二区域以及第三区域在待检测图像中的分布情况确定的,待检测图像中第一区域、第二区域以及第三区域中分布较为密集的区域作为预设范围,本申请实施例中并不限定预设范围的数量,可以待检测图像中第一区域、第二区域以及第三区域中分布较为密集的多个区域分别作为一个预设范围,对于一个预设范围内的第一区域、第二区域以及第三区域可以进行分组。
相邻的两个区域是指两个区域的中心之间的距离小于这两个区域中任一区域的边界到该区域中心的距离。
预设条件可以为下列两个条件中的一个或两个,下面分别对这两个条件进行说明:
预设条件1:区域面积小于标准值、区域包含在一个或多个其他区域。这里,区域以及其他区域为第一区域、第二区域、以及第三区域中的任一区域。其中标准值可以是标准***的面积,也可以是根据设定区域内,第一区域、第二区域以及第三区域的面积确定的,如可以将设定区域内,第一区域、第二区域以及第三区域的面积的均值作为标准值。
区域面积的计算可以利用区域的边界坐标以及区域的中心坐标进行计算,也将以区域中心作为圆心、区域中心到区域边界最大的距离为半径的圆的面积近似作为区域面积。
通过不同方式定位的第一区域、第二区域以及第三区域之间存在包含关系,但由于上述三种方式的精确程度不同,在一个***附近或覆盖有其他干扰图形(如指纹)等情况下,其中一种或多种方式,将该***定位为至少两个区域(如图3中的301A或302B)。
以图3为例,第一区域301B以及第二区域302B的面积明显小于标准***面积,且均包含在第三区域303中,可以剔除第一区域301B以及第二区域302B。
作为一种可能的实施方式,预设条件1也可采用区域的直径的方式进行表述,示例性的,预设条件1可以表述为区域直径小于标准直径,该区域与其他区域的中心之间的距离小于其他区域的直径的一半或四分之一。标准直径可以是标准***的直径,也可以是根据设定区域内,第一区域、第二区域以及第三区域的直径的均值确定的。本申请实施例并不限定其他预设条件1的表述方式,凡是可以指示去除第一区域、第二区域以及 第三区域中面积较小、以及包含在其他区域的表述方式均适用于本申请实施例。
预设条件2:区域面积大于标准值、区域内包括一个或多个其他区域。这里,区域以及其他区域为第一区域、第二区域、以及第三区域中的任一区域。标准值可以参见预设条件1的说明,此处不再赘述。
由于上述三种方式的精确程度不同,在多个***交叠的情况下,其中一种或多种方式,将多个***定位为一个区域(如图4中的403)。
以图4为例,第三区域403面积明显大于标准***面积,且包含第一区域401A以及第一区域401B,还包括第二区域402B以及第二区域402B,可以剔除第三区域403。
作为一种可能的实施方式,预设条件2也可采用区域的直径的方式进行表述,示例性的,预设条件2可以表述为区域直径大于标准直径,该区域与其他区域的中心之间的距离大于该区域的直径的一半或四分之一。标准直径可参见前述内容,此处不再赘述。本申请实施例并不限定其他预设条件2的表述方式,凡是可以指示去除第一区域、第二区域以及第三区域中面积较大、以及包含其他区域的区域表述方式均适用于本申请实施例。
操作2、分组操作。
计算预设范围内,第一区域、第二区域以及第三区域中相邻的两个区域之间的重叠率,将待检测图像中预设范围内,相邻的两个区域之间的重叠率大于第一阈值的区域划分在一个组,将重叠率小于或等于第一阈值的区域划分在不同的组。第一阈值可以是一个经验值,也可以是根据上述定位待检测图像中***所在区域的三种方式的精确程度确定的,若上述三种方式的精确程度较高,则可以设定一个较高的值(如80%),否则,可以选择相对较小的值(如70%)。也就是说,属于同一个组的任意两个区域的重叠率大于第一阈值。
在分组时,除了根据重叠率,还可以根据两个相邻区域的中心之间的距离进行分组,示例性的,图像检测设备100可以比较两个相邻区域的中心之间的距离与第二设定值的大小关系,若大于第二设定值,将相邻的两个区域之间的中心之间的距离大于第二设定值的区域划分在不同的组,将距离小于或等于第二设定值的区域划分在同一组。第二设定值可以是根据***的大小确定的,示例性的,第二设定值为***直径的一半或四分之一。
也就是说,属于同一个组的任意两个区域的中心之间的距离小于等于第二设定值。
在进行分组操作时,也可以结合待检测图像中预设范围内,相邻的两个区域之间的重叠率以及两个相邻区域的中心之间的距离进行分组;示例性的,可以将待检测图像中预设范围内,重叠率大于第一阈值,且两个区域之间的中心之间的距离小于或等于第二设定值的区域划分在同一组;可以将待检测图像中预设范围内,重叠率小于或等于第一阈值,且两个区域之间的中心之间的距离大于第二设定值的区域划分在不同组。
也就是说,属于同一个组的任意两个区域的重叠率大于第一阈值,任意两个区域的中心之间的距离小于等于第二设定值。
需要说明的是,在执行上述两个操作时,均需要计算两个区域的面积,对于剔除操作,在计算面积时,可以将区域中心到区域边界最大距离作为半径,区域中心作为圆心,将该圆的面积近似为该区域的面积,这样,可以加快区域面积的计算效率,进而可以较 为快速的执行剔除操作。对于分组操作,涉及到两个***可能交叠的情况,在计算重叠率时,可以准确计算各个区域(如第一区域、第二区域以及第三区域)的面积,可以提高分组操作的准确性。另外,关于剔除操作与分组操作的说明是以待检测图像为彩色图像为例进行说明,若待检测图像为黑白图像,则不存在第三区域,也可以采用上述相似的方式执行剔除操作以及分组操作,区别在于不需要第三区域参与。
步骤202:图像检测设备100从待检测图像中截取***所在区域的图像。
图像检测设备100截取***所在区域的图像中除***外,还可以包括***的背景图像,如覆盖在***上的文字、图形、图像、以及***遮盖的文字、图形、图像。
图像检测设备100可以直接根据步骤201中定位的区***所在区域截取***所在区域的图像,也可以采用其他方式截取***所在区域的图像,示例性的,如利用图像分割算法或色域检测算法截取***所在区域的图像,通过图像分割算法或色域检测算法的方式,均可以较好的减少***所在区域的图像中包括的***背景。
下面分别对图像分割算法或色域检测算法进行介绍。
一、图像分割算法。
图像检测设备100利用图像分割算法从***所在区域分割***所在区域的图像,图像检测设备100在利用图像分割算法截取***所在区域的图像时,可以从待检测图像中截取矩形区域,该矩形区域的中心与***所在区域的中心重合,该矩形区域包括***所在区域。将该矩形区域作为图像分割算法的输入值,根据图像分割算法的输出值确定***所在区域的图像。
需要说明的是,***所在区域可以步骤201中第一区域、第二区域以及第三区域任一区域,也可以是综合第一区域、第二区域确定的***所在区域(对应待检测图像为黑白图像或彩色图像的情况),还可以是综合第一区域、第二区域以及第三区域确定的***所在区域(对应待检测图像为彩色图像的情况),综合第一区域、第二区域确定的***所在区域以及综合第一区域、第二区域以及第三区域确定的***所在区域可参见步骤201中的相关描述此处不再赘述。
本申请实施例并不限定图像分割算法的类型,图像分割算法可以是基于深度学习的图像分割算法,包括但不限于U型神经网络(U-Net)、掩膜区域卷积神经网络(mask region convolutional neural network,Mask-RCNN)、语义分割网(semantic segmentation net,SegNet)。
图像分割算法可以对***所在区域中的每一个像素点进行分类,确定***的像素点(待检测图像中处于***中的像素点)以及非***的像素点(待检测图像中除***的像素点外的其他像素点),进而提取***所在区域的图像。矩形区域的原始图像(矩形区域的原始图像为直接根据***所在区域的边界坐标截取包含***所在区域的图像)可以作为图像分割算法的输入,图像分割算法可以输出分割结果,示例性的,图像分割算法可以输出一个矩阵,矩阵中的一个元素可以标注矩形区域的原始图像对应的一个或多个像素点为***的像素点的概率。根据矩阵中各个元素的值可以判断出***的具***置,进而提取***所在区域的图像。图像检测设备100通过图像分割算法获取的***所在区域的图像为一个二值图像,该图像中的像素点的像素值只有0和1这两种可能的取值, 在本申请实施例中以图像分割算法获取的***所在区域的图像中,1表征该像素点为***像素点,0表征该像素点为非***像素点为例进行说明。
示例性的,若矩形区域的原始图像大小为256*256像素(实质上,也可以看做为256*256的矩阵,矩阵上每个元素表征一个像素点),图像分割算法可以相应的输出一个256*256的矩阵,该矩阵中的一个元素可以表征***所在区域的图像中一个的像素点属于***的概率,矩阵中元素与矩形区域的图像的像素点的对应关系时预先设定好的。上述举例中,是以矩形区域的图像与图像分割算法输出的矩阵一致,这样可以达到较高的提取精度;作为一种可能的实施方式,图像分割算法输出的矩阵也可以比矩形区域的原始图像的矩阵小,这样,图像分割算法输出的矩阵中的一个元素可以表征矩形区域的图像中对应的多个像素点为***的像素点概率。例如,图像分割算法可以相应的输出一个128*128的矩阵,该矩阵中的一个元素可以表征矩形区域的图像中的对应的4个像素点为***的像素点的概率。
基于深度学习的图像分割算法可以预先进行训练,训练使用的训练集中可以包括下列两种数据中的一种或两种。
第一种,包括***的图像,该种图像中每个像素点都已做了标注,标注该像素点为***的像素点,或该像素点不为***的像素点。
第二种,***的模拟图像,***的模拟图像模拟***在图像中各种可能的呈现方式,例如,图3所示的***附近存在指纹以及图4所示的***重叠。除图3、图4之外还有其他不同类型的呈现方式。可以在空白图像上绘制***,并对***进行旋转、对比度调整、透明度调整、噪声叠加(添加噪点,例如夜间照片中的小亮点)以及颜色调整等,形成各种可能的***在待检测图像中的呈现方式。除了上述调整方式之外,还可以模拟覆盖***或***所遮盖的文字、图形以及图像,收集各种文字、表格以及图像等数据,将收集到的数据覆盖在***上,或作为***所遮盖的部分,添加到模拟图像中,形成各种可能的***在待检测图像中的呈现方式。
本申请实施例并不限定***的模拟图像的数量,可以采用上述方式尽可能多的生成***的模拟图像,以便增大训练集中包括的图像的数量,提高图像分割算法的训练精度,以使得图像检测设备100可以通过图像分割算法可以较为精确的截取***所在区域的图像。
方式二、色域检测算法。
色域检测算法是将***所在区域映射在色彩空间后,提取与***颜色相同的像素点,进而获取***所在区域的图像。
图像检测设备100在利用色域检测算法提取***所在区域的图像时,可以截取包括***所在区域的矩形区域,该矩形区域的中心与***所在区域的中心重合,图像检测设备100可以将该矩形区域映射在色彩空间中,根据***所在区域的边界去除该矩形区域内***所在区域之外的像素点,只对提取***所在区域内与***颜色相同的像素点,获取***所在区域的图像。
需要说明的是,***所在区域可以步骤201中第一区域、第二区域以及第三区域任一区域,也可以是综合第一区域、第二区域确定的***所在区域(对应待检测图像为黑白图像或彩色图像的情况),还可以是综合第一区域、第二区域以及第三区域确定的印 章所在区域(对应待检测图像为彩色图像的情况)。
以色彩空间为HSV空间为例,对于***所在区域中同一饱和度以及明度范围内的像素点,各个像素点的色调不一定相同,同一饱和度以及明度范围内、不同色调的像素点的数量不同,图像检测设备100可以通过色域检测算法提取与***相关的饱和度以及明度范围内、不同色调的像素点,综合任一饱和度以及明度范围内、不同色调的像素点的像素值以及分布情况,对像素点进行取舍,之后根据保留的像素点生成***所在区域的图像。
作为一种可能的实施方式,为了能够更加高效的确定同一饱和度以及明度范围内、不同色调的像素点的分布情况,可以根据各个像素点的色调将一个饱和度以及明度范围内的色调划分为多个分段,每个分段对应一个色调范围。图像检测设备100可以通过色域检测算法确定与***相关的饱和度以及明度范围内、不同分段的像素点的分布情况,综合该饱和度以及明度范围内、不同分段的像素点的像素值以及分布情况,对各个分段进行取舍,例如可以去掉像素点分布较少的分段,保留像素点分布较多的分段,之后根据保留各个分段的像素点获取***所在区域的图像。
下面以***所在区域的图像为RGB图像,色彩空间为HSV色彩空间,提取的红色分量为例对色域检测算法的执行过程进行介绍。
首先,图像检测设备100将矩形区域的图像映射到HSV色彩空间,转换为HSV格式的图像,从该HSV格式的图像中提取颜色为红色的像素点;示例性的,可以对颜色为红色的像素点分段提取,可以分5个分段进行提取,各个分段的像素点的HSV的值(HSV值为HSV空间下的像素点的像素值)分别为第一段S(10-255),V(46-255),H(136-150);第二段S(10-255),V(46-255),H(150-160);第三段S(10-255),V(46-255),H(160-170);第四段S(10-255),V(46-255),H(170-180);第五段S(10-255),V(46-255),H(0-10)。分段的数量以及每段的阈值可以为经验值,也是根据场景中颜色的分布情况配置的。
图像检测设备100统计各个分段中像素点的数量,可以只保留其中像素点数量最多的部分分段中的像素点;通常一个颜色、不同色调的像素点的分布为正太分布,选取其中分布较多的像素点,是可以较为完整的表征***所在区域的图像中的颜色;在本申请实施例中,图像检测设备100可以选取像素点分布较多的三个分段,进行叠加,生成***所在区域的图像。
图像检测设备100通过色域检测算法获取的***所在区域的图像也可以为一个二值图像,该图像中的像素点的像素值只有0和1这两种可能的取值,在本申请实施例中以色域检测算法获取的***所在区域的图像中,1表征该像素点为***像素点,0表征该像素点为非***像素点为例进行说明。
上述两种方式中均需要从待检测图像中截取包括***所在区域的矩形区域,可以截取的矩形区域可以相同的,也可以不同;本申请实施例并不限定截取的矩形区域的数量,当确定待检测图像中的目标对象所在区域的数量为1个时,截取一个矩形区域;当确定待检测图像中的目标对象所在区域的数量为多个时,截取多个矩形区域,每个矩形区域包括一个目标对象所在区域。
应需理解的是,上述两种方式获取***所在区域的图像的精度不同,例如,通过色 域检测算法获取的***所在区域的图像可能包括***边缘的其他红色区域,也可能包括覆盖***的其他红色区域;通过图像分割算法获取的***所在区域可能缺少***被覆盖的部分图像,也可以补全了***被覆盖的部分图像;为此需要将***所在区域的图像中不属于***的部分去除。
步骤203:图像检测设备100根据***所在区域的图像,获取***的背景图像。***的背景图像为***所在区域中出除***的图像。
图像检测设备100可以对***所在区域的图像进行灰度,生成***所在区域的图像的灰度图像,基于***所在区域的图像的灰度图像,区分***所在区域中的***、以及***背景;生成***的背景图像。步骤203中的***所在区域的图像可以是根据***所在区域的边界坐标直接从待检测图像中截取的图像。
作为一种可能的实施方式,图像检测设备100也可以基于采用图像分割算法和采用色域检测算法获取的***所在区域的图像,获取***的背景图像;为方便说明,将通过图像分割算法获取的***所在区域的图像称为第一图像,将通过色域检测算法获取的***所在区域的图像称为第二图像。图像检测设备100可以将第一图像和第二图像进行整合,根据第一图像在待检测图像中的位置与第二图像在待检测图像中的位置,从待检测图像中截取覆盖第一图像与第二图像在待检测图像的区域的图像(为方便说明,简称为第三图像);图像检测设备100可以对第三图像进行灰度,生成第三图像的灰度图像,基于第三图像的灰度图像,区分***所在区域中的***、以及***背景,生成***的背景图像。
无论是对***所在区域的图像进行灰度,还是对第三图像进行灰度,之后,图像检测设备100均需要通过灰度图像,区分***所在区域的***以及***背景。
下面以进行灰度的图像为第三图像为例,对区分***所在区域中的***以及印象背景的方法进行说明。
图像检测设备100可以根据第三图像的灰度图像的灰度分布情况,对第三图像进行二值化操作,具体的,可以计算该第三图像的灰度图像的平均灰度,平均灰度可以表征对该第三图像灰度后,***在第三图像的灰度图像中的平均灰度值,根据偏置值对第三图像的灰度图像中像素点划分区间;偏置值可以表征对该第三图像灰度后,***在第三图像的灰度图像中的最大灰度值或最小灰度值与平均灰度的偏移量。示例性的,平均灰度可以为150,偏置值为30,130为对该第三图像灰度后,***在第三图像的灰度图像中的平均灰度值,平均灰度150与偏置值30的差可以表征对该第三图像灰度后,***在第三图像的灰度图像中的最小灰度值,最小灰度值为120,平均灰度120与偏置值30的差可以表征对该第三图像灰度后,***在第三图像的灰度图像中的最大灰度值180;换句话说,对该第三图像灰度后,***在第三图像的灰度图像中的灰度值取值范围在120到180之间,其余灰度值可以认为是非***像素点的灰度值。对于其余灰度值中,像素点的灰度值较高表征该像素点的颜色较深,表征此处存在图像、文字、图形,可以认为是***背景;像素点的灰度值较低表征该像素点的颜色较浅,表征此处空白。
对于第三图像的灰度图像中像素点的灰度值大于***最大灰度值的像素点,将第三图像中相同位置的像素点的值赋值为1,表征此处为***背景;第三图像剩余像素点的像素值的值赋值为0,表征此处空白或者为***的像素点。第三图像进行二值化的图像 即为***的背景图像。
步骤204:图像检测设备100从***所在区域的图像中去除***的背景,生成***图像。
图像检测设备100在获取***的背景图像后,可以根据基于***的背景图像,从步骤203中获取的***所在区域的图像,确定***所在区域的图像中为***的背景,并进行去除。
若步骤203中获取的***所在区域的图像,为直接根据***所在区域的边界坐标截取的图像、图像检测设备100可以直接比对***的背景图像与***所在区域的图像中相同位置的像素点的值,从***所在区域的图像中去除与***的背影图像中非零像素点相同位置的像素点,去除了这些像素点的图像即为***图像。
需要说明的是,由于在获取***的背景图像时,采用了灰度以及对第三图像进行二值化的操作方式,可能会因为根据灰度值划分像素点区间时,偏置值的选择存在偏差,可能会忽略了部分***背景,或将***的部分区域当做***背景,使得***的背景图像并不能较为精确的表征***背景,这里基于***的背景图像获取的***图像可能存在一些误差,但较原先的***所在区域的图像,***图像可以较为完整的、清晰的表征***,包含少量的***背景,甚至不包含***背景。这样在后续基于***图像与参考图像比对时,也可以获得更加准确的比对结果。
类似的,若步骤203中获取的***所在区域图像为采用图像分割算法获取的第一图像、或采用色域检测算法获取的第二图像,也可以采用上述方式从***所在区域的图像获取***图像。
应需理解的是,由于在获取第一图像的过程中借助了基于深度学习的图像分割算法,而基于深度学习的图像分割算法若在训练时,训练集中的数据包括第二种数据,训练完成的图像分割算法能够对***所在区域中***被覆盖的部分进行恢复;例如,如图5所示,***所在区域中的***为检测章,该检测章被***所在区域的一个图形A所覆盖,采用基于深度学习的图像分割算法,***中被图形A所覆盖的部分还原,恢复到与标准***相同或相似。也可能存在基于深度学习的图像分割算法对***被覆盖的一些部分,不能进行恢复,这与基于深度学习的图像分割算法的训练精度有关。
但基于深度学习的图像算法可能存在过度恢复的情况,也就是说,若***所在区域中的***没有被覆盖的部分,基于深度学习的图像算法可能对***进行过度补全;例如,如图6所示,***所在区域的***为检测章,检测章的外环存在一定的宽度,检测章的外环中有空白部分B,该空白部分B是标准***就存在的,基于深度学习的图像算法可能会认证该空白部分B是***被覆盖的部分,而将该空白部分B填充,这样提取的第一图像与标准***存在差别。
而图像检测设备100通过色域检测算法获取第二图像时,提取了与***相关的颜色的像素点;第二图像可以较好的表征除***没有被覆盖的部分,对于***被覆盖的部分的表征较差。
综上,第一图像和第二图像也可能存在一定的偏差,为了可以更加精确的获取***图像,图像检测设备100可以基于***的背景图像、第一图像以及第二图像,区分***所在区域中***未被覆盖的部分、以及***被覆盖的部分,进而获取***图像。由于印 章的背景图像、第一图像以及第二图像均为二值化图像,在区分了***所在区域中***未被覆盖的部分、以及***被覆盖的部分后,可以通过对***像素点的像素值赋1,非***像素点的像素值赋0的方式获取***图像,这样,***图像也为二值化图像。
示例性的,对于***的背景图像、第一图像以及第二图像中相同位置的像素点,若***的背景图像中该像素点的值为1(表明该像素点为***的背景),第一图像中该像素点的值为1值(表明第一图像中指示该像素点为***像素点),第二图像中该像素点的值为0(表明第二图像中指示该像素点不为***像素点),也就是说,该像素点为***被覆盖的部分,不属于***背景,该像素点为***像素点。若***的背景图像中该像素点的值为0(表明该像素点不是***的背景),第一图像中该像素点的值为1值(表明第一图像中指示该像素点为***像素点),第二图像中该像素点的值为0(表明第二图像中指示该像素点不为***像素点),也就是说第一图像中存在过度恢复的情况,该像素点并非***像素点。若***的背景图像中该像素点的值为0(表明该像素点不是***的背景),第一图像中该像素点的值为0值(表明第一图像中指示该像素点不为***像素点),第二图像中该像素点的值为1值(表明第二图像中指示该像素点为***像素点),也就是说第一图像中没有较好的对该像素点进行恢复,该像素点为***像素点。采用上述方式,图像检测设备100可以较好的区分出图像所在区域的***像素点,进而可以通过第一图像和第二图像中获取***图像。
步骤202~步骤204为图像检测设备100执行的***图像提取操作。
步骤205:图像检测设备100获取***图像后,可以与参考图像进行比对,确定***图像与参考图像的相似程度。
本申请实施例并不限定参考图像的类型,参考图像可以是***的标准图像,也就是***的完整、且不存在***背景的图像,如可以建立***库,该***库中包括一个和多个***的标准图像,图像检测设备100可以***图像与***库中任一***的标准图像进行比较,确定与***图像相似度较大***的标准图像。
参考图像也可以是图像检测设备100从其他图像中获取的另一个***图像,例如,图像检测设备100需要比对图像1中***与图像2中***的相似程度,图像检测设备100将图像2中获取的***图像作为参考图像,与图像1中的***图像进行比对。图像检测设备100从图像2中获取的***图像的方式本申请实施例并不限定,可以采用步骤201~204的步骤提取图像2中的***图像,也可以采用其他方式。
通常,在文件上加盖***时,***的角度有一定的随机性,如图7所示,在待检测图像中的***的中心线与水平线的夹角并不是九十度,大于九十度;而通过步骤202~204提取的***图像中***的中心线与水平线的夹角是与待检测图像中的是相同的。但若参考图像中的***的中心线与水平线垂直,为比对***图像与参考图像,需要对***图像和参考图像进行转换,如旋转等,使得***图像中***的中心线与参考图像中***的中心线是相重叠或相平行的,在***图像中***的中心线与参考图像中***的中心线是相重叠或相平行的情况下,才可以较为准确的确定***图像以及参考图像的相似程度。图7所示仅是以***的中心线与水平线的夹角来衡量***图像中***以及参考图像中***的角度为例进行说明,本申请实施例并不限定衡量***图像中***以及参考图像中***的角度的方式,例如还可以通过***的特定图形在***中的位置来衡量***图像中*** 以及参考图像中***的角度;如对于一些***中存在固定的文字,如“公司”、“章”等,可以通过这些固定文字在***图像以及参考图像中的位置来衡量***图像中***以及参考图像中***,如图7所示,***图像中的“章”位于***图像的上方,参考图像中的“章”位于参考图像中的右侧,***图像的***与参考图像中的***存在90度的角度差。
应需理解的是,如图7仅是示出了待检测图像中***的一种呈现方式,除图7所示的呈现方式外,还可以其他呈现方式,如***还可能存在形变。
在执行步骤205时,图像检测设备100可以先对***图像进行旋转,旋转至与参考图像相同或相似的角度,之后,再基于旋转后的***图像与参考图像进行比对。
可选的,图像检测设备100还可以对***图像进行拉伸,保证目标对象的图像与参考图像大小一致。
图像检测设备100可以通过***图像与参考图像中的特征点,确定***图像中的***与参考图像中***之间的相对位置,基于***图像与参考图像中的特征点,对***图像进行旋转(对应***图像和参考图像中***的角度不一致,通过旋转使其角度一致或相似)以及拉伸(对应***图像和参考图像中***存在形变,通过拉伸使***图像和参考图像中的***形状一致或相似)。
本申请实施例中,并不限定图像检测设备100提取***图像与参考图像中的特征点的方式,例如,可以采用尺度不变特征变换算法(scale-invariant feature transform,SIFT)、SURF(speeded up robust features)、ORB(ORiented Brief)、FAST(features from accelerated segment test)等算法。
在基于旋转后的***图像与参考图像进行比对,可以分别比对旋转后的***图像与参考图像差异,确定***图像与参考图像的相似程度。
图像检测设备100可以通过比对旋转后的***图像与参考图像主体结构、图像纹理、像素点、角度中的部分或全部,确定***图像与参考图像的相似程度。
下面分别对主体结构、图像纹理、像素点以及角度差异,以及对应的比对方法进行说明:
一、主体结构。
主体结构为图像的结构特征,主体结构可以表征为图像的特征点之间的相对位置,以及比例大小等信息。
图像检测设备100在比对***图像与参考图像的主体结构时,可以采用结构相似算法,本申请实施例并不限定结构相似算法的类型,结构相似算法包括但不限于离散余弦变换(discrete cosine transform,DCT)、感知哈希、结构相似性算法(structural similarity index,SSIM)算法。将结构相似算法的输出值作为比对***图像与参考图像的主体结构的结果值。
二、图像纹理。
图像纹理用于指示图像中的细节信息,图像中存在的波纹、曲线、折角等。
图像检测设备100可以提取***的图像的特征点和参考图像的特征点,再通过***图像的特征点与参考图像的特征点的匹配关系确定***图像与参考图像的图像纹理差异。
***图像的特征点之间的相对位置以及相对距离与参考图像的特征点之间的相对位置以及相对距离相同或相似,则可以认为***图像的特征点与参考图像的特征点的匹配,否则,认为***图像的特征点与参考图像的特征点的不匹配;可以通过***图像的特征点与参考图像的特征点的匹配关系较好的特征点占总特征点(***图像的特征点和参考图像的特征点的总和)的比例,作为***图像与参考图像的图像纹理差异进行比对结果值,需要说明的是,上述方式仅是举例,本申请实施例并不限定表征***图像与参考图像的图像纹理差异的方式。
本申请实施例中,并不限定图像检测设备100提取旋转后***图像与参考图像中的特征点的方式,例如,可以采用SIFT、SURF、ORB、GIST等算法。
区别于主体结构种的图像特征点,比对***图像与参考图像的图像纹理所提取的特征点为能够反映图像细节信息的特征点,如可以提取这两个图像中一些细小波纹、曲线上的特征点。而比对***图像与参考图像的主体结构所提取的特征点为能够反映图像中整体结构的特征点。
三、像素点。
任一图像包括多个像素点,每个像素点有像素值,在比对旋转后的***图像和参考图像时,可以通过比较这两个图像相同位置的像素点,确定这两个图像的相似程度。
像素点的比较方式有两种,下面分别进行说明。
1、绝对像素。
绝对像素是指旋转后的***图像和参考图像相同位置的像素点的像素差值。
图像检测设备100可以计算旋转后***图像和参考图像相同位置上两个像素点的像素差值,生成绝对差值图像,绝对差值图像上的一个像素点的像素值为***的图像相同位置的像素点与参考图像相同位置的像素点的像素差值。根据绝对差值图像上的像素差值分布计算像素分布概率作为比对***图像与参考图像的像素点的一个结果值。
由于***图像为二值化图像,参考图像也为二值化图像,相应的,绝对差值图像同样为二值化图像,绝对差值图像的像素分布概率可以等于指示该绝对值图像中像素值为1的像素点所占的比例,比例越大,表明旋转后***图像和参考图像的差异越大。
2、像素块。
图像检测设备100可以比对旋转后***图像与参考图像中相同位置的像素块的差异,进而确定***图像与参考图像的相似程度,像素块由相邻的多个像素点构成。
本申请实施例并不限定像素块的大小,不同大小的像素块,反映的旋转后***图像与参考图像之间的差异信息也不同。例如,较小的像素块,可以反映旋转后***图像与参考图像中细节的差异信息;较大的像素块,可以反映旋转后***的图像与参考图像中整体结构的差异信息。
在进行像素块比较时,可以基于绝对差值图像,根据绝对差值图像中不同大小的像素块与像素阈值的大小关系,确定***图像与参考图像的相似程度。
下面对像素块比较的执行过程进行介绍。
首先,划分像素块;将绝对像素图像分割成多个一级像素块(如4个像素点构成的像素块称为一级像素块),如图8所示,将相邻的4个像素点构成一个一级像素块(可以看做选取规则),以一个像素为步进距离,按照相同的选取规则,从绝对值图像中分 割出其他一级像素块;计算一级像素块中像素值为1的像素点占总像素点的比例,作为该一级像素块的差异值。
之后,再将一级像素块组合成二级像素块(如二级像素块由4个相邻一级像素块构成,也就是包括16个像素点),本申请实施例不限定选取二级像素块的选取规则方式,可以以4个彼此相邻的一级像素块构成一个二级像素块,也可以是两两相邻的一级像素块构成一个二级像素块;如图9所示,将相邻的4个一级像素块构成一个二级像素块(可以看做选取规则),以两个像素为步进距离,按照相同的选取规则,从绝对值图像中分割出其他二级像素块;计算二级像素块中像素值为1的像素点占总像素点的比例,作为该二级像素块的差异值。
之后,可以采用类似的方式,将二级像素块组合成一个三级像素块,如图10所示,将相邻的4个二级像素块构成一个三级像素块(可以看做选取规则),以4个像素为步进距离,按照相同的选取规则,从绝对值图像中分割出其他三级像素块;计算二级像素块中像素值为1的像素点占总像素点的比例,作为该三级像素块的差异值。
类似的,还可以将多个三级像素块构成四级像素块。通过上述方式划分的同一等级像素块(如一级像素块、二级像素块、三级像素块或四级像素块等)需要覆盖绝对像素图像中像素点的像素值不为零的所有像素点。
上述截取各个不同大小像素块的方式仅是举例,本申请实施例并不限定;例如,可以采用其他选取规则,或步进距离选取不同大小的像素块。
以图9~图11的划分方式,一级像素块以及二级像素块可以表征***图像和参考图像中***上的文字、以及图形的细节差异;三级像素块以及四级像素块可以表征***图像和参考图像中***上的文字、以及图形的整体差异。
基于不同等级像素块的差异值,大于阈值的差异值中,选择像素块等级(像素块的大小)最大的差异值的最大值作为像素块比较的结果值。
四、角度。
虽然***图像经过选择或拉伸之后,可以与参考图像保持相似角度或相似形状,但可能存在不完全一致的情况,图像检测设备100可以对比旋转后的***图像与参考图像的角度差异,示例性的,图像检测设备100可以提取旋转后的***图像与参考图像的特征点,计算进行旋转以及拉伸后的***图像和参考图像的仿射变化矩阵,根据放射变化矩阵确定旋转以及拉伸后的***图像和参考图像的角度差异。仿射变化矩阵用于指示将旋转后的***图像与参考图像的特征点的角度差异。
图像检测设备100在进行了上述比对后,可以基于比对的结果值确定***图像和参考图像的相似程度。图像检测设备100可以对上述进行图像特征比对的产生的多个结果值进行组合,确定***图像和参考图像的相似程度。
下面以***图像与参考图像的主体结构比对的结果值为SIM,***图像与参考图像的图像特征点比对的结果值为ST,***图像与参考图像的绝对像素的比对的结果值为ABS,***图像与参考图像的像素块的比对的结果值为BK,旋转后***图像与参考图像的角度比对的结果值为SF为例进行说明。
本申请实施例并不限定基于比对的结果值确定***图像和参考图像的相似程度的具体方式,可以通过不同的公式呈现,下面列举其中两种:
第一、***图像和参考图像的相似程度S可以通过如下公式确定:
Figure PCTCN2020094997-appb-000001
其中,
Figure PCTCN2020094997-appb-000002
第二、***图像和参考图像的相似程度S可以通过如下公式确定:
Figure PCTCN2020094997-appb-000003
其中,P=(1-ST)*(1-SF)
上述两种方式仅是举例说明,本申请实施例并不限定确通过***图像和参考图像的主体结构、图像纹理以及像素点的比对的结果值确定***图像和参考图像的相似程度的方式。图像检测设备100也可以只选择其中部分结果值确定***图像和参考图像的相似程度。
例如,图像检测设备100可以通过SIM、ST、ABS、BK以及SF中的任一表征***图像与参考图像的相似程度。
又例如,图像检测设备100可以通过旋转后***图像与参考图像的主体结构以及绝对像素的比对结果值确定***图像与参考图像的相似程度。
示例性的,***图像和参考图像的相似程度S可以通过如下公式确定:
Figure PCTCN2020094997-appb-000004
又例如,图像检测设备100可以通过旋转后***图像与参考图像的主体结构以及图像纹理的比对结果值确定***图像与参考图像的相似程度。
***图像和参考图像的相似程度S可以通过如下公式确定:S=SIM*ST。
在上述说明中,***图像和参考图像的相似程度S均是以乘积的形式表征,本申请实施例并不限定采用其他运算方式确定***图像和参考图像的相似程度S。
基于与方法实施例同一发明构思,本申请实施例还提供了一种图像检测设备,用于执行上述方法实施例中图像检测设备执行的方法,相关特征可参见上述方法实施例,此处不再赘述,如图11所示,该装置包括定位单元1101、截取单元1102、获取单元1103、生成单元1104以及比对单元1105:
定位单元1101,用于定位待检测图像中目标对象所在区域。定位单元1101可用于执行如图2所示实施例中的步骤201。
截取单元1102,用于从待检测图中截取目标对象所在区域的图像。截取单元1102可用于执行如图2所示实施例中的步骤202。
获取单元1103,用于获取目标对象的背景图像,目标对象的背景图像为目标对象所在区域中除去目标对象的图像;获取单元1103可用于执行如图2所示实施例中的步骤203。
生成单元1104,用于从目标对象所在区域的图像中去除目标对象的背景,生成目标对象的图像;生成单元1104可用于执行如图2所示实施例中的步骤204。
比对单元1105,用于通过比对目标对象的图像与参考图像,确定目标对象的图像与参考图像的相似程度。比对单元1105可用于执行如图2所示实施例中的步骤205。
可选的,在待检测图像为黑白图像或彩色图像的情况下,定位单元1101在定位待检测图像中目标对象所在区域可以采用两种不同的方式定位目标对象所在区域,再综合两种方式定位的目标对象所在区域确定较为精确的目标对象所在区域。示例性的,定位单元1101可以通过目标检测算法检测待检测图像中的目标对象,定位待检测图中的第一区域,第一区域包括目标对象;定位单元1101还可以在待检测图像中检测待检测图像中的预设图形,待检测图像中预设图形所在区域为第二区域,预设图形为目标对象的边界形状;之后,定位单元1101综合第一区域、第二区域获取目标对象所在区域。
可选的,定位单元1101在综合第一区域以及第二区域确定目标对象所在区域时,可以对第一区域的边界以及第二区域的边界进行曲线拟合,确定目标对象所在区域的边界;并根据第一区域的中心坐标和第二区域的中心坐标确定目标对象所在区域的中心坐标。
可选的,定位单元1101在对第一区域的边界以及第二区域的边界进行曲线拟合,确定目标对象所在区域的边界时,可以根据预设的比例值对第一区域的边界以及第二区域的边界进行曲线拟合,第一区域以及第二区域中每个区域对应一个比例值。
定位单元1101根据第一区域的中心坐标和第二区域的中心坐标确定目标对象所在区域的中心坐标时,可以根据第一区域和第二区域中每个区域的中心坐标以及对应权重的乘积之和确定目标对象所在区域的中心坐标。
可选的,在待检测图像为彩色图像的情况下,定位单元1101在定位待检测图像中目标对象所在区域可以采用三种不同的方式定位目标对象所在区域,在综合三种方式定位的目标对象所在区域确定较为精确的目标对象所在区域。示例性的,定位单元1101可以通过目标检测算法检测待检测图像中的目标对象,定位待检测图像中的第一区域,第一区域包括目标对象;定位单元1101也可以在待检测图像中检测待检测图像中的预设图形,待检测图像中预设图形所在区域为第二区域,预设图形为目标对象的边界形状;定位单元1101还可以根据目标对象的颜色,从待检测图像中确定第三区域,第三区域的颜色为目标对象的颜色;之后,定位单元1101综合第一区域、第二区域以及第三区域获取标对象所在区域。
可选的,定位单元1101在综合第一区域、第二区域以及第三区域获取目标对象所在区域时,可以对第一区域的边界、第二区域的边界以及第三区域的边界进行曲线拟合,确定目标对象所在区域的边界;并根据第一区域的中心坐标、第二区域的中心坐标以及第三区域的中心坐标确定目标对象所在区域的中心坐标。
可选的,定位单元1101在对第一区域的边界、第二区域的边界以及第三区域的边界进行曲线拟合,确定目标对象所在区域的边界时,可以根据预设的比例值对第一区域的边界、第二区域的边界以及第三区域的边界进行曲线拟合,第一区域、第二区域以及第三区域中每个区域对应一个比例值。
定位单元1101根据第一区域的中心坐标、第二区域的中心坐标以及第三区域的中心坐标确定目标对象所在区域的中心坐标时,根据第一区域、第二区域以及第三区域中每个区域的中心坐标以及对应权重的乘积之和确定目标对象所在区域的中心坐标。
可选的,定位单元1101在综合第一区域、第二区域以及第三区域获取目标对象所在区域之前,可以执行剔除操作;示例性的,定位单元1101可以剔除第一区域、第二 区域以及第三区域中满足预设条件的区域。
预设条件下列条件中的至少一个:
条件1、为区域面积小于标准值、区域包含在一个或多个其他区域;
条件2、区域面积小于标准值、区域包括在一个或多个其他区域。
可选的,定位单元1101在综合第一区域、第二区域确定目标对象所在区域之前,可以执行剔除操作;示例性的,定位单元1101可以剔除第一区域、第二区域中满足预设条件的区域。
预设条件下列条件中的至少一个:
条件1、为区域面积小于标准值、区域包含在一个或多个其他区域;
条件2、区域面积小于标准值、区域包括在一个或多个其他区域。
可选的,定位单元1101在综合第一区域、第二区域以及第三区域,获取目标对象所在区域时,可以执行分组操作;示例性的,定位单元1101可以计算第一区域、第二区域以及第三区域中相邻的两个区域之间的重叠率,将待检测图像中预设范围内,重叠率大于第一阈值的区域划分在一个组,在同一组中的任意两个区域的重叠率大于所述第一阈值;之后再综合属于同一组的第一区域、第二区域以及第三区域获取目标对象所在区域。
可选的,定位单元1101在综合第一区域、第二区域获取目标对象所在区域之前,可以执行分组操作;示例性的,定位单元1101可以计算第一区域和第二区域中相邻的两个区域之间的重叠率,将待检测图像中预设范围内,重叠率大于第一阈值的区域划分在一个组,在同一组中的任意两个区域的重叠率大于所述第一阈值;之后再综合属于同一组的第一区域和第二区域获取目标对象所在区域。
可选的,截取单元1102可以通过如下两种不同的方式截取目标对象所在区域的图像:
方式一、通过图像分割算法从待检测图像中分割出第一图像,第一图像包括目标对象。
方式二、从目标对象所在区域中提取第一颜色的像素点,根据第一颜色像素点获取第二图像,第一颜色为目标对象的颜色。
可选的,截取单元1102在通过图像分割算法从待检测图像中目标对象所在区域分割出第一图像,第一图像包括目标对象时,可以从待检测图像中截取第一矩形区域,第一矩形区域的中心与目标对象所在区域的中心重合,第一矩形区域包括目标对象所在区域;之后,将第一矩形区域作为图像分割算法的输入值,根据图像分割算法的输出值确定第一图像。
可选的,截取单元1102可以从目标对象所在区域中提取第一颜色的像素点,根据第一颜色的像素点获取第二图像,可以从待检测图像中截取包括目标对象所在区域的第二矩形区域,第二矩形区域的中心与目标对象所在区域的中心重合;并将第二矩形区域映射在色彩空间中,根据目标对象所在区域的边界去除第二矩形区域内目标对象所在区域之外的像素点,提取目标对象所在区域内第一颜色的像素点,获取第二图像。
可选的,获取单元1103在根据目标对象所在区域的图像,获取目标对象的背景图像时,可以根据第一图像与第二图像,从待检测图像中截取第三图像,第三图像包括第 一图像和第二图像;之后,对第三图像进行灰度,获取第三图像的灰度图像;并基于第三图像的灰度图像的灰度分布情况,在目标对象所在区域区分目标对象以及目标对象的背景,提取目标对象的背景图像。
可选的,生成单元1104在从目标对象所在区域的图像中去除目标对象的背景,生成目标对象的图像时,可以比对目标对象的背景图像与目标对象所在区域的图像中相同位置的像素点的值,从目标对象所在区域的图像中去除与目标对象的背影图像中非零像素点相同位置的像素点,获取目标对象的图像。
可选的,比对单元1105在通过比对目标对象的图像与参考图像,确定目标对象的图像与参考图像的相似程度时,可以先通过匹配目标对象的图像的特征点与参考图像的特征点,对目标对象的图像进行旋转;之后,通过比对参考图像与旋转后的目标对象的图像的主体结构、图像纹理、像素点以及角度,确定目标对象的图像与参考图像的相似程度。
定位单元1101定位目标对象所在区域、截取单元1102截取目标对象所在区域的图像、获取单元1103获取目标对象的背景图像、生成单元1104生成目标对象的图像以及比对单元1105比对目标对象的图像和参考图像的具体实现,可以参考如图2所示的实施例中图像检测设备100定位***所在区域、截取***所在区域的图像、获取***的背景图像、生成***图像以及比对***图像和参考图像的详细实现方式来实现。
需要说明的是,本申请实施例中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。在本申请的实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
上述实施例,可以全部或部分地通过软件、硬件、固件或其他任意组合来实现。当使用软件实现时,上述实施例可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载或执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以为通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集合的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质。半导体介质可以是固态硬盘(solid state drive,SSD)。
图12为本申请实施例提供的一种图像检测设备1200的示意图,如图12所示,图像检测设备1200包括处理器1201、存储器1202。可选的,图像检测设备1200还可以包括通信接口1203。其中,处理器1201、存储器1202和通信接口1203的个数并不构成对本申请实施例的限定,具体实施时,可以根据业务需求任意配置。
存储器1202可以是易失性存储器,例如随机存取存储器;存储器也可以是非易失性存储器,例如只读存储器,闪存,硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD)、或者存储器1202是其他可以存储计算机程序指令的介质。
本申请实施例中不限定上述处理器1201以及存储器1202之间的具体连接介质。
处理器1201可以为中央处埋器(central processing unit,CPU)、专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)、人工智能(artificial intelligence,AI)芯片、片上***(system on chip,SoC)或复杂可编程逻辑器件(complex programmable logic device,CPLD),图形处理器(graphics processing unit,GPU)等。
在如图12装置中,也可以设置独立的数据收发模块,例如通信接口1203,用于收发数据;处理器1201在与其他设备进行通信时,可以通过通信接口1203进行数据传输,如从访问设备300中接收指令,以及从采集设备100或数据服务器的数据库中获取待检测图像等。
当图像检测设备采用图12所示的形式时,图12中的处理器1201可以通过调用存储器1202中存储的计算机执行指令,使得图像检测设备可以执行如图2所示的实施例中的图像检测设备100执行的步骤201~205。
图11中的定位单元1101、截取单元1102、获取单元1103、生成单元1104以及比对单元1105的功能/实现过程均可以通过图12中的处理器1201调用存储器1202中存储的计算机执行指令来实现。
在本申请所提供的几个实施例中,应该理解到,所揭露的***、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个***,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
以上所述,仅为本发明的具体实施方式。熟悉本技术领域的技术人员根据本发明提供的具体实施方式,可想到变化或替换,都应涵盖在本发明的保护范围之内。

Claims (31)

  1. 一种图像检测方法,其特征在于,该方法包括:
    定位待检测图像中目标对象所在区域;
    从所述待检测图中截取所述目标对象所在区域的图像;
    获取所述目标对象的背景图像,所述目标对象的背景图像为所述目标对象所在区域中除去所述目标对象的图像;
    从所述目标对象所在区域的图像中去除所述目标对象的背景,生成所述目标对象的图像;
    通过比对所述目标对象的图像与参考图像,确定所述目标对象的图像与所述参考图像的相似程度。
  2. 如权利要求1所述的方法,其特征在于,所述定位待检测图像中目标对象所在区域,包括:
    通过目标检测算法检测所述待检测图像中的目标对象,定位所述待检测图中的第一区域,所述第一区域包括所述目标对象;
    在所述待检测图像中检测所述待检测图像中的预设图形,所述待检测图像中预设图形所在区域为第二区域,所述预设图形为所述目标对象的边界形状;
    综合所述第一区域以及所述第二区域,获取所述目标对象所在区域。
  3. 如权利要求2所述的方法,其特征在于,所述综合所述第一区域以及所述第二区域,获取所述目标对象所在区域,包括:
    对所述第一区域的边界以及所述第二区域的边界进行曲线拟合,确定所述目标对象所在区域的边界;
    根据所述第一区域的中心坐标和所述第二区域的中心坐标确定所述目标对象所在区域的中心坐标。
  4. 如权利要求1所述的方法,其特征在于,所述定位待检测图像中目标对象所在区域,包括:
    通过目标检测算法检测所述待检测图像中的目标对象,定位所述待检测图像中的第一区域,所述第一区域包括所述目标对象;
    在所述待检测图像中检测所述待检测图像中的预设图形,所述待检测图像中预设图形所在区域为第二区域,所述预设图形为所述目标对象的边界形状;
    根据所述目标对象的颜色,从所述待检测图像中确定所述第三区域,所述第三区域的颜色为所述目标对象的颜色;
    综合所述第一区域、所述第二区域以及所述第三区域,获取所述目标对象所在区域。
  5. 如权利要求4所述的方法,其特征在于,所述综合所述第一区域、所述第二区域以及所述第三区域,获取所述目标对象所在区域,包括:
    对所述第一区域的边界、所述第二区域的边界以及所述第三区域的边界进行曲线拟合,确定所述目标对象所在区域的边界;
    根据所述第一区域的中心坐标、所述第二区域的中心坐标以及所述第三区域的中心坐标确定所述目标对象所在区域的中心坐标。
  6. 如权利要求2所述的方法,其特征在于,所述综合所述第一区域以及所述第二 区域,获取所述目标对象所在区域之前,包括:
    剔除所述第一区域以及所述第二区域中满足预设条件的区域,所述预设条件为下列至少一项:
    区域面积小于标准值、区域包含在一个或多个其他区域;
    区域面积大于所述标准值、区域包括在一个或多个其他区域。
  7. 如权利要求4所述的方法,其特征在于,所述综合所述第一区域、所述第二区域以及所述第三区域,获取所述目标对象所在区域之前,包括:
    剔除所述第一区域、所述第二区域以及所述第三区域中满足预设条件的区域,所述预设条件为下列至少一项:
    区域面积小于标准值、区域包含在一个或多个其他区域;
    区域面积大于所述标准值、区域包括在一个或多个其他区域。
  8. 如权利要求2或6中所述的方法,其特征在于,所述综合所述第一区域以及所述第二区域,获取所述目标对象所在区域,具体包括:
    计算所述第一区域以及所述第二区域中相邻的两个区域之间的重叠率,将所述待检测图像中预设范围内,重叠率大于第一阈值的区域划分在一个组,在同一组中的任意两个区域的重叠率大于所述第一阈值;
    综合属于同一组的所述第一区域以及所述第二区域,获取所述目标对象所在区域。
  9. 如权利要求4或7中所述的方法,其特征在于,所述综合所述第一区域、所述第二区域以及所述第三区域,获取所述目标对象所在区域,具体包括:
    计算所述第一区域、所述第二区域以及所述第三区域中相邻的两个区域之间的重叠率,将所述待检测图像中预设范围内,重叠率大于第一阈值的区域划分在一个组,在同一组中的任意两个区域的重叠率大于所述第一阈值;
    综合属于同一组的所述第一区域、所述第二区域以及所述第三区域,获取所述目标对象所在区域。
  10. 如权利要求1、2、4中任一所述的方法,其特征在于,所述从所述待检测图像中截取所述目标对象所在区域的图像,包括:
    通过图像分割算法从所述待检测图像中所述目标对象所在区域分割出第一图像,所述第一图像包括所述目标对象;或
    从所述目标对象所在区域中提取第一颜色的像素点,根据所述第一颜色的像素点获取第二图像,所述第一颜色为所述目标对象的颜色。
  11. 如权利要求10所述的方法,其特征在于,所述通过图像分割算法从所述待检测图像中所述目标对象所在区域分割出第一图像,包括:
    从所述待检测图像中截取第一矩形区域,所述第一矩形区域的中心与所述目标对象所在区域的中心重合,所述第一矩形区域包括所述目标对象所在区域;
    将所述第一矩形区域作为图像分割算法的输入值,根据图像分割算法的输出值确定所述第一图像。
  12. 如权利要求10所述的方法,其特征在于,所述从所述目标对象所在区域中提取第一颜色的像素点,根据所述第一颜色的像素点获取第二图像,包括:
    从所述待检测图像中截取包括所述目标对象所在区域的第二矩形区域,所述第二矩 形区域的中心与所述目标对象所在区域的中心重合;
    将所述第二矩形区域映射在色彩空间中,根据所述目标对象所在区域的边界去除所述第二矩形区域内所述目标对象所在区域之外的像素点,提取所述目标对象所在区域内所述第一颜色的像素点,获取所述第二图像。
  13. 如权利要求10~12任一所述的方法,其特征在于,所述获取所述目标对象的背景图像,包括:
    根据所述第一图像与所述第二图像,从所述待检测图像中截取所述第三图像,所述第三图像覆盖所述第一图像和所述第二图像在所述待检测图像中的区域;
    对所述第三图像进行灰度,获取所述第三图像的灰度图像;
    基于所述第三图像的灰度图像的灰度分布情况,在所述目标对象所在区域区分所述目标对象以及所述目标对象的背景,以提取所述目标对象的背景图像。
  14. 如权利要求1或13所述的方法,其特征在于,所述从所述目标对象所在区域的图像中去除所述目标对象的背景,生成目标对象的图像,包括:
    比对所述目标对象的背景图像与所述目标对象所在区域的图像中相同位置的像素点的值,从所述目标对象所在区域的图像中去除与所述目标对象的背影图像中非零像素点相同位置的像素点,获取所述目标对象的图像。
  15. 如权利要求1或14所述的方法,其特征在于,所述通过比对所述目标对象的图像与参考图像,确定所述目标对象的图像与所述参考图像的相似程度,包括:
    通过匹配所述目标对象的图像的特征点与所述参考图像的特征点,对所述目标对象的图像进行旋转;
    通过比对所述参考图像与旋转后的所述目标对象的图像的主体结构、图像纹理、像素点以及角度中的至少其中一个,确定所述目标对象的图像与所述参考图像的相似程度。
  16. 一种图像检测设备,其特征在于,该图像检测设备包括处理器和存储器:
    所述存储器,用于存储计算机程序指令;
    所述处理器,用于调用所述存储器存储的计算机程序指令,执行:
    定位待检测图像中目标对象所在区域;
    从所述待检测图中截取所述目标对象所在区域的图像;
    获取所述目标对象的背景图像,所述目标对象的背景图像为所述目标对象所在区域中除去所述目标对象的图像;
    从所述目标对象所在区域的图像中去除所述目标对象的背景,生成所述目标对象的图像;
    通过比对所述目标对象的图像与参考图像,确定所述目标对象的图像与所述参考图像的相似程度。
  17. 如权利要求16所述的图像检测设备,其特征在于,所述处理器,具体用于:
    通过目标检测算法检测所述待检测图像中的目标对象,定位所述待检测图像中的第一区域,所述第一区域包括所述目标对象;
    在所述待检测图像中检测所述待检测图像中的预设图形,所述待检测图像中预设图 形所在区域为第二区域,所述预设图形为所述目标对象的边界形状;
    综合所述第一区域以及所述第二区域,获取所述目标对象所在区域。
  18. 如权利要求17所述的图像检测设备,其特征在于,所述处理器在综合所述第一区域以及所述第二区域,获取所述目标对象所在区域,具体用于:
    对所述第一区域的边界以及所述第二区域的边界进行曲线拟合,确定所述目标对象所在区域的边界;
    根据所述第一区域的中心坐标和所述第二区域的中心坐标确定所述目标对象所在区域的中心坐标。
  19. 如权利要求16所述的图像检测设备,其特征在于,所述处理器,具体用于:
    通过目标检测算法检测所述待检测图像中的目标对象,定位所述待检测图中的第一区域,所述第一区域包括所述目标对象;
    在所述待检测图像中检测所述待检测图像中的预设图形,所述待检测图像中预设图形所在区域为第二区域,所述预设图形为所述目标对象的边界形状;
    根据所述目标对象的颜色,从所述待检测图像中确定所述第三区域,所述第三区域的颜色为所述目标对象的颜色;
    综合所述第一区域、所述第二区域以及所述第三区域,获取所述目标对象所在区域。
  20. 如权利要求19所述的图像检测设备,其特征在于,所述处理器在综合所述第一区域、所述第二区域以及所述第三区域,获取所述目标对象所在区域,具体用于:
    对所述第一区域的边界、所述第二区域的边界以及所述第三区域的边界进行曲线拟合,确定所述目标对象所在区域的边界;
    根据所述第一区域的中心坐标、所述第二区域的中心坐标以及所述第三区域的中心坐标确定所述目标对象所在区域的中心坐标。
  21. 如权利要求17或18所述的图像检测设备,其特征在于,所述处理器,还用于:
    剔除所述第一区域以及所述第二区域中满足预设条件的区域,所述预设条件为下列至少一项:
    区域面积小于标准值、区域包含在一个或多个其他区域;
    区域面积大于所述标准值、区域包括在一个或多个其他区域。
  22. 如权利要求19或20所述的图像检测设备,其特征在于,所述处理器,还用于:
    剔除所述第一区域、所述第二区域以及所述第三区域中满足预设条件的区域,所述预设条件为下列至少一项:
    区域面积小于标准值、区域包含在一个或多个其他区域;
    区域面积大于所述标准值、区域包括在一个或多个其他区域。
  23. 如权利要求17或18所述的图像检测设备,其特征在于,所述处理器,具体用于:
    计算所述第一区域、所述第二区域中相邻的两个区域之间的重叠率,将所述待检测图像中预设范围内,重叠率大于第一阈值的区域划分在一个组,在同一组中的任意两个区域的重叠率大于所述第一阈值;
    综合属于同一组的所述第一区域以及所述第二区域,获取所述目标对象所在区域。
  24. 如权利要求19或20所述的图像检测设备,其特征在于,所述处理器,具体用 于:
    计算所述第一区域、所述第二区域以及所述第三区域中相邻的两个区域之间的重叠率,将所述待检测图像中预设范围内,重叠率大于第一阈值的区域划分在一个组,在同一组中的任意两个区域的重叠率大于所述第一阈值;
    综合属于同一组的所述第一区域、所述第二区域以及所述第三区域,获取所述目标对象所在区域。
  25. 如权利要求16、17、19中任一所述的图像检测设备,其特征在于,所述处理器,具体用于:
    通过图像分割算法从所述待检测图像中所述目标对象所在区域分割出第一图像,所述第一图像包括所述目标对象;或
    从所述目标对象所在区域中提取第一颜色的像素点,根据所述第一颜色的像素点获取第二图像,所述第一颜色为所述目标对象的颜色。
  26. 如权利要求25所述的图像检测设备,其特征在于,所述处理器在通过图像分割算法从所述待检测图像中所述目标对象所在区域分割出第一图像,具体用于:
    从所述待检测图像中截取第一矩形区域,所述第一矩形区域的中心与所述目标对象所在区域的中心重合,所述第一矩形区域包括所述目标对象所在区域;
    将所述第一矩形区域作为图像分割算法的输入值,根据图像分割算法的输出值确定所述第一图像。
  27. 如权利要求25所述的图像检测设备,其特征在于,所述处理器在从所述目标对象所在区域中提取第一颜色的像素点,根据所述第一颜色的像素点获取第二图像,具体用于:
    从所述待检测图像中截取包括所述目标对象所在区域的第二矩形区域,所述第二矩形区域的中心与所述目标对象所在区域的中心重合;
    将所述第二矩形区域映射在色彩空间中,根据所述目标对象所在区域的边界去除所述第二矩形区域内目标对象所在区域之外的像素点,提取所述目标对象所在区域内所述第一颜色的像素点,获取所述第二图像。
  28. 如权利要求25~27任一所述的图像检测设备,其特征在于,所述处理器在获取所述目标对象的背景图像,具体用于:
    根据所述第一图像与所述第二图像,从所述待检测图像中截取所述第三图像,所述第三图像覆盖所述第一图像和所述第二图像在所述待检测图像中的区域;
    对所述第三图像进行灰度,获取所述第三图像的灰度图像;
    基于所述第三图像的灰度图像的灰度分布情况,在所述目标对象所在区域区分所述目标对象以及所述目标对象的背景,提取所述目标对象的背景图像。
  29. 如权利要求16或28所述的图像检测设备,其特征在于,所述处理器,具体用于:
    比对所述目标对象的背景图像与所述目标对象所在区域的图像中相同位置的像素点的值,从所述目标对象所在区域的图像中去除与所述目标对象的背影图像中非零像素点相同位置的像素点,获取所述目标对象的图像。
  30. 如权利要求16或29所述的图像检测设备,其特征在于,所述处理器,具体用 于:
    通过匹配所述目标对象的图像的特征点与所述参考图像的特征点,对所述目标对象的图像进行旋转;
    通过比对所述参考图像与旋转后的所述目标对象的图像的主体结构、图像纹理、像素点以及角度中的至少其中一个,确定所述目标对象的图像与所述参考图像的相似程度。
  31. 一种图像检测***,其特征在于,该***包括如权利要求16~30任一所述的图像检测设备,该***还包括采集设备和访问设备,所述采集设备用于采集所述待检测图像,将所述待检测图像发送至所述图像检测设备,所述访问设备用于向所述图像检测设备发送指令,所述指令用于指示所述图像检测设备检测所述待检测图像中的目标对象。
PCT/CN2020/094997 2019-06-29 2020-06-08 图像检测方法、设备以及*** WO2021000702A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910581381.XA CN110472623B (zh) 2019-06-29 2019-06-29 图像检测方法、设备以及***
CN201910581381.X 2019-06-29

Publications (1)

Publication Number Publication Date
WO2021000702A1 true WO2021000702A1 (zh) 2021-01-07

Family

ID=68507430

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/094997 WO2021000702A1 (zh) 2019-06-29 2020-06-08 图像检测方法、设备以及***

Country Status (2)

Country Link
CN (1) CN110472623B (zh)
WO (1) WO2021000702A1 (zh)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112966639A (zh) * 2021-03-22 2021-06-15 新疆爱华盈通信息技术有限公司 车辆检测方法、装置、电子设备及存储介质
CN113033550A (zh) * 2021-03-15 2021-06-25 合肥联宝信息技术有限公司 一种图像的检测方法、装置及计算机可读介质
CN113191985A (zh) * 2021-05-24 2021-07-30 北京美医医学技术研究院有限公司 一种基于红外激光的智能祛斑***
CN113221754A (zh) * 2021-05-14 2021-08-06 深圳前海百递网络有限公司 快递单图像检测方法、装置、计算机设备和存储介质
CN113269197A (zh) * 2021-04-25 2021-08-17 南京三百云信息科技有限公司 基于语义分割的证件图像顶点坐标回归***和识别方法
CN113688795A (zh) * 2021-09-27 2021-11-23 上海合合信息科技股份有限公司 一种将图像中表格转换为电子表格的方法及装置
CN113870439A (zh) * 2021-09-29 2021-12-31 北京百度网讯科技有限公司 用于处理图像的方法、装置、设备以及存储介质
CN113935997A (zh) * 2021-12-16 2022-01-14 深圳致星科技有限公司 用于料件检测的图像处理方法、存储介质及图像处理装置
CN113989510A (zh) * 2021-12-28 2022-01-28 深圳市万物云科技有限公司 一种河道排水口溢流检测方法、装置及相关设备
CN114972344A (zh) * 2022-07-29 2022-08-30 山东聊城中泰表业有限公司 一种用于手表零配件的生产质量缺陷检测方法
CN115334239A (zh) * 2022-08-10 2022-11-11 青岛海信移动通信技术股份有限公司 前后摄像头拍照融合的方法、终端设备和存储介质
CN115830719A (zh) * 2023-02-16 2023-03-21 青岛旭华建设集团有限公司 基于图像处理的建筑工地危险行为识别方法
CN117935296A (zh) * 2024-02-06 2024-04-26 广东度才子集团有限公司 一种就业质量报告生成***

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110472623B (zh) * 2019-06-29 2022-08-09 华为技术有限公司 图像检测方法、设备以及***
CN111027415B (zh) * 2019-11-21 2022-08-05 杭州凌像科技有限公司 一种基于偏振图像的车辆检测方法
CN110991374B (zh) * 2019-12-10 2023-04-04 电子科技大学 一种基于rcnn的指纹奇异点检测方法
CN111147862B (zh) * 2020-01-03 2021-02-23 南京大学 一种基于目标编码的端到端图像压缩方法
CN111382726B (zh) * 2020-04-01 2023-09-01 浙江大华技术股份有限公司 工程作业检测方法以及相关装置
CN113763402A (zh) * 2020-06-04 2021-12-07 Oppo(重庆)智能科技有限公司 一种检测方法、检测装置、电子设备和存储介质
CN111696154B (zh) * 2020-06-16 2023-06-13 北京惠朗时代科技有限公司 坐标定位方法、装置、设备及存储介质
CN112784900A (zh) * 2021-01-22 2021-05-11 深圳壹账通智能科技有限公司 图像目标对比方法、装置、计算机设备及可读存储介质
CN113762315A (zh) * 2021-02-04 2021-12-07 北京京东振世信息技术有限公司 图像检测方法、装置、电子设备和计算机可读介质
CN113965729B (zh) * 2021-10-29 2023-12-26 深圳供电局有限公司 一种区域安全监控***及方法
CN114021099B (zh) * 2022-01-06 2022-03-25 北科信链(武汉)数字科技有限公司 一种基于指纹与***的验证方法及装置

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101008985A (zh) * 2007-01-18 2007-08-01 章毅 ***鉴别***及其控制方法
CN108197642A (zh) * 2017-12-25 2018-06-22 山东浪潮云服务信息科技有限公司 一种***鉴别方法及装置
CN108596197A (zh) * 2018-05-15 2018-09-28 汉王科技股份有限公司 一种***匹配方法及装置
CN108921158A (zh) * 2018-06-14 2018-11-30 众安信息技术服务有限公司 图像校正方法、装置及计算机可读存储介质
CN109635818A (zh) * 2018-10-26 2019-04-16 平安科技(深圳)有限公司 ***防伪检验方法、装置及计算机可读存储介质
CN109670500A (zh) * 2018-11-30 2019-04-23 平安科技(深圳)有限公司 一种文字区域获取方法、装置、存储介质及终端设备
CN110472623A (zh) * 2019-06-29 2019-11-19 华为技术有限公司 图像检测方法、设备以及***

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106056532B (zh) * 2016-05-20 2020-04-07 深圳市奥拓电子股份有限公司 一种去除背景图像的方法和装置
CN106651860B (zh) * 2016-11-02 2019-07-09 帝麦克斯(苏州)医疗科技有限公司 一种图像分割方法及装置
CN106874901B (zh) * 2017-01-17 2020-07-03 北京智元未来科技有限公司 一种行驶证识别方法及装置
CN107154040B (zh) * 2017-05-08 2021-03-23 重庆邮电大学 一种隧道衬砌表面图像裂缝检测方法
CN107610320A (zh) * 2017-09-06 2018-01-19 深圳怡化电脑股份有限公司 一种票据识别方法和装置
CN109410220B (zh) * 2018-10-16 2019-12-24 腾讯科技(深圳)有限公司 图像分割方法、装置、计算机设备及存储介质
CN109447068A (zh) * 2018-10-26 2019-03-08 信雅达***工程股份有限公司 一种从图像中分离***并校准***的方法
CN109740395A (zh) * 2018-12-17 2019-05-10 江苏理工学院 深度学习与形状检测相结合的二维码定位方法及***
CN109766828A (zh) * 2019-01-08 2019-05-17 重庆同济同枥信息技术有限公司 一种车辆目标分割方法、装置及通信设备

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101008985A (zh) * 2007-01-18 2007-08-01 章毅 ***鉴别***及其控制方法
CN108197642A (zh) * 2017-12-25 2018-06-22 山东浪潮云服务信息科技有限公司 一种***鉴别方法及装置
CN108596197A (zh) * 2018-05-15 2018-09-28 汉王科技股份有限公司 一种***匹配方法及装置
CN108921158A (zh) * 2018-06-14 2018-11-30 众安信息技术服务有限公司 图像校正方法、装置及计算机可读存储介质
CN109635818A (zh) * 2018-10-26 2019-04-16 平安科技(深圳)有限公司 ***防伪检验方法、装置及计算机可读存储介质
CN109670500A (zh) * 2018-11-30 2019-04-23 平安科技(深圳)有限公司 一种文字区域获取方法、装置、存储介质及终端设备
CN110472623A (zh) * 2019-06-29 2019-11-19 华为技术有限公司 图像检测方法、设备以及***

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113033550B (zh) * 2021-03-15 2022-04-15 合肥联宝信息技术有限公司 一种图像的检测方法、装置及计算机可读介质
CN113033550A (zh) * 2021-03-15 2021-06-25 合肥联宝信息技术有限公司 一种图像的检测方法、装置及计算机可读介质
CN112966639A (zh) * 2021-03-22 2021-06-15 新疆爱华盈通信息技术有限公司 车辆检测方法、装置、电子设备及存储介质
CN112966639B (zh) * 2021-03-22 2024-04-26 新疆爱华盈通信息技术有限公司 车辆检测方法、装置、电子设备及存储介质
CN113269197A (zh) * 2021-04-25 2021-08-17 南京三百云信息科技有限公司 基于语义分割的证件图像顶点坐标回归***和识别方法
CN113269197B (zh) * 2021-04-25 2024-03-08 南京三百云信息科技有限公司 基于语义分割的证件图像顶点坐标回归***和识别方法
CN113221754A (zh) * 2021-05-14 2021-08-06 深圳前海百递网络有限公司 快递单图像检测方法、装置、计算机设备和存储介质
CN113191985A (zh) * 2021-05-24 2021-07-30 北京美医医学技术研究院有限公司 一种基于红外激光的智能祛斑***
CN113191985B (zh) * 2021-05-24 2024-05-28 北京美医医学技术研究院有限公司 一种基于红外激光的智能祛斑***
CN113688795A (zh) * 2021-09-27 2021-11-23 上海合合信息科技股份有限公司 一种将图像中表格转换为电子表格的方法及装置
CN113870439A (zh) * 2021-09-29 2021-12-31 北京百度网讯科技有限公司 用于处理图像的方法、装置、设备以及存储介质
CN113935997B (zh) * 2021-12-16 2022-03-04 深圳致星科技有限公司 用于料件检测的图像处理方法、存储介质及图像处理装置
CN113935997A (zh) * 2021-12-16 2022-01-14 深圳致星科技有限公司 用于料件检测的图像处理方法、存储介质及图像处理装置
CN113989510A (zh) * 2021-12-28 2022-01-28 深圳市万物云科技有限公司 一种河道排水口溢流检测方法、装置及相关设备
CN114972344A (zh) * 2022-07-29 2022-08-30 山东聊城中泰表业有限公司 一种用于手表零配件的生产质量缺陷检测方法
CN114972344B (zh) * 2022-07-29 2022-10-04 山东聊城中泰表业有限公司 一种用于手表零配件的生产质量缺陷检测方法
CN115334239A (zh) * 2022-08-10 2022-11-11 青岛海信移动通信技术股份有限公司 前后摄像头拍照融合的方法、终端设备和存储介质
CN115334239B (zh) * 2022-08-10 2023-12-15 青岛海信移动通信技术有限公司 前后摄像头拍照融合的方法、终端设备和存储介质
CN115830719A (zh) * 2023-02-16 2023-03-21 青岛旭华建设集团有限公司 基于图像处理的建筑工地危险行为识别方法
CN117935296A (zh) * 2024-02-06 2024-04-26 广东度才子集团有限公司 一种就业质量报告生成***
CN117935296B (zh) * 2024-02-06 2024-06-04 广东度才子集团有限公司 一种就业质量报告生成***

Also Published As

Publication number Publication date
CN110472623A (zh) 2019-11-19
CN110472623B (zh) 2022-08-09

Similar Documents

Publication Publication Date Title
WO2021000702A1 (zh) 图像检测方法、设备以及***
US20210366124A1 (en) Graphical fiducial marker identification
US20210174131A1 (en) Computer Vision System for Industrial Equipment Gauge Digitization and Alarms
US8675960B2 (en) Detecting skin tone in images
WO2018216629A1 (ja) 情報処理装置、情報処理方法、及びプログラム
TW201921316A (zh) 偵測航拍影像內物體之非暫態電腦可讀取媒體及系統,以及航拍影像中物體偵測之方法
JP2018198053A (ja) 情報処理装置、情報処理方法、及びプログラム
CN109948566B (zh) 一种基于权重融合与特征选择的双流人脸反欺诈检测方法
CN109635783A (zh) 视频监控方法、装置、终端和介质
CN104008542B (zh) 一种针对特定平面图形的快速角点匹配方法
CN109740572A (zh) 一种基于局部彩色纹理特征的人脸活体检测方法
JP5701181B2 (ja) 画像処理装置、画像処理方法及びコンピュータプログラム
CN106650606A (zh) 人脸图像的匹配及处理方法、人脸图像模型构建***
CN111582155B (zh) 活体检测方法、装置、计算机设备和存储介质
CN107992856A (zh) 城市场景下的高分遥感建筑物阴影检测方法
CN106682670B (zh) 一种台标识别方法及***
CN109635679B (zh) 一种实时的靶纸定位及环线识别方法
CN108182700A (zh) 一种基于两次特征检测的图像配准方法
CN102750718B (zh) 一种背景蒙版生成方法
JP6546385B2 (ja) 画像処理装置及びその制御方法、プログラム
CN116543325A (zh) 基于无人机影像的农作物人工智能自动识别方法和***
CN113159037B (zh) 图片矫正方法、装置、计算机设备及存储介质
CN111325209B (zh) 一种车牌识别方法和***
US20150278636A1 (en) Image processing apparatus, image processing method, and recording medium
Fan et al. A novel saliency computation model for traffic sign detection

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20834131

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20834131

Country of ref document: EP

Kind code of ref document: A1