Image processing method and device
By performing image coordinate transformation and texture matching on the object image, the problem of users having difficulty in identifying the quality and authenticity of the object is solved, and efficient and accurate object detection is achieved.
Patent Information
- Application Number
- CN202411328092.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-20
- Publication Date
- 2025-01-10
AI Technical Summary
Users find it difficult to accurately identify the quality and authenticity of purchased items with the naked eye, and existing technologies struggle to achieve efficient and accurate item detection.
By transforming the image coordinates of the object to be detected, the transformed image and multiple preset object images are obtained. The image data is then merged to determine the texture matching strategy. Finally, the detection result is determined based on the texture matching index score.
It improves the efficiency and accuracy of item inspection, enabling accurate judgment of item quality and authenticity.
Smart Images

Figure CN119295772A_ABST
Abstract
Description
[0001] This patent application is a divisional application of the Chinese patent application with application number CN202410189331.8, application date February 20, 2024, and invention name “Image processing method and device”. Technical Field
[0002] This document relates to the field of data processing technology, and in particular to an image processing method and device. Background Art
[0003] With the continuous development of Internet technology and the continuous improvement of users' living standards, users purchase various items online or offline. After a period of time, users may need to test the purchased items, such as testing the quality of the purchased items, or testing the authenticity of the purchased items. For users, it is difficult to identify the quality or authenticity of items with the naked eye, so the purchased items can be identified through automation. In this process, higher identification requirements are placed on the identification party of the items. Summary of the invention
[0004] One or more embodiments of the present specification provide an image processing method, comprising: performing image coordinate transformation on an object image of an object to be detected to obtain a transformed image, and obtaining a plurality of preset object images. Performing data merging processing on the image data of an image pair consisting of each preset object image and the transformed image to obtain merged image data of each image pair. Determining a texture matching strategy for each image pair based on image parameters of the object image, and performing texture matching processing on the merged image data according to the texture matching strategy to obtain a texture matching index for each image pair. Scoring the texture matching index according to the transformed coordinates corresponding to the image coordinate transformation, and determining the detection result of the object to be detected based on the scoring result.
[0005] One or more embodiments of the present specification provide an image processing device, including: an image transformation module, configured to perform image coordinate transformation on an object image of an object to be detected to obtain a transformed image, and to obtain a plurality of preset object images. A data merging module, configured to perform data merging processing on image data of an image pair consisting of each preset object image and the transformed image, to obtain merged image data of each image pair. A texture matching module, configured to determine a texture matching strategy for each image pair based on image parameters of the object image, and perform texture matching processing on the merged image data according to the texture matching strategy, to obtain a texture matching index for each image pair. A scoring processing module, configured to perform scoring processing on the texture matching index according to the transformed coordinates corresponding to the image coordinate transformation, and determine the detection result of the object to be detected based on the scoring result.
[0006] One or more embodiments of the present specification provide an image processing device, comprising: a processor; and a memory configured to store computer executable instructions, wherein when the computer executable instructions are executed, the processor: performs image coordinate transformation on the image of the object to be detected to obtain a transformed image, and obtains a plurality of preset object images. Performs data merging processing on the image data of the image pairs consisting of each preset object image and the transformed image to obtain merged image data of each image pair. Determines the texture matching strategy of each image pair based on the image parameters of the object image, and performs texture matching processing on the merged image data according to the texture matching strategy to obtain the texture matching index of each image pair. Scores the texture matching index according to the transformed coordinates corresponding to the image coordinate transformation, and determines the detection result of the object to be detected based on the scoring result.
[0007] One or more embodiments of the present specification provide a storage medium for storing computer-executable instructions, which implement the following process when executed by a processor: performing image coordinate transformation on the object image of the object to be detected to obtain a transformed image, and obtaining multiple preset object images. Performing data merging processing on the image data of the image pairs consisting of each preset object image and the transformed image to obtain merged image data of each image pair. Determining the texture matching strategy of each image pair based on the image parameters of the object image, and performing texture matching processing on the merged image data according to the texture matching strategy to obtain the texture matching index of each image pair. Scoring the texture matching index according to the transformed coordinates corresponding to the image coordinate transformation, and determining the detection result of the object to be detected based on the scoring result. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] In order to more clearly illustrate one or more embodiments of the present specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present specification. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative labor. Figure 1 A schematic diagram of an implementation environment of an image processing method provided by one or more embodiments of this specification; Figure 2 A processing flow chart of an image processing method provided for one or more embodiments of this specification; Figure 3A A schematic diagram of an object image of an object to be detected provided in one or more embodiments of this specification; Figure 3BA schematic diagram of a transformed image of an object to be detected provided by one or more embodiments of this specification; Figure 4 A processing flow chart of an image processing method applied to a first image detection scenario provided by one or more embodiments of this specification; Figure 5 A processing flow chart of an image processing method applied to a second image detection scenario provided by one or more embodiments of this specification; Figure 6 A schematic diagram of an image processing device embodiment provided for one or more embodiments of this specification; Figure 7 A schematic diagram of the structure of an image processing device provided in one or more embodiments of this specification. DETAILED DESCRIPTION
[0009] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the technical solutions in one or more embodiments of this specification will be clearly and completely described below in conjunction with the drawings in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.
[0010] The image processing method provided in one or more embodiments of this specification can be applied to the implementation environment of image processing. Figure 1 , the implementation environment at least includes: A server 101 performs image detection on the object to be detected, and a terminal device 102 collects and uploads the image of the object to be detected.
[0011] The server 101 may be a single server, or a server cluster consisting of several servers, or one or more cloud servers in a cloud computing platform; The terminal device 102 may be a mobile phone, a personal computer, a tablet computer, an e-book reader, a wearable device, a device for information interaction based on AR (Augmented Reality) / VR (Virtual Reality), a laptop computer, etc., and may also be installed with an application or a browser, and submit an object image of the object to be detected to the server 101 through the application or the browser.
[0012] In this implementation environment, the server 101 performs image coordinate transformation on the object image of the object to be detected uploaded by the terminal device 102 to obtain a transformed image, performs data merging processing on the image data of each preset object image among multiple preset object images and the image data of the transformed image to obtain merged image data of each image pair composed of each preset object image and the transformed image, determines the texture matching strategy of each image pair with the help of image parameters of the object image, performs texture matching processing on the merged image data according to the texture matching strategy, obtains the texture matching index of each image pair, and on this basis, performs scoring processing on the texture matching index in combination with the transformed coordinates corresponding to the image coordinate transformation, and determines the detection result of the object to be detected based on the scoring result.
[0013] One or more embodiments of an image processing method provided in this specification are as follows: Reference Figure 2 The image processing method provided in this embodiment specifically includes steps S202 to S208.
[0014] Step S202 , performing image coordinate transformation on the object image of the object to be detected to obtain a transformed image, and obtaining a plurality of preset object images.
[0015] The object to be detected in this embodiment can be any object to be detected that has a detection requirement, such as a commodity to be detected (such as ceramic products) or a biological organism to be detected. The biological organism to be detected can be a plant to be detected or an animal to be detected. The object to be detected in this embodiment can also be a geographical indication object, that is, a landmark object to be detected. The detection requirements include quality detection, authenticity detection, item category detection, factory information detection, etc. The object to be detected can be an object of any shape and color; the object image of the object to be detected includes an object image collected by calling the camera of the terminal device.
[0016] The transformed image includes a transformed image obtained by performing image coordinate transformation on the object image, that is, the image coordinates of the transformed image and the object image may be different; optionally, the image coordinate transformation includes image angle deflection; the transformed coordinates corresponding to the image coordinate transformation may be one or more, that is, the transformed image may be one or more images, for example, the number of transformed coordinates of the image coordinate transformation, that is, the number of deflection angles, is n, and the object image of the object to be detected is deflected at intervals of 360 / n degrees to obtain B1-Bn transformed images with different deflection angles or different change coordinates; Figure 3A The object image of the object to be detected is shown, Figure 3B The transformed image shown, it can be understood that Figure 3A and Figure 3B The examples of the object image and the transformed image of the object to be detected are only illustrative.
[0017] The multiple preset object images refer to multiple pre-set object images; each preset object image in the multiple preset object images may contain the object to be detected, or may not contain the object to be detected. For example, each preset object image in the multiple preset object images may contain preset object images of multiple different object categories.
[0018] In practical applications, when comparing two images, feature alignment is often used for image comparison. For example, in biometric recognition scenarios, key parts such as the eyes, nose tip, and mouth corners are aligned and feature comparison is performed. However, the feature alignment method is relatively cumbersome, and in some scenarios, image comparison cannot be achieved through feature alignment, such as objects to be detected that are perfectly circular and do not have markers with a certain angle on the surface, and cannot be aligned. In order to improve the efficiency of image comparison and simplify the image comparison process, the image coordinate transformation of the object image of the object to be detected can be performed to obtain a transformed image, and multiple preset object images can be obtained, and the transformed image can be compared with the multiple preset object images, so as to simplify the feature alignment process and improve the efficiency of image comparison.
[0019] In actual application scenarios, the color types of the object image of the object to be detected and / or the complexity of the object shape of the object to be detected are different, which may lead to different requirements for the number of transformation coordinates for image coordinate transformation of the object image of the object to be detected. In order to improve the efficiency of image matching while improving the accuracy of image matching, the number of transformation coordinates for image coordinate transformation can be determined according to the color type of the object image of the object to be detected and / or the object shape of the object to be detected in the object image; in an optional implementation manner provided by this embodiment, before performing image coordinate transformation on the object image of the object to be detected to obtain a transformed image and obtaining multiple preset object images, the following operations are also performed: Determining a color type of the object image and / or an object shape of the object to be detected in the object image; The number of transformed coordinates of the image coordinate transformation is determined according to the color type and / or the shape of the object.
[0020] The color type of the object image refers to the type of color contained in the object image; the object shape of the object to be detected in the object image includes a circle, a square, a rectangle and / or an irregular shape, and the object shape of the object to be detected can also be other shapes. The number of transformation coordinates of the image coordinate transformation includes the number of transformation coordinates for image coordinate transformation, for example, the number of transformation coordinates is n, that is, the number of images of the transformation image is n.
[0021] Specifically, the number of color types of the object image and / or the complexity of the object shape of the object to be detected in the object image can be determined, and the number of transformation coordinates for the image coordinate transformation can be determined based on the number of color types and / or the complexity of the object shape of the object to be detected in the object image; in the process of determining the number of transformation coordinates for the image coordinate transformation based on the number of color types and / or the complexity of the object shape of the object to be detected in the object image, the number of transformation coordinates mapped to the number of types and / or the complexity of the object shape can be searched in a number mapping table based on the number of types and / or the complexity of the object shape.
[0022] In addition, the number of transformed coordinates for image coordinate transformation can also be obtained by calculation based on a random algorithm. For example, the object image of the object to be detected is input into a random algorithm to calculate the number of transformed coordinates to obtain the number of transformed coordinates for image coordinate transformation.
[0023] In addition, before performing image coordinate transformation on the object image of the object to be detected to obtain a transformed image, and before obtaining multiple preset object images for execution, the number of transformed coordinates for the image coordinate transformation can also be determined according to the image resolution of the object image of the object to be detected; in addition to this, the number of transformed coordinates for the image coordinate transformation can also be determined according to the color type of the object image, the object shape of the object to be detected in the object image and / or the image resolution of the object image; optionally, the image resolution of the object image, the number of color types of the object image, the complexity of the object shape of the object to be detected and the number of transformed coordinates are positively correlated.
[0024] Optionally, the object image of the object to be detected is acquired based on an image acquisition page; step S202, performing image coordinate transformation on the object image of the object to be detected to obtain a transformed image, and acquiring multiple preset object images, is executed after detecting a capture instruction submitted through the image acquisition page.
[0025] Based on the above determination of the number of transformation coordinates of the image coordinate transformation, during the execution of step S202, the image coordinate transformation of the object image of the object to be detected can be performed according to the number of transformation coordinates to obtain a transformation image, and a plurality of preset object images can be obtained.
[0026] It should be noted that the object image of the object to be detected may also be directly compared with the images of each preset object image without image coordinate transformation, so as to improve the convenience of image comparison. Then step S202 may be replaced by obtaining the object image of the object to be detected and multiple preset object images, and forming a new implementation method with other processing steps provided in this embodiment; Alternatively, step S202 may also be replaced by performing an image angle deflection on the object image of the object to be inspected to obtain a deflected image, and obtaining a plurality of preset object images; or, performing a multi-angle deflection on the object image of the object to be inspected to obtain a plurality of deflected images, and obtaining a plurality of preset object images, and forming a new implementation method together with other processing steps provided in this embodiment.
[0027] Step S204, performing data merging processing on the image data of the image pairs consisting of each preset object image and the transformed image to obtain merged image data of each image pair.
[0028] The above-mentioned object image of the object to be detected is subjected to image coordinate transformation to obtain a transformed image, and multiple preset object images are obtained. In this step, in order to improve the convenience of data processing, the image data of the image pair composed of each preset object image and the transformed image is merged to obtain merged image data of each image pair.
[0029] The image pair composed of each preset object image and the transformed image in this embodiment refers to an image pair composed of each preset object image and the transformed image in each preset object image. For example, each preset object image includes image A1 and image A2, and the transformed image includes transformed image B. Then the composed image pair includes<A1,B> ,<A2,B> The image data of the image pair includes the image data of each image in the image pair, and the image data of each image includes pixel coordinate data and / or channel data. Specifically, the image data of each image may be an image matrix. For example, the image pair is<A1,B> , the image data of the image pair includes the image data H*W*C1 of image A1 and the image data H*W*C of the transformed image B, where H represents the height, W represents the width, and C represents the number of image channels.
[0030] The merged image data of each image pair may be merged image data including pixel coordinate data and / or channel data of each image pair, for example, the image data of image A1 is H*W*C1, the image data of transformed image B is H*W*C, and the image data of image pair A1 is H*W*C1.<A1,B> The merged image data is H*W*C1C; in addition, the merged image data of each image pair may also include merged image data composed of channel data of each image pair.
[0031] In practical applications, the channel data of each image pair may be of high concern. Therefore, in order to improve the convenience of image detection and avoid interference of other data of each image pair except the channel data on image detection, resulting in low accuracy of image detection, the first channel data in the image data of each preset object image and the second image data in the image data of the transformed image may be merged to obtain merged channel data of each image pair. In a first optional implementation manner provided by this embodiment, in the process of performing data merging processing on the image data of the image pair consisting of each preset object image and the transformed image to obtain merged image data of each image pair, the following operations are performed: Extracting first channel data from the image data of each of the preset object images, and extracting second channel data from the image data of the transformed image; The first channel data and the second channel data are combined to obtain combined channel data of each image pair.
[0032] Among them, the first channel data includes first channel data composed of pixel values of each pixel point in each preset object image, and the pixel value can be a color value, such as R (Red), G (Green), B (Blue) value, or grayscale value; the second channel data includes second channel data composed of pixel values of each pixel point in the transformed image.
[0033] Specifically, the first color channel data in the image data of each preset object image can be extracted, and the second color channel data in the image data of the transformed image can be extracted, and the first color channel data and the second color channel data can be merged to obtain merged channel data of each image pair.
[0034] In addition, in the subsequent image detection process, image detection can be performed by means of a model, and the model may have relevant requirements on the amount of input data, and there is a limit on the amount of input data, so in order to facilitate the data transmission of the model; in the second optional implementation mode provided by this embodiment, in the process of performing data merging processing on the image data of the image pairs composed of each preset object image and the transformed image, and obtaining the merged image data of each image pair, the following operations are performed: compressing the image data of each preset object image to obtain first compressed data of each preset object image, and compressing the image data of the transformed image to obtain second compressed data of the transformed image; The first compressed data and the second compressed data are merged to obtain the merged image data.
[0035] In addition, the image specifications of each preset object image and the image specifications of the transformed image may be different, which affects the image detection efficiency. In order to improve the image detection efficiency, the image data of each preset object image and the image data of the transformed image may be adjusted according to the image specifications of each preset object image and the position coordinates of the object to be detected in the transformed image, so as to obtain the adjusted data of each preset object image and the adjusted data of the transformed image, and the adjusted data of each preset object image and the adjusted data of the transformed image are merged to obtain the merged image data. In the third optional implementation manner provided by this embodiment, in the process of merging the image data of the image pairs composed of each preset object image and the transformed image to obtain the merged image data of each image pair, the following operations are performed: Identifying the position coordinates of the object to be detected in the transformed image; According to the image specifications of the preset object images and the position coordinates, data boundaries of the image data of the preset object images and the image data of the transformed image are adjusted to obtain the adjusted data of the preset object images and the adjusted data of the transformed image; The adjustment data of each preset object image and the adjustment data of the transformed image are merged to obtain the merged image data.
[0036] The image specifications of each preset object image include the image size of each preset object image, i.e., the image size. The data boundary of the adjustment data of each preset object image and the adjustment data of the transformed image may be the same; the adjustment data refers to the image data after data boundary adjustment; the data boundary of the adjustment data refers to the boundary information of the image data at the boundary of the adjustment data.
[0037] Specifically, the data boundaries of the image data of each preset object image and the data boundaries of the image data of the transformed image can be adapted and adjusted according to the image specifications of each preset object image and the position coordinates of the object to be detected in the transformed image, so as to obtain the adjusted data of each preset object image and the adjusted data of the transformed image; the boundary adaptation adjustment here includes the process of adjusting the data boundaries of the image data of each preset object image and the data boundaries of the image data of the transformed image to be approximately the same.
[0038] In addition, in the process of performing data merging processing on the image data of the image pairs composed of each preset object image and the transformed image to obtain the merged image data of each image pair, the pixel coordinate data and channel data of each preset object image can also be merged with the pixel coordinate data and channel data of the transformed image to obtain the merged image data of the image pairs composed of each preset object image and the transformed image.
[0039] It should be noted that, optionally, the above step S204, performing data merging processing on the image data of the image pairs consisting of each preset object image and the transformed image to obtain merged image data of each image pair, can be executed after detecting the acquisition instruction submitted through the image acquisition page.
[0040] It should be added that, in the present embodiment, the image data of each preset object image and the transformed image may not be processed by data merging, that is, step S204 may be replaced by using the image data of each preset object image and the image data of the transformed image as merged image data of an image pair consisting of each preset object image and the transformed image, and forming a new implementation method together with other processing steps provided in the present embodiment.
[0041] Step S206, determining a texture matching strategy for each of the image pairs based on the image parameters of the object image, and performing texture matching processing on the merged image data according to the texture matching strategy to obtain a texture matching index for each of the image pairs.
[0042] The above-mentioned image data of the image pairs consisting of each preset object image and the transformed image are merged to obtain merged image data of each image pair. In this step, in order to improve the pertinence and flexibility of image texture matching, the texture matching strategy of each image pair can be first determined based on the image parameters of the object image, and then the merged image data is texture matched according to the texture matching strategy to obtain the texture matching index of each image pair.
[0043] The image parameters of the object image in this embodiment refer to image-related parameters of the object image, such as the image parameters of the object image including image resolution and / or the number of color types of the object image. In addition, the image parameters of the object image may also be other types of image parameters. The texture matching strategy of each image pair refers to a strategy for texture matching of each image pair, such as the texture matching strategy including texture matching area, texture matching position and / or texture matching order, and another example of the texture matching strategy including texture extraction method.
[0044] The texture matching index of each image pair includes an index characterizing the matching degree of image textures in each image pair, such as texture matching degree.
[0045] In practical applications, different texture matching strategies may exist for each image pair. Different texture matching strategies are used to improve the flexibility of texture matching for each image pair. The following provides three implementation methods for determining the texture matching strategy for each image pair.
[0046] (1) Implementation method 1 In specific implementation, in the process of determining the texture matching strategy of each image pair based on the image parameters of the object image, the texture matching area of each image pair may be calculated according to the image resolution of the object image and the conversion factor between the resolution and the area, or the texture matching position and / or the texture matching order of each image pair may be determined based on the object shape of the object to be detected in the transformed image; specifically, in the first optional implementation manner provided by this embodiment, in the process of determining the texture matching strategy of each image pair based on the image parameters of the object image, the following operations are performed: Determining the image resolution of the object image, and calculating the texture matching area of each image pair according to the image resolution and a conversion factor between resolution and area; Based on the object shape of the object to be detected in the transformed image, the texture matching position and the texture matching order of each image pair are determined.
[0047] The resolution-area conversion factor refers to a factor that characterizes the conversion relationship between image resolution and texture matching area, such as a conversion factor including a conversion coefficient. The texture matching area of each image pair includes the image block size or image block size of each image pair in the texture matching process, such as a texture matching area of s, which represents the image pair<A1,B> A1 and B select image blocks of area s for texture matching.<A2,B> Similarly. The texture matching position of each image pair includes the position of each image pair during the texture matching process, for example, the texture matching position can be a center position or an edge position; the texture matching order refers to the order in which the texture matching is performed. Optionally, the image resolution of the object image has a positive correlation with the texture matching area of each image pair, that is, the higher the image resolution of the object image, the larger the texture matching area of each image pair.
[0048] Specifically, the texture matching area of each image pair can be calculated according to the image resolution of the object image of the object to be detected and the conversion factor between the resolution and the area. When the object shape of the object to be detected in the transformed image is the first object shape, the texture matching position of each image pair is determined to be the center position of each image pair and the texture matching order of each image pair is the order from the center position to the edge position. When the object shape of the object to be detected in the transformed image is the second object shape, the texture matching position of each image pair is determined to be the target edge position among the edge positions of each image pair and the texture matching order of each image pair is the order from the target edge position to the center position.
[0049] The first object shape may be a circular shape, which may be a circular shape in which the overall outline of the object to be detected is a circular shape, including an elliptical shape; the second object shape may be other shapes except a circular shape, such as a parallelogram, a rhombus, a rectangle, etc. The target edge position in the edge position may be an edge position with an angle in the edge position, such as the positions of the four corners of a parallelogram.
[0050] In order to improve the convenience and efficiency of texture matching of each image pair, the texture matching area in the merged image data may be firstly compared with the elements to save the time cost of texture matching. In the first optional implementation manner provided by this embodiment, in the process of performing texture matching processing on the merged image data according to the texture matching strategy to obtain the texture matching index of each image pair, the following operations are performed: Determining a texture matching region of each image pair according to the texture matching area and the texture matching position; According to the texture matching order, element comparison is performed on the texture element sequence in the texture matching area in the merged image data, and the texture element matching degree of each image pair is calculated based on the element comparison result.
[0051] The texture matching region of each image pair includes an image region where texture matching is performed on each image pair.
[0052] Specifically, in the process of performing element comparison on the texture element sequence in the texture matching area in the merged image data according to the texture matching order, and calculating the texture element matching degree based on the element comparison result, the texture elements of each image pair in the texture matching area in the merged image data can be compared according to the texture matching order, and the texture element matching degree can be calculated based on the element comparison result. The texture elements here can be pixel points, and the pixel values of the pixel points can be compared, and the texture element matching degree can be the pixel matching degree. In addition, the types of texture elements and the number of each type of texture elements of each image pair in the texture matching area in the merged image data can be compared according to the texture matching order, and the texture element matching degree can be calculated based on the comparison result; the texture elements here can also be texture elements divided by color, such as white texture elements and red texture elements, and the texture elements here can also be texture elements divided by structure, such as circle texture elements and strip texture elements.
[0053] For example, the image pair is<A1,B> The texture matching area refers to the image area where A1 and B are texture matched. The image pair can be matched according to the texture matching order.<A1,B> The texture elements of A1 and B in the texture matching area in the merged image data are compared, and the texture element matching degree is calculated based on the element comparison result.
[0054] In addition, the first optional implementation method of performing texture matching processing on the merged image data can be executed based on the first implementation method of determining the texture matching strategy of each image pair provided above.
[0055] (2) Implementation method 2 In practical applications, different texture extraction methods may exist for different objects to be detected, and different texture extraction methods are used to meet the diverse needs of the objects to be detected. In the second optional implementation provided by this embodiment, in the process of determining the texture matching strategy of each image pair based on the image parameters of the object image, the following operations are performed: Determining a candidate texture extraction method for each of the image pairs according to the number of color types of the object image; A texture extraction method is screened out from the candidate texture extraction methods based on the image specification of the transformed image.
[0056] The number of color types of the object image refers to the number of different color types contained in the object image; the image specification of the transformed image refers to the image size of the transformed image, that is, the image size. The texture extraction method here refers to the method of extracting texture features.
[0057] In specific implementation, texture features are extracted from the merged image data by different texture extraction methods to improve the flexibility of texture matching, thereby improving the success rate of texture matching. In the second optional implementation provided by this embodiment, in the process of performing texture matching processing on the merged image data according to the texture matching strategy and obtaining the texture matching index of each image pair, the following operations are performed: According to the texture extraction method, extracting the texture color features, texture structure features and / or texture element specification features of the transformed image and each preset object image from the merged image data; The feature matching degree between the transformed image and each preset object image is calculated according to the texture color feature, the texture structure feature and / or the texture element specification feature.
[0058] Among them, the texture color feature refers to the feature that characterizes the color of the texture; the texture structure feature refers to the feature that characterizes the structure of the texture, and the texture structure feature includes texture shape features and texture specification features of each texture shape feature. In addition, the texture structure feature may also include other types of texture features; the texture element specification feature refers to the feature that characterizes the specification of the texture element, such as the specification feature of the white texture element, which represents the size feature of the white texture element.
[0059] In addition, the second optional implementation method of performing texture matching processing on the merged image data may be performed based on the second implementation method of determining the texture matching strategy of each image pair provided above.
[0060] Based on the above-mentioned method of determining the candidate texture extraction method of each image pair according to the number of color types of the object image, in an optional implementation manner provided by this embodiment, in the process of determining the candidate texture extraction method of each image pair according to the number of color types of the object image, the following operations are performed: If the number of color types is greater than the number threshold, determining that the candidate texture extraction methods include a texture color extraction method, a texture structure extraction method, and a texture element specification extraction method; If the number of color types is less than or equal to the number threshold, it is determined that the candidate texture extraction method includes the texture structure extraction method and the texture element specification extraction method.
[0061] Based on the above-mentioned screening out of the texture extraction methods from the candidate texture extraction methods based on the image specification of the transformed image, in an optional implementation manner provided by this embodiment, in the process of screening out of the texture extraction methods from the candidate texture extraction methods based on the image specification of the transformed image, the following operations are performed: If the image specification of the transformed image is smaller than a specification threshold, the texture element specification extraction method is eliminated from the candidate texture extraction methods to obtain the texture extraction method.
[0062] (3) Implementation method three In practical applications, the merged image data of each image pair may only include channel data, but not coordinate data. Therefore, in order to better fit the texture matching of the channel data, in the third optional implementation provided by this embodiment, the texture matching length of each image pair can be calculated according to the image resolution of the object image. Specifically, in the process of determining the texture matching strategy of each image pair based on the image parameters of the object image, the following operations can be performed: determining an image resolution of the image of the object; The texture matching length of each image pair is calculated according to the image resolution.
[0063] The texture matching length of each image pair includes the matching length of texture matching in the merged image data.
[0064] In order to improve the efficiency of texture matching, in a third optional implementation manner provided in this embodiment, in the process of performing texture matching processing on the merged image data according to the texture matching strategy to obtain the texture matching index of each image pair, the following operations are performed: Extracting key merge channel data from the merge channel data according to the texture matching length; The texture matching degree of each image pair is calculated according to the texture element distribution in the key merging channel data.
[0065] Among them, the key merged channel data refers to the key merged channel data corresponding to the texture matching length in the merged channel data; the texture element distribution includes the number of identical texture elements in the key merged channel data of each preset object image and the number of identical texture elements in the key merged channel data of the transformed image, such as the number of white texture elements and the number of red texture elements in the key merged channel data of each preset object image, and the number of white texture elements and the number of red texture elements in the key merged channel data of the transformed image.
[0066] In addition, based on the third implementation method of determining the texture matching strategy for each image pair provided above, the third optional implementation method of performing texture matching processing on the merged image data can be executed.
[0067] Optionally, step S206, determines the texture matching strategy of each image pair based on the image parameters of the object image, and performs texture matching processing on the merged image data according to the texture matching strategy to obtain the texture matching index of each image pair, and executes based on the texture matching model; optionally, the input of the texture matching model is the merged image data of each image pair, and the output is the detection result of the object to be detected; the texture matching model is a binary classification model.
[0068] On the basis that step S206 can be performed by a texture matching model, in a fourth optional implementation manner provided by this embodiment, the texture matching model can perform texture matching processing on the merged image data in the following manner: Decompressing the first compressed data and the second compressed data in the combined image data to obtain image data of each preset object image and image data of the transformed image; Extracting texture features from the image data of each preset object image and the image data of the transformed image according to the texture matching strategy to obtain respective texture features; The feature matching degree of the respective texture features is calculated as the texture matching index.
[0069] In practical applications, in order to improve the efficiency of texture matching, the above-mentioned object image of the object to be detected can be collected through the image acquisition page, and the transformed image and the merged image data of each image pair can be prepared in advance. On this basis, the above-mentioned step S206 can be executed after detecting the detection instruction submitted based on the image acquisition page.
[0070] Step S208, scoring the texture matching index according to the transformed coordinates corresponding to the image coordinate transformation, and determining the detection result of the object to be detected based on the scoring result.
[0071] The above-mentioned texture matching strategy of each image pair is determined based on the image parameters of the object image, and the merged image data is texture matched according to the texture matching strategy to obtain the texture matching index of each image pair. In this step, the transformation coordinates corresponding to the image coordinate transformation may have different importance in the texture matching process. Therefore, in order to improve the accuracy and effectiveness of the texture matching index of each image pair, and then improve the accuracy of the detection result of the object to be detected, the texture matching index of each image pair can be scored according to the transformation coordinates corresponding to the image coordinate transformation, and the detection result of the object to be detected can be determined based on the scoring result.
[0072] The test results of the items to be tested in this embodiment include the quality test results and / or traceability test results of the items to be tested, and the traceability test results refer to the results of testing the factory information of the items to be tested; the quality test results include the test pass results and / or the test fail results, and the quality test results include the results of quality testing of the items to be tested, and also include the results of authenticity testing of the items to be tested. Authenticity testing refers to testing whether the items to be tested are authentic or forged.
[0073] In specific implementation, the texture matching index can be weightedly calculated according to the coordinate weight of the transformed coordinates corresponding to the image coordinate transformation to obtain the weighted matching index of each image pair. If there is an image pair whose value is greater than the matching index threshold among the weighted matching indicators of each image pair, the quality inspection result or authenticity inspection result of the object to be inspected is determined to be passed. If there is no image pair whose value is greater than the matching index threshold among the weighted matching indicators of each image pair, the quality inspection result or authenticity inspection result of the object to be inspected is determined to be failed.
[0074] In the specific implementation process, in order to improve the effectiveness of the texture matching index of each image pair, the texture matching index of each image pair can be corrected according to the transformation coordinates corresponding to the image coordinate transformation; in the process of scoring the texture matching index according to the transformation coordinates corresponding to the image coordinate transformation, the following operations can be performed: Determining a coordinate weight of each transformed coordinate among a plurality of transformed coordinates corresponding to the image coordinate transformation; The texture matching index of each image pair is weightedly calculated according to the coordinate weight, and the weighted matching index of each image pair is obtained as the scoring result.
[0075] The coordinate weight of each transformed coordinate is used to represent the importance of each transformed coordinate in the texture matching process.
[0076] Specifically, in the process of performing weighted calculation on the texture matching index of each image pair according to the coordinate weight to obtain the weighted matching index of each image pair, the product of the coordinate weight of each transformed coordinate in multiple transformed coordinates and the texture matching index of the corresponding image pair can be calculated as the weighted matching index of the image pair as the scoring result of the image pair.
[0077] In addition, based on the first method of performing texture matching processing on the merged image data provided above, in an optional implementation manner provided by this embodiment, in the process of scoring the texture matching index according to the transformed coordinates corresponding to the image coordinate transformation, the following operations are performed: Determining a coordinate weight of each transformed coordinate among a plurality of transformed coordinates corresponding to the image coordinate transformation; The texture element matching degree of each image pair is weightedly calculated according to the coordinate weights to obtain the weighted matching degree of each image pair as the scoring result.
[0078] In the process of determining the coordinate weight of each transformed coordinate, in an optional implementation manner provided by this embodiment, the coordinate weight of each transformed coordinate is obtained by the following method: Obtain target transformation coordinates corresponding to the target transformation image of the historical item image; The number of coordinates of each target transformed coordinate in the target transformed coordinates is calculated, and the coordinate weight of each transformed coordinate is calculated according to the number of coordinates.
[0079] Among them, the historical item image refers to an item image obtained historically. The historical item image here can be a historical item image of an item that is consistent with the item category of the item to be detected in this embodiment, or it can be a historical item image of an item that is inconsistent with the item category of the item to be detected.
[0080] Specifically, in the process of calculating the coordinate weight of each transformed coordinate according to the coordinate number, the coordinate number of each transformed coordinate in the coordinate number of each target transformed coordinate can be determined, and the coordinate weight of each transformed coordinate can be calculated according to the coordinate number of each transformed coordinate.
[0081] It should be noted that the coordinate weights of the transformed coordinates may also be obtained by random allocation.
[0082] In order to improve the detection accuracy and effectiveness of the object to be detected, after obtaining the texture matching index of each image pair, the object image of the object to be detected can also be subjected to secondary coordinate transformation, and further texture matching can be performed; in the process of determining the detection result of the object to be detected based on the scoring result, the following operations can be performed: Determining a target image pair from among the image pairs according to the weighted matching index of each image pair, and performing secondary coordinate sampling based on the transformation coordinates corresponding to the target image pair to obtain secondary transformation coordinates; The object image is subjected to a secondary coordinate transformation according to the secondary transformation coordinates to obtain a secondary transformation image, and a detection result of the object to be detected is determined based on a texture feature comparison result between the secondary transformation image and a preset object image in the target image pair.
[0083] The secondary transformation coordinates may be one or more, and the secondary transformation images may be one or more. The transformation coordinates corresponding to the target image pair refer to the transformation coordinates corresponding to the transformation image included in the target image pair.
[0084] Specifically, in the process of determining the target image pair among the image pairs according to the weighted matching index of each image pair, and performing secondary coordinate sampling based on the transformation coordinates corresponding to the target image pair to obtain the secondary transformation coordinates, the weighted matching index of each image pair can be sorted, and the target image pair corresponding to the weighted matching index whose sorting position is before the preset position is determined in the sorting result, and secondary coordinate sampling is performed on the transformation coordinates of the transformation image in the target image pair to obtain the secondary transformation coordinates.
[0085] It should be added that, based on the first optional implementation of performing texture matching processing on the merged image data provided above, or based on the optional implementation of performing scoring processing on the texture matching index according to the transformed coordinates corresponding to the image coordinate transformation provided above, in the first optional implementation provided by this embodiment, in the process of determining the detection result of the object to be detected based on the scoring result, the following operations are performed: Determining a target image pair from among the image pairs according to the weighted matching degrees of the image pairs, and performing secondary coordinate sampling based on the transformation coordinates corresponding to the target image pair to obtain secondary transformation coordinates; The object image is subjected to a secondary coordinate transformation according to the secondary transformation coordinates to obtain a secondary transformation image, and a detection result of the object to be detected is determined based on a texture feature comparison result between the secondary transformation image and a preset object image in the target image pair.
[0086] In practical applications, the scoring results of each image pair may include a scoring result greater than the scoring threshold, or a scoring result less than or equal to the scoring threshold. In the second optional implementation provided by this embodiment, in the process of determining the detection result of the object to be detected based on the scoring result, the following operations are performed: Determine whether there is a scoring result greater than a scoring threshold among the scoring results of the image pairs; If so, the detection result of the object to be detected is determined to be passed.
[0087] On this basis, in an optional implementation manner provided by this embodiment, if the result of the execution of determining whether there is a scoring result greater than the scoring threshold in the scoring results of the image pairs is that there is no scoring result, the following operations are performed: Determine a target scoring result in the scoring results of each image pair, and determine a target transformation coordinate corresponding to a transformation image in a specific image pair corresponding to the target scoring result; Determine an intermediate value of secondary coordinate sampling according to a difference between the target scoring result and the scoring threshold, and perform secondary coordinate sampling according to the intermediate value, the number of transformed coordinates of the image coordinate transformation, and the target transformed coordinates to obtain secondary transformed coordinates; Performing a secondary coordinate transformation on the object image according to the secondary transformation coordinates to obtain a secondary transformation image, and determining texture similarity according to a texture comparison result between the secondary transformation image and a preset object image in the specific image pair; If there is a texture similarity greater than the similarity threshold among the texture similarities, the detection result of the object to be detected is determined to be passed; if there is no texture similarity greater than the similarity threshold among the texture similarities, the detection result of the object to be detected is determined to be failed.
[0088] Specifically, in the process of determining the target scoring result in the scoring results of each image pair, the scoring results of each image pair may be sorted, and the scoring result whose arrangement position is before the preset position in the sorted results may be determined as the target scoring result. In the process of determining the intermediate value of the secondary coordinate sampling according to the difference between the target scoring result and the scoring threshold, the intermediate value of the difference mapping between the target scoring result and the scoring threshold can be searched in the difference mapping table; in the process of performing secondary coordinate sampling according to the intermediate value, the transformation number of the image coordinate transformation and the target transformation coordinate to obtain the secondary transformation coordinate, the sampling number of the secondary coordinate sampling can be determined according to the intermediate value and the transformation number of the image coordinate transformation, and the target transformation coordinate is subjected to secondary coordinate sampling according to the sampling number of the secondary coordinate sampling to obtain the secondary transformation coordinate; in the process of determining the sampling number of the secondary coordinate sampling according to the intermediate value and the transformation number of the image coordinate transformation, the intermediate value and the transformation number of the image coordinate transformation can also be input into the number calculation algorithm to perform sampling number calculation to obtain the sampling number of the secondary coordinate sampling; for example, the transformation images include B1, B2, B3, and B4, and the transformation image in the image pair corresponding to the target scoring result is determined to be B3, M represents the intermediate value, and according to the angle interval of 360 / M, 2*(M / K-1) angles are taken as the secondary deflection angles for the neighborhood of the target deflection angle corresponding to B3.
[0089] For example, the number calculation algorithm includes 2*(M / K-1), K represents the number of transformations of the image coordinate transformation, and M represents the intermediate value.
[0090] It should be noted that the second optional implementation method of determining the detection result of the object to be detected provided here can also be executed on the basis of the second optional implementation method of performing texture matching processing on the merged image data provided above.
[0091] Optionally, step S208, scores the texture matching index according to the transformed coordinates corresponding to the image coordinate transformation, and determines the detection result of the object to be detected based on the scoring result, and executes it based on the texture matching model; optionally, step S208 is executed after detecting the detection instruction submitted based on the image acquisition page.
[0092] It should be supplemented that the optional implementation methods for each step from step S202 to step S208 provided above can be executed separately, or can be combined with each other and referenced to each other, and this embodiment does not make any specific limitations here.
[0093] In summary, the one or more image processing methods provided in the present embodiment firstly perform image coordinate transformation on the object image of the object to be detected to obtain a transformed image, obtain a plurality of preset object images, perform data merging processing on the image data of the image pairs consisting of each preset object image and the transformed image, obtain merged image data of each image pair, determine the image resolution of the object image, and calculate the texture matching area of each image pair according to the image resolution and the conversion factor between the resolution and the area, determine the texture matching position and the texture matching order of each image pair based on the object shape of the object to be detected in the transformed image, determine the texture matching area of each image pair according to the texture matching area and the texture matching position, and perform texture matching on the merged image data according to the texture matching order. Performing element comparison on the texture element sequence in the texture matching area, and calculating the texture element matching degree based on the element comparison result, secondly, determining the coordinate weight of each transformed coordinate in the multiple transformed coordinates corresponding to the image coordinate transformation, performing weighted calculation on the texture matching index of each image pair according to the coordinate weight, obtaining the weighted matching index of each image pair, determining the target image pair in each image pair according to the weighted matching index of each image pair, and performing secondary coordinate sampling based on the transformed coordinates corresponding to the target image pair to obtain the secondary transformed coordinates, performing secondary coordinate transformation on the object image according to the secondary transformed coordinates to obtain the secondary transformed image, and determining the detection result of the object to be detected according to the texture feature comparison result of the secondary transformed image and the preset object image in the target image pair; Alternatively, first, an image coordinate transformation is performed on an object image of the object to be detected to obtain a transformed image, and a plurality of preset object images are obtained. Image data of an image pair consisting of each preset object image and the transformed image is merged to obtain merged image data of each image pair. A candidate texture extraction method for each image pair is determined according to the number of color types of the object image. A texture extraction method is screened out from the candidate texture extraction methods based on the image specification of the transformed image. According to the texture extraction method, texture color features, texture structure features and / or texture element specification features of the transformed image and each preset object image are extracted from the merged image data. A feature matching degree between the transformed image and each preset object image is calculated according to the texture color features, texture structure features and / or texture element specification features. Secondly, a texture matching index of each image pair is weightedly calculated according to the coordinate weight of the transformed coordinates corresponding to the image coordinate transformation to obtain a weighted matching index of each image pair as a scoring result of each image pair. It is judged whether there is a scoring result greater than a scoring threshold in the scoring results of each image pair. If there is a scoring result, the weighted matching index is obtained. , determine that the detection result of the object to be detected is passed, if not, determine the target scoring result in the scoring results of each image pair, and determine the target transformation coordinates corresponding to the transformed image in the image pair corresponding to the target scoring result, determine the intermediate value of the secondary coordinate sampling according to the difference between the target scoring result and the scoring threshold, and perform secondary coordinate sampling according to the intermediate value, the number of transformations of the image coordinate transformation and the target transformation coordinates to obtain the secondary transformation coordinates, perform secondary coordinate transformation on the object image according to the secondary transformation coordinates to obtain the secondary transformation image, and determine the texture similarity according to the texture comparison result of the secondary transformation image and the preset object image in the image pair, if there is a texture similarity greater than the similarity threshold in the texture similarity, determine that the detection result of the object to be detected is passed, if there is no texture similarity greater than the similarity threshold in the texture similarity, determine that the detection result of the object to be detected is failed, thereby improving the flexibility of texture matching through two stages of different texture matching methods, improving the accuracy and effectiveness of texture matching, and further improving the accuracy of the detection result of the object to be detected.
[0094] The following uses an image processing method provided in this embodiment as an example to further illustrate the image processing method provided in this embodiment. Figure 4 , an image processing method applied to the first image detection scene specifically includes the following steps.
[0095] Step S402 , performing image coordinate transformation on the object image of the object to be detected to obtain a transformed image, and obtaining a plurality of preset object images.
[0096] Step S404: performing data merging processing on the image data of each image pair consisting of the preset object image and the transformed image to obtain merged image data of each image pair.
[0097] Step S406, determining the image resolution of the object image, and calculating the texture matching area of each image pair according to the image resolution and the conversion factor between resolution and area.
[0098] Step S408 : determining the texture matching position and texture matching order of each image pair based on the object shape of the object to be detected in the transformed image.
[0099] Step S410, determining the texture matching region of each image pair according to the texture matching area and the texture matching position, and performing element comparison on the texture element sequence within the texture matching region in the merged image data according to the texture matching order, and calculating the texture element matching degree of each image pair based on the element comparison result.
[0100] Step S412 , weighted calculation is performed on the texture element matching degree of each image pair according to the coordinate weight of the transformed coordinate corresponding to the image coordinate transformation, so as to obtain the weighted matching degree of each image pair.
[0101] Step S414 , determining a target image pair from among the image pairs according to the weighted matching degree of each image pair, and performing secondary coordinate sampling based on the transformation coordinates corresponding to the target image pair to obtain secondary transformation coordinates.
[0102] Step S416, performing secondary coordinate transformation on the object image according to the secondary transformation coordinates to obtain a secondary transformation image, and determining the detection result of the object to be detected according to the texture feature comparison result of the secondary transformation image and the preset object image in the target image pair.
[0103] It should be noted that any one of steps S402 to S416 or any combination of multiple steps can be replaced by the corresponding technical means provided in the above steps S202 to S208 according to the needs of implementation and deployment, and will not be described one by one here.
[0104] The following uses an application of an image processing method provided by this embodiment in a second image detection scene as an example to further illustrate the image processing method provided by this embodiment. Figure 5 , the image processing method applied to the second image detection scene specifically includes the following steps.
[0105] Step S502 , performing image coordinate transformation on the object image of the object to be detected to obtain a transformed image, and obtaining a plurality of preset object images.
[0106] Step S504: extracting first channel data from the image data of each preset object image, and extracting second channel data from the image data of the transformed image.
[0107] Step S506: Merge the first channel data and the second channel data to obtain merged channel data of each image pair.
[0108] Step S508: Calculate the texture matching length of each image pair according to the image resolution of the object image.
[0109] Step S510 , extracting key merged channel data from the merged channel data according to the texture matching length, and calculating the texture matching degree of each image pair according to the texture element distribution in the key merged channel data.
[0110] Step S512 , weighted calculation is performed on the texture matching degree of each image pair according to the coordinate weight of the transformed coordinate corresponding to the image coordinate transformation, and the weighted matching degree of each image pair is obtained as a scoring result.
[0111] Step S514, determining whether there is a scoring result greater than a scoring threshold among the scoring results of each image pair; If so, the quality test result of the item to be tested is determined to be passed; If not present, execute the following steps S516 to S522.
[0112] Step S516, determining a target scoring result in the scoring results of each image pair, and determining a target transformation coordinate corresponding to the transformation image in the specific image pair corresponding to the target scoring result.
[0113] Step S518, determining the intermediate value of the secondary coordinate sampling according to the difference between the target scoring result and the scoring threshold, and performing secondary coordinate sampling according to the intermediate value, the number of transformed coordinates of the image coordinate transformation and the target transformed coordinates to obtain secondary transformed coordinates.
[0114] Step S520 , performing secondary coordinate transformation on the object image according to the secondary transformation coordinates to obtain a secondary transformation image, and determining texture similarity based on a texture comparison result between the secondary transformation image and a preset object image in the specific image pair.
[0115] Step S522: If there is a texture similarity greater than the similarity threshold in the texture similarities, it is determined that the authenticity detection result of the object to be detected is detection passed.
[0116] It should be noted that any one of steps S502 to S522 or any combination of multiple steps can be replaced by the corresponding technical means provided in the above steps S202 to S208 according to the needs of implementation and deployment, and will not be described one by one here.
[0117] An embodiment of an image processing device provided in this specification is as follows: In the above-mentioned embodiment, an image processing method is provided, and correspondingly, an image processing device is also provided, which will be described below with reference to the accompanying drawings.
[0118] Reference Figure 6 , which shows a schematic diagram of an image processing device embodiment provided by this embodiment.
[0119] Since the device embodiment corresponds to the method embodiment, the description is relatively simple, and the relevant parts can refer to the corresponding description of the method embodiment provided above. The device embodiment described below is only illustrative.
[0120] This embodiment provides an image processing device, including: An image transformation module 602 is configured to perform image coordinate transformation on an object image of an object to be detected to obtain a transformed image, and to obtain a plurality of preset object images; A data merging module 604 is configured to perform data merging processing on the image data of the image pairs consisting of each preset object image and the transformed image to obtain merged image data of each image pair; The texture matching module 606 is configured to determine a texture matching strategy for each of the image pairs based on the image parameters of the object image, and perform texture matching processing on the merged image data according to the texture matching strategy to obtain a texture matching index for each of the image pairs; The scoring processing module 608 is configured to score the texture matching index according to the transformed coordinates corresponding to the image coordinate transformation, and determine the detection result of the object to be detected based on the scoring result.
[0121] An embodiment of an image processing device provided in this specification is as follows: Corresponding to the image processing method described above, based on the same technical concept, one or more embodiments of this specification further provide an image processing device, which is used to execute the image processing method provided above. Figure 7 A schematic diagram of the structure of an image processing device provided in one or more embodiments of this specification.
[0122] This embodiment provides an image processing device, including: like Figure 7As shown, the image processing device may have relatively large differences due to different configurations or performances, and may include one or more processors 701 and memory 702, and the memory 702 may store one or more storage applications or data. Among them, the memory 702 may be a temporary storage or a permanent storage. The application stored in the memory 702 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the image processing device. Furthermore, the processor 701 may be configured to communicate with the memory 702, and execute a series of computer executable instructions in the memory 702 on the image processing device. The image processing device may also include one or more power supplies 703, one or more wired or wireless network interfaces 704, one or more input / output interfaces 705, one or more keyboards 706, etc.
[0123] In a specific embodiment, the image processing device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions for the image processing device, and the one or more programs are configured to be executed by one or more processors, including computer executable instructions for performing the following: Performing image coordinate transformation on the object image of the object to be detected to obtain a transformed image, and obtaining a plurality of preset object images; Performing data merging processing on image data of image pairs consisting of each preset object image and the transformed image to obtain merged image data of each image pair; Determining a texture matching strategy for each of the image pairs based on image parameters of the object image, and performing texture matching processing on the merged image data according to the texture matching strategy to obtain a texture matching index for each of the image pairs; The texture matching index is scored according to the transformed coordinates corresponding to the image coordinate transformation, and the detection result of the object to be detected is determined based on the scoring result.
[0124] An embodiment of a storage medium provided in this specification is as follows: Corresponding to the image processing method described above, based on the same technical concept, one or more embodiments of this specification also provide a storage medium.
[0125] The storage medium provided in this embodiment is used to store computer executable instructions, and the computer executable instructions implement the following process when executed by a processor: Performing image coordinate transformation on the object image of the object to be detected to obtain a transformed image, and obtaining a plurality of preset object images; Performing data merging processing on image data of image pairs consisting of each preset object image and the transformed image to obtain merged image data of each image pair; Determining a texture matching strategy for each of the image pairs based on image parameters of the object image, and performing texture matching processing on the merged image data according to the texture matching strategy to obtain a texture matching index for each of the image pairs; The texture matching index is scored according to the transformed coordinates corresponding to the image coordinate transformation, and the detection result of the object to be detected is determined based on the scoring result.
[0126] It should be noted that an embodiment of a storage medium in this specification and an embodiment of an image processing method in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the aforementioned corresponding method, and the repeated parts will not be repeated.
[0127] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referenced to each other. Each embodiment focuses on the differences from other embodiments. For example, the device embodiment, equipment embodiment and storage medium embodiment are similar to the method embodiment, so the description is relatively simple. To read the relevant content in the device embodiment, equipment embodiment and storage medium embodiment, please refer to the partial description of the method embodiment.
[0128] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0129] In the 1930s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to circuit structures such as diodes, transistors, switches, etc.) or software improvements (improvements to method flows). However, with the development of technology, many of today's method flow improvements can be regarded as direct improvements to hardware circuit structures. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using hardware entity modules. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask chip manufacturers to design and produce dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0130] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.
[0131] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0132] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing the embodiments of this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0133] It should be understood by those skilled in the art that one or more embodiments of the present specification may be provided as a method, system or computer program product. Therefore, one or more embodiments of the present specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0134] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable image processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable image processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0135] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable image processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0136] These computer program instructions may also be loaded onto a computer or other programmable image processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0137] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0138] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0139] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0140] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0141] One or more embodiments of the present specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0142] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0143] The above description is only an embodiment of this document and is not intended to limit this document. For those skilled in the art, this document may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this document should be included in the scope of the claims of this document.
Claims
1. An image processing method, comprising: Performing image angle deflection on the object image of the object to be inspected to obtain a deflected image, and obtaining a plurality of preset object images; Determining a texture matching strategy for an image pair consisting of each preset object image and the deflected image based on image parameters of the object image, and performing texture matching processing on image data of the image pair according to the texture matching strategy to obtain a texture matching index; The texture matching index is scored according to the deflection angle corresponding to the image angle deflection, and the detection result of the object to be detected is determined based on the scoring result.
2. The image processing method according to claim 1, wherein the step of determining a texture matching strategy of an image pair consisting of each preset object image and the deflected image based on the image parameters of the object image comprises: Determining an image resolution of the object image, and calculating a texture matching area of the image pair based on the image resolution and a conversion factor between resolution and area; Based on the object shape of the object to be detected in the deflected image, a texture matching position and a texture matching order of the image pair are determined.
3. The image processing method according to claim 2, wherein the step of performing texture matching processing on the image data of the image pair according to the texture matching strategy to obtain a texture matching index comprises: Determining a texture matching region of the image pair according to the texture matching area and the texture matching position; According to the texture matching order, element comparison is performed on the texture element sequence in the texture matching area in the image data, and the texture element matching degree of the image pair is calculated based on the element comparison result.
4. The image processing method according to claim 3, wherein the step of scoring the texture matching index according to the deflection angle corresponding to the image angle deflection comprises: Determining an angle weight of each deflection angle among a plurality of deflection angles corresponding to the image angle deflection; The texture element matching degree of the image pair is weightedly calculated according to the angle weight, and the weighted matching degree of the image pair is obtained as the scoring result.
5. The image processing method according to claim 4, wherein determining the detection result of the object to be detected based on the scoring result comprises: Determining a target image pair in the image pair according to the weighted matching degree of the image pair, and performing secondary angle sampling based on the deflection angle corresponding to the target image pair to obtain a secondary deflection angle; The object image is deflected at a secondary angle according to the secondary deflection angle to obtain a secondary deflected image, and a detection result of the object to be detected is determined based on a comparison result of texture features between the secondary deflected image and a preset object image in the target image pair.
6. The image processing method according to claim 4, wherein the angle weight of each deflection angle is obtained by: Obtaining a target deflection angle corresponding to a target deflection image of the historical object image; The number of angles of each target deflection angle in the target deflection angles is calculated, and the angle weight of each deflection angle is calculated according to the number of angles.
7. The image processing method according to claim 1, wherein the step of determining a texture matching strategy of an image pair consisting of each preset object image and the deflected image based on the image parameters of the object image comprises: Determining a candidate texture extraction method for the image pair according to the number of color types of the object image; A texture extraction method is screened out from the candidate texture extraction methods based on the image specification of the deflected image.
8. The image processing method according to claim 7, wherein the step of performing texture matching processing on the image data of the image pair according to the texture matching strategy to obtain a texture matching index comprises: According to the texture extraction method, extracting the texture color features, texture structure features and / or texture element specification features of the deflected image and each preset object image from the image data; The feature matching degree between the deflected image and each preset object image is calculated according to the texture color feature, the texture structure feature and / or the texture element specification feature.
9. The image processing method according to claim 8, wherein determining the detection result of the object to be detected based on the scoring result comprises: Determine whether there is a scoring result greater than a scoring threshold among the scoring results of the image pair; If so, the detection result of the object to be detected is determined to be passed.
10. The image processing method according to claim 9, if the result of the operation of determining whether there is a scoring result greater than a scoring threshold in the scoring results of the image pair is that there is no scoring result, performing the following operation: Determine a target scoring result in the scoring results of the image pair, and determine a target deflection angle corresponding to a deflected image in a specific image pair corresponding to the target scoring result; Determine an intermediate value of secondary angle sampling according to a difference between the target scoring result and the scoring threshold, and perform secondary angle sampling according to the intermediate value, the number of deflection angles of the image angle deflection, and the target deflection angle to obtain a secondary deflection angle; Performing secondary angle deflection on the object image according to the secondary deflection angle to obtain a secondary deflection image, and determining texture similarity according to a texture comparison result between the secondary deflection image and a preset object image in the specific image pair; If there is a texture similarity greater than a similarity threshold among the texture similarities, it is determined that the detection result of the object to be detected is detection passed.
11. The image processing method according to claim 7, wherein determining the candidate texture extraction method of the image pair according to the number of color types of the object image comprises: If the number of color types is greater than the number threshold, determining that the candidate texture extraction methods include a texture color extraction method, a texture structure extraction method, and a texture element specification extraction method; If the number of color types is less than or equal to the number threshold, it is determined that the candidate texture extraction method includes the texture structure extraction method and the texture element specification extraction method.
12. The image processing method according to claim 11, wherein the step of selecting a texture extraction method from the candidate texture extraction methods based on the image specification of the deflected image comprises: If the image specification of the deflected image is less than a specification threshold, the texture element specification extraction method is eliminated from the candidate texture extraction methods to obtain the texture extraction method.
13. The image processing method according to claim 1, after the steps of performing image angle deflection on the object image to be detected to obtain a deflected image and obtaining a plurality of preset object images are performed, and the texture matching strategy of an image pair consisting of each preset object image and the deflected image is determined based on the image parameters of the object image, and texture matching processing is performed on the image data of the image pair according to the texture matching strategy, and before the step of obtaining a texture matching index is performed, the method further comprises: Extracting first channel data from the image data of each of the preset object images, and extracting second channel data from the image data of the deflected image; The first channel data and the second channel data are merged to obtain merged channel data of the image pair.
14. The image processing method according to claim 13, wherein the step of determining the texture matching strategy of the image pairs consisting of each preset object image and the deflected image based on the image parameters of the object image comprises: determining an image resolution of the image of the object; A texture matching length of the image pair is calculated according to the image resolution.
15. The image processing method according to claim 14, wherein the step of performing texture matching processing on the image data of the image pair according to the texture matching strategy to obtain a texture matching index comprises: Extracting key merge channel data from the merge channel data according to the texture matching length; The texture matching degree of the image pair is calculated according to the texture element distribution in the key merging channel data.
16. The image processing method according to claim 1, after the steps of performing image angle deflection on the object image to be detected to obtain a deflected image and obtaining a plurality of preset object images are performed, and the texture matching strategy of an image pair consisting of each preset object image and the deflected image is determined based on the image parameters of the object image, and texture matching processing is performed on the image data of the image pair according to the texture matching strategy, and before the step of obtaining a texture matching index is performed, the method further comprises: compressing the image data of each preset object image to obtain first compressed data of each preset object image, and compressing the image data of the deflected image to obtain second compressed data of the deflected image; The first compressed data and the second compressed data are combined to obtain image data of the image pair.
17. The image processing method according to claim 16, wherein the step of determining the texture matching strategy of the image pair consisting of each preset object image and the deflected image based on the image parameters of the object image, and performing texture matching processing on the image data of the image pair according to the texture matching strategy to obtain a texture matching index, and the step of scoring the texture matching index according to the deflection angle corresponding to the image angle deflection, and determining the detection result of the object to be detected based on the scoring result, are performed based on a texture matching model; in, The input of the texture matching model is the image data of the image pair, and the output is the detection result of the object to be detected; the texture matching model is a binary classification model.
18. The image processing method according to claim 17, wherein the step of performing texture matching processing on the image data of the image pair according to the texture matching strategy to obtain a texture matching index comprises: Decompressing the first compressed data and the second compressed data in the image data of the image pair to obtain the image data of each preset object image and the image data of the deflected image; Extracting texture features from the image data of each preset object image and the image data of the deflected image according to the texture matching strategy to obtain respective texture features; The feature matching degree of the respective texture features is calculated as the texture matching index.
19. The image processing method according to claim 1, before the steps of performing image angle deflection on the object image of the object to be detected to obtain a deflected image and obtaining a plurality of preset object images are performed, the method further comprises: Determining a color type of the object image and / or an object shape of the object to be detected in the object image; The number of deflection angles of the image angle deflection is determined according to the color type and / or the shape of the object.
20. The image processing method according to claim 1, after the steps of performing image angle deflection on the object image to be detected to obtain a deflected image and obtaining a plurality of preset object images are performed, and the texture matching strategy of an image pair consisting of each preset object image and the deflected image is determined based on the image parameters of the object image, and texture matching processing is performed on the image data of the image pair according to the texture matching strategy, and before the step of obtaining a texture matching index is performed, the method further comprises: The image data of each preset object image and the image data of the deflected image are combined to obtain the image data of the image pair.
21. The image processing method according to claim 20, wherein the step of merging the image data of each preset object image with the image data of the deflected image to obtain the image data of the image pair comprises: Identifying the position coordinates of the object to be detected in the deflected image; According to the image specifications of the preset object images and the position coordinates, data boundaries of the image data of the preset object images and the image data of the deflected image are adjusted to obtain the adjusted data of the preset object images and the adjusted data of the deflected image; The adjustment data of each preset object image and the adjustment data of the deflected image are combined to obtain image data of the image pair.
22. The image processing method according to claim 1, wherein the image of the object to be detected is acquired based on an image acquisition page; The steps of performing image angle deflection on the object image to be detected to obtain a deflected image and obtaining a plurality of preset object images are performed after a capture instruction submitted through the image capture page is detected; The step of determining the texture matching strategy of the image pair consisting of each preset object image and the deflected image based on the image parameters of the object image, and performing texture matching processing on the image data of the image pair according to the texture matching strategy to obtain a texture matching index, and the step of scoring the texture matching index according to the deflection angle corresponding to the image angle deflection, and determining the detection result of the object to be detected based on the scoring result, are executed after detecting the detection instruction submitted based on the image acquisition page.
23. An image processing device, comprising: An image transformation module is configured to perform image angle deflection on an object image of an object to be detected to obtain a deflected image, and to obtain a plurality of preset object images; a texture matching module configured to determine a texture matching strategy for an image pair consisting of each preset object image and the deflected image based on image parameters of the object image, and perform texture matching processing on image data of the image pair according to the texture matching strategy to obtain a texture matching index; The scoring processing module is configured to score the texture matching index according to the deflection angle corresponding to the image angle deflection, and determine the detection result of the object to be detected based on the scoring result.
24. An image processing device, comprising: processor; and a memory configured to store computer executable instructions that, when executed, cause the processor to: Performing image angle deflection on the object image of the object to be inspected to obtain a deflected image, and obtaining a plurality of preset object images; Determining a texture matching strategy for an image pair consisting of each preset object image and the deflected image based on image parameters of the object image, and performing texture matching processing on image data of the image pair according to the texture matching strategy to obtain a texture matching index; The texture matching index is scored according to the deflection angle corresponding to the image angle deflection, and the detection result of the object to be detected is determined based on the scoring result.
25. A storage medium for storing computer executable instructions, wherein the computer executable instructions, when executed by a processor, implement the following process: Performing image angle deflection on the object image of the object to be inspected to obtain a deflected image, and obtaining a plurality of preset object images; Determining a texture matching strategy for an image pair consisting of each preset object image and the deflected image based on image parameters of the object image, and performing texture matching processing on image data of the image pair according to the texture matching strategy to obtain a texture matching index; The texture matching index is scored according to the deflection angle corresponding to the image angle deflection, and the detection result of the object to be detected is determined based on the scoring result.