Image processing method and device
By performing angle transformation and color channel combination on the image, the full-angle texture feature sequence is extracted, which solves the problem of inaccurate similarity calculation caused by different image angles in traditional methods, and achieves more efficient and accurate image similarity comparison.
Patent Information
- Application Number
- CN202411304304.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-22
- Publication Date
- 2025-01-07
AI Technical Summary
Traditional image texture feature extraction methods require high image quality and low accuracy, resulting in low accuracy of image processing results, especially when the image angle is different, the image similarity cannot be accurately calculated.
By transforming the image angle, multiple transformed images are generated, and their color channel data is combined, the full angle texture feature sequence is extracted, feature transformation and comparison are performed, and the image similarity is determined.
It improves the accuracy and effectiveness of image similarity calculation, can accurately compare image similarity under different image angles, and improves the comprehensiveness and accuracy of feature extraction.
Smart Images

Figure CN119273937A_ABST
Abstract
Description
[0001] This application is a divisional application of the Chinese invention patent application with the application date of February 22, 2024, application number CN2024101995010, and name “Image Processing Method and Device”. Technical Field
[0002] This document relates to the field of image processing technology, and in particular to an image processing method and device. Background Art
[0003] The texture features of an image are a type of global features, which are used to describe the surface properties of the object corresponding to the image or image area, such as the coarseness, density and other features of the image texture. Since texture features can characterize the uniqueness of an object, they can be used in many fields such as image processing and anti-counterfeiting detection. However, traditional feature extraction methods have high requirements on image quality and low accuracy of extracted features, resulting in low accuracy of image processing results based on texture features. Therefore, how to improve the extraction accuracy of texture features will be a focus of future attention. Summary of the invention
[0004] One or more embodiments of the present specification provide an image processing method, comprising: performing image angle transformation on a first image and a second image respectively to obtain a plurality of first transformed images and a plurality of second transformed images. Combining the color channel data of the plurality of first transformed images to obtain first pixel combination data, and combining the color channel data of the plurality of second transformed images to obtain second pixel combination data. Extracting texture features based on the first transformed image data including the first pixel combination data to obtain a first texture feature sequence, and extracting texture features based on the second transformed image data including the second pixel combination data to obtain a second texture feature sequence. Performing feature transformation processing on each sub-texture feature in the first texture feature sequence, and performing texture feature comparison between the obtained transformation features and the second texture feature sequence, so as to determine image similarity according to the feature comparison result.
[0005] One or more embodiments of the present specification provide an image processing device, including: an angle transformation module, configured to perform image angle transformation on a first image and a second image respectively, to obtain a plurality of first transformed images and a plurality of second transformed images. A data combination module, configured to perform data combination on the color channel data of the plurality of first transformed images to obtain first pixel combination data, and to perform data combination on the color channel data of the plurality of second transformed images to obtain second pixel combination data. A texture feature extraction module, configured to perform texture feature extraction based on the first transformed image data including the first pixel combination data to obtain a first texture feature sequence, and to perform texture feature extraction based on the second transformed image data including the second pixel combination data to obtain a second texture feature sequence. A feature comparison module, configured to perform feature transformation processing on each sub-texture feature in the first texture feature sequence, and to perform texture feature comparison on the obtained transformation feature and the second texture feature sequence, so as to determine the image similarity according to the feature comparison 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 angle transformation on a first image and a second image respectively to obtain a plurality of first transformed images and a plurality of second transformed images. Data combination is performed on the color channel data of the plurality of first transformed images to obtain first pixel combination data, and data combination is performed on the color channel data of the plurality of second transformed images to obtain second pixel combination data. Texture feature extraction is performed based on the first transformed image data containing the first pixel combination data to obtain a first texture feature sequence, and texture feature extraction is performed based on the second transformed image data containing the second pixel combination data to obtain a second texture feature sequence. Feature transformation processing is performed on each sub-texture feature in the first texture feature sequence, and texture feature comparison is performed on the obtained transformation feature and the second texture feature sequence, so as to determine the image similarity according to the feature comparison result.
[0007] One or more embodiments of the present specification provide a computer-readable storage medium for storing computer-executable instructions, which implement the following process when executed: performing image angle transformation on a first image and a second image respectively to obtain a plurality of first transformed images and a plurality of second transformed images. Combining the color channel data of the plurality of first transformed images to obtain first pixel combination data, and combining the color channel data of the plurality of second transformed images to obtain second pixel combination data. Extracting texture features based on the first transformed image data including the first pixel combination data to obtain a first texture feature sequence, and extracting texture features based on the second transformed image data including the second pixel combination data to obtain a second texture feature sequence. Performing feature transformation processing on each sub-texture feature in the first texture feature sequence, and performing texture feature comparison between the obtained transformation features and the second texture feature sequence, so as to determine image similarity according to the feature comparison 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 users of ordinary skills 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 3 A schematic diagram of an image to be compared provided for one or more embodiments of this specification; Figure 4 A schematic diagram of a reference image provided for one or more embodiments of this specification; Figure 5 A processing flow chart of an image processing method applied to an image similarity calculation 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 users in the technical field 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 the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technical users in this field without creative work should fall within the scope of protection of this document.
[0010] The image processing method provided by one or more embodiments of this embodiment can be applied to the implementation environment of image processing. Figure 1 , the implementation environment at least includes: a server 101, an image acquisition terminal 102; The server 101 may be one or more servers, a server cluster consisting of several servers, or a cloud server of a cloud computing platform. The server 101 may extract the texture features of the two images, and perform feature comparison based on the texture features to determine the similarity of the two images; The image acquisition terminal 102 may be a smart phone, a tablet computer, an e-book reader, a wearable device, a smart watch, a device for information interaction and image acquisition based on AR (Augmented Reality) / VR (Virtual Reality), etc. The image acquisition terminal 102 may acquire images and display image similarity.
[0011] In this implementation environment, the image acquisition terminal 102 acquires the first image and the second image and uploads the first image and the second image to the server 101. The server 101 performs image angle transformation on the first image and the second image respectively to obtain a plurality of first transformed images and a plurality of second transformed images, and performs data combination on the color channel data of the plurality of first transformed images to obtain first pixel combination data, and performs data combination on the color channel data of the plurality of second transformed images to obtain second pixel combination data. Thereafter, texture feature extraction is performed based on the first transformed image data including the first pixel combination data to obtain a first texture feature sequence, and texture feature extraction is performed based on the second transformed image data including the second pixel combination data to obtain a second texture feature sequence. Finally, feature transformation processing is performed on each sub-texture feature in the first texture feature sequence, and texture feature comparison is performed on the obtained transformation feature and the second texture feature sequence, so as to determine the image similarity according to the feature comparison result.
[0012] One or more embodiments of an image processing method provided in this specification are as follows: Reference Figure 2The image processing method provided in this embodiment specifically includes steps S202 to S208.
[0013] Step S202 : performing image angle transformation on the first image and the second image respectively to obtain a plurality of first transformed images and a plurality of second transformed images.
[0014] In this embodiment, the first image and the second image are two images that are compared for similarity, wherein the first image may be an image to be compared, and the second image may be a reference image used as a reference for comparison, and optionally, the first image may be a texture image to be compared, and the second image may be a reference texture image used as a reference for texture comparison; the texture image may be a surface texture image obtained by capturing the surface texture of an object, and furthermore, the texture image may be a cross-sectional texture image or a cross-sectional texture image obtained by capturing the cross-sectional texture or cross-sectional texture of an object. The image angle change may be caused by rotating the image to change the image angle.
[0015] In practical applications, in the process of detecting the image similarity between the first image and the second image, since the shooting angle or direction of the currently acquired first image and the second image used as the comparison reference may be different, for example, Figure 3 The schematic diagram of the image to be compared is shown in Figure 4 As shown in the schematic diagram of the reference image shown, the shooting angle of the first image may be different from the shooting angle of the second image, and there is no marker that can be aligned and compared in the first image and the second image, resulting in the inability to align the first image and the second image during the image similarity calculation, and the calculated image similarity is not accurate enough. Therefore, in order to improve the accuracy and effectiveness of the image similarity calculation, this embodiment extracts the texture features of the image based on the image angle transformation of the first image and the second image, so that the texture features of the image at all angles (i.e., texture feature sequence) can be extracted.
[0016] In the specific implementation process, in order to extract the texture features of the image at all angles, the first image at each angle is obtained by transforming the first image to each angle. In an optional implementation provided by this embodiment, the image angle transformation of the first image is performed in the following manner: extracting a texture region in the first image; Performing image angle transformation on the texture region based on an angle transformation algorithm to obtain transformed texture regions at each transformation angle; The transformed texture areas at each transformation angle are respectively subjected to image stitching processing with the remaining areas in the first image to obtain the multiple first transformed images.
[0017] Specifically, in order to avoid the problem of the shape of the image boundary changing after the image is rotated, the texture area in the first image can be extracted, and the image angle transformation can be performed only on the texture area. In the process of performing the image angle transformation on the texture area, the image angle transformation can be performed on the extracted texture area based on the angle transformation algorithm to obtain the transformed texture area at each transformation angle, and then the transformed texture area at each transformation angle is respectively spliced with the remaining area in the first image to obtain multiple first transformed images. In addition, the image angle transformation can be performed on the extracted texture area based on the preset angle transformation parameters to obtain the transformed texture area at each transformation angle.
[0018] For example, there is a circular texture area at the center of the first image. After extracting the circular texture area, the circular texture area is rotated around the center of the circle at 60°, 120°, 180°, 240°, 300°, and 360° based on the angle transformation algorithm to obtain 6 circular transformed texture areas. These 6 circular transformed texture areas are then stitched with the remaining areas of the first image except the circular texture area to obtain multiple first transformed images.
[0019] It should be noted that the processing process of performing image angle transformation on the second image can refer to the processing process of performing image angle transformation on the first image, which will not be described in detail in this embodiment.
[0020] In addition, there is a case where the image quality of the acquired first image is not high. To address this, after extracting the texture area in the image, the image parameters of the first image can be determined. When the image parameters are less than the image parameter threshold, the texture area is subjected to regional enhancement processing to improve the image quality. In an optional implementation manner provided in this embodiment, the image enhancement processing is performed on the texture area in the first image in the following manner: determining image parameters of the first image; A region enhancement process is performed on a texture region in the first image based on a difference between the image parameter and an image parameter threshold.
[0021] Specifically, after extracting the texture region in the first image, the difference between the image parameter of the first image and the image parameter threshold value can be calculated. If the difference is a negative number, the texture region in the first image is subjected to regional enhancement processing; if the difference is a positive number, no processing is performed. Optionally, the image parameter includes at least one of the following: image clarity, image resolution, image saturation, image sharpness, image color accuracy, and image contrast.
[0022] In a specific implementation, in a scenario where the image similarity of a first image and a second image is compared, the first image may be a texture image collected by a user based on a texture collection page. Since the user may have a problem that the texture area of the collected texture image accounts for too large a proportion when collecting images, the texture area may be scaled based on the area proportion of the texture area and the texture image to improve the effectiveness of subsequent image similarity comparison. In an optional implementation provided in this embodiment, the texture area contained in the texture image is scaled in the following manner: Acquire a texture image collected based on a texture collection page, and identify a texture area contained in the texture image; The texture area is scaled based on the area ratio of the texture area to the texture image, and the scaled texture area is spliced with the remaining area of the texture image to obtain the first image.
[0023] Specifically, a texture image collected based on a texture collection page can be obtained by sending a texture collection page. After the texture image is collected, a texture area contained in the texture image is identified, and the texture area is scaled based on the area ratio of the texture area to the texture image to obtain a first image. In the process of scaling the texture area, if the area ratio of the texture area to the texture image exceeds a preset threshold, the texture area is scaled down according to a preset reduction parameter. In addition, if the area ratio of the texture area to the texture image is less than the preset threshold, the texture area can be enlarged according to the preset enlargement parameter.
[0024] Step S204 , combining the color channel data of the plurality of first transformed images to obtain first pixel combination data, and combining the color channel data of the plurality of second transformed images to obtain second pixel combination data.
[0025] After the image angle transformation is performed on the first image and the second image respectively to obtain a plurality of first transformed images and a plurality of second transformed images, in this step, the color channel data of the plurality of first transformed images are combined to obtain first pixel combination data, and the color channel data of the plurality of second transformed images are combined to obtain second pixel combination data.
[0026] In the specific execution process, in order to subsequently extract the texture features of the image at all angles, the color channel data of the transformed image obtained after the image angle transformation is combined to obtain pixel combination data, so that the data of the transformed image can be combined at the color channel level. Specifically, this embodiment provides two methods for combining data, which are specifically described below: (1) In a first optional implementation manner provided by this embodiment, the color channel data of the plurality of first transformed images are combined to obtain first pixel combination data in the following manner: determining an angle transformation order of each first transformed image in the plurality of first transformed images; Extracting color channel data of each of the first transformed images according to the angle transformation sequence; The color channel data of the first transformed image that comes first in the angle transformation order are sequentially added with the color channel data of other first transformed images to obtain the first pixel combination data.
[0027] Specifically, after the texture area of the first image is subjected to the image angle transformation to obtain multiple first transformed images, the angle transformation order of each first transformed image in the multiple first transformed images is first determined, and then the color channel data of each first transformed image is extracted in sequence according to the angle transformation order, and the first pixel combination data is obtained by sequentially adding the color channel data of the other first transformed images after the color channel data of the first transformed image that is the first in the angle transformation order.
[0028] For example, the first image is transformed in image angles of 90°, 180°, 270°, and 360° in sequence to obtain four first transformed images. In the process of determining the pixel combination data of the four first transformed images, the color channel data of the first transformed images of 180°, 270°, and 360° are sequentially added to the color channel data [C1] of the first transformed image of 90° to obtain the first pixel combination data [C1, C2, C3, C4].
[0029] (2) In a second optional implementation manner provided by this embodiment, the color channel data of the plurality of second transformed images are combined to obtain second pixel combination data in the following manner: extracting color channel data of each second transformed image among the plurality of second transformed images; The color channel data of the second transformed images are combined based on a random combination algorithm to obtain the second pixel combination data.
[0030] Specifically, after performing the image angle transformation on the texture area of the second image to obtain multiple second transformed images, the color channel data of each second transformed image in the multiple second transformed images is firstly extracted, and then the color channel data of each second transformed image is combined based on a random combination algorithm to obtain second pixel combination data.
[0031] For example, the second image is transformed in image angles of 90°, 180°, 270°, and 360° in sequence, and the color channel data of the four second transformed images are obtained as [C1], [C2], [C3], and [C4] respectively. In the process of determining the pixel combination data of the four second transformed images, the color channel data of the four second transformed images are combined based on a random combination algorithm to obtain the first pixel combination data [C4, C2, C1, C3].
[0032] It should be noted that the above implementation method of combining the color channel data of multiple first transformed images and the above implementation method of combining the color channel data of multiple second transformed images to obtain the second pixel combination data can be combined according to actual needs to form a new implementation method in the specific implementation process, and this embodiment does not limit this. For example, the color channel data of each first transformed image is combined based on a random combination algorithm to obtain the first pixel combination data; for another example, the color channel data of each second transformed image in the plurality of second transformed images is extracted in the order of angle transformation, and the color channel data of other second transformed images are sequentially added after the color channel data of the second transformed image with the first angle transformation order to obtain the second pixel combination data.
[0033] Step S206: extracting texture features based on the first transformed image data including the first pixel combination data to obtain a first texture feature sequence, and extracting texture features based on the second transformed image data including the second pixel combination data to obtain a second texture feature sequence.
[0034] After combining the color channel data of the plurality of first transformed images to obtain the first pixel combination data, and combining the color channel data of the plurality of second transformed images to obtain the second pixel combination data, in this step, texture feature extraction is performed based on the first transformed image data including the first pixel combination data to obtain the first texture feature sequence, and texture feature extraction is performed based on the second transformed image data including the second pixel combination data to obtain the second texture feature sequence.
[0035] The first transformed image data refers to the image data of the first transformed image. For example, the first transformed image data of four first transformed images may be: [X1, X2, X3, X4, Y1, Y2, Y3, Y4, C1, C2, C3, C4], where [C1, C2, C3, C4] is the first pixel combination data.
[0036] In the specific implementation process, based on the data combination of the color channel data of the plurality of first transformed images according to the angle transformation sequence to obtain the first pixel combination data, in order to preserve the order of the extracted texture features, the sub-texture features of each first transformed image may be calculated in sequence according to the angle transformation sequence. In an optional implementation manner provided by this embodiment, the first texture feature sequence is obtained by extracting texture features based on the first transformed image data including the first pixel combination data in the following manner: extracting sub-transformed image data of each of the first transformed images contained in the first transformed image data; Inputting the sub-transformed image data into a texture feature extraction model according to the angle transformation sequence to extract texture features, thereby obtaining sub-texture features of each first transformed image; The sub-texture features are spliced based on the angle transformation order to obtain the first texture feature sequence.
[0037] Specifically, after obtaining the first pixel combination data, sub-transformation image data of the first transformation image contained in the first transformation image data (including the first pixel combination data) is extracted, and the sub-transformation image data is input into the texture feature extraction model according to the angle transformation order to extract texture features, so as to obtain sub-texture features of each first transformation image, and the sub-texture features are feature spliced based on the angle transformation order to obtain a first texture feature sequence.
[0038] Continuing with the above example, when the first transformed image data is: [X1, X2, X3, X4, Y1, Y2, X3, Y4, C1, C2, C3, C4], it is split into four sub-transformed image data: [X1, Y1, C1], [X2, Y2, C2], [X3, Y3, C3], [X4, Y4, C4], and the data are input into the texture feature extraction model in turn for texture feature extraction to obtain sub-texture features [T1], [T2], [T3], [T4]. After feature splicing the sub-texture features based on the angle transformation order, the first texture feature sequence is obtained: [T1, T2, T3, T4].
[0039] It should be noted that, for the processing process of performing texture feature extraction based on the second transformed image data including the second pixel combination data to obtain the second texture feature sequence, reference can be made to the above-mentioned processing process of performing texture feature extraction based on the first transformed image data including the first pixel combination data to obtain the first texture feature sequence, and this embodiment will not be repeated here.
[0040] In practical applications, the training of the texture feature extraction model can be completed in advance, such as performing model training of the texture feature extraction model on a cloud server, or performing model training of the texture feature extraction model offline; in the model training process, in order to improve the training efficiency of the texture feature model, and also to reduce the difficulty of collecting training samples and the workload of model training, in an optional implementation manner provided in this embodiment, the texture feature extraction model is trained in the following manner: Inputting the pixel data sample into the texture feature extraction model to be trained to extract texture features and obtain sample texture features; Calculating the training loss based on the feature similarity between the sample texture feature and the preset sample texture feature; Parameters of the texture feature extraction model to be trained are adjusted according to the training loss.
[0041] Specifically, the pixel data samples are input into the texture feature extraction model to be trained to extract texture features, obtain sample texture features, calculate the training loss according to the feature similarity between the sample texture features and the preset sample texture features, and adjust the parameters of the texture feature extraction model to be trained according to the training loss.
[0042] Referring to the above model training method, the above training process is repeated to train the texture feature extraction model to be trained until the loss function converges. The training is completed after the loss function converges, and the texture feature extraction model to be trained after the training is completed is used as the texture feature extraction model.
[0043] Furthermore, in an optional implementation manner provided by this embodiment, the pixel data sample may be obtained in the following manner: Performing image angle transformation on the image sample based on the angle transformation parameter to obtain a transformed image sample; Performing data combination processing on the sample data of the transformed image samples to obtain combined sample data; Mask processing is performed on the combined sample data according to the mask parameters to obtain the pixel data samples.
[0044] Specifically, when obtaining pixel data samples, in order to make the training of the texture feature extraction model more effective, the image angle of the image sample can be transformed based on the angle transformation parameter to obtain the transformed image sample, the sample data of the transformed image sample can be combined to obtain the combined sample data, and the combined sample data can be masked according to the mask parameter to obtain the pixel data sample.
[0045] Step S208: performing feature transformation processing on each sub-texture feature in the first texture feature sequence, and performing texture feature comparison between the obtained transformed features and the second texture feature sequence, so as to determine image similarity according to the feature comparison result.
[0046] After the first texture feature sequence is obtained by performing texture feature extraction based on the first transformed image data including the first pixel combination data, and the second texture feature sequence is obtained by performing texture feature extraction based on the second transformed image data including the second pixel combination data, in this step, feature transformation processing is performed on each sub-texture feature in the first texture feature sequence, and texture feature comparison is performed between the obtained transformed features and the second texture feature sequence to determine image similarity based on the feature comparison result.
[0047] In the specific implementation process, since the order of each sub-texture feature in the first texture feature sequence obtained by extracting texture features based on the first transformed image data is related to the angle transformation order, it is possible to simulate various image angle transformation conditions of the first image by performing feature transformation processing on each sub-texture feature in the first texture feature sequence. In an optional implementation manner provided by this embodiment, feature transformation processing is performed on each sub-texture feature in the first texture feature sequence in the following manner: Determining a feature arrangement order of each sub-texture feature in the first texture feature sequence based on the angle transformation order; The feature arrangement order of each sub-texture feature is sequentially postponed, and a feature sequence composed of each sub-texture feature after the postponement is used as a first transformation feature; The feature arrangement order of the first transformation feature is sequentially postponed, and a feature sequence composed of the sub-texture features after the postponement is used as the first transformation feature.
[0048] Specifically, the feature arrangement order of each sub-texture feature in the first texture feature sequence can be determined based on the angle transformation order, and the feature arrangement order can be postponed in turn, and the feature sequence composed of each sub-texture feature after the postponement is used as the first transformation feature, and the feature arrangement order of each transformation feature in the first transformation feature can be postponed in turn, and the feature sequence composed of each sub-texture feature after the postponement is used as the second transformation feature, and the above process is repeated until all transformation features are obtained.
[0049] Continuing with the above example, when the first texture feature sequence is [T1, T2, T3, T4], during the feature transformation process, the feature arrangement position of the first sub-texture feature [T1] can be postponed to the second place, the feature arrangement position of the second sub-texture feature [T2] can be postponed to the third place, the third sub-texture feature [T3] can be postponed to the fourth place, and the fourth sub-texture feature [T4] can be postponed to the first place to obtain the first transformation feature [T4, T1, T2, T3]. Repeat the above process to obtain other transformation features in turn: [T3, T4, T1, T2], [T2, T3, T4, T1].
[0050] In addition, when performing feature transformation processing on each sub-texture feature in the first texture feature sequence, the feature arrangement order may be updated based on a random arrangement algorithm to obtain a transformation feature. In an optional implementation manner provided in this embodiment, feature transformation processing is performed on each sub-texture feature in the first texture feature sequence in the following manner: Determine a feature ranking of each sub-texture feature in the first texture feature sequence; The feature ranking is updated, and each sub-texture feature after the ranking is updated is used as the transformation feature.
[0051] For example, when the first texture feature sequence is [T1, T2, T3, T4], feature transformation processing is performed on each sub-texture feature in the first texture feature sequence based on a random permutation algorithm, and 4^4 transformation features can be obtained.
[0052] After performing feature transformation processing on each sub-texture feature in the first texture feature sequence and obtaining the transformed feature, the transformed feature is compared with the second texture feature sequence for texture feature, so as to determine the image similarity according to the feature comparison result. In an optional implementation manner provided by this embodiment, the obtained transformed feature is compared with the second texture feature sequence for texture feature in the following manner: Calculating feature similarity between the transformation feature and the second texture feature; If the feature similarity is greater than or equal to a feature similarity threshold, determining that the first image is similar to the second image; If the feature similarity is less than a feature similarity threshold, it is determined that the first image is not similar to the second image.
[0053] Specifically, the feature similarity between the transformed feature and the second texture feature can be calculated by calculating the Euclidean distance or cosine similarity between the transformed feature and the second texture feature. If there is a transformed feature in the transformed features whose feature similarity is greater than or equal to the feature similarity threshold, it is determined that the first image is similar to the second image. If the feature similarity of each transformed feature is less than the feature similarity threshold, it is determined that the first image is not similar to the second image. In addition, the feature similarity obtained by calculation can be represented by a feature similarity value, and the similarity value is generally between 0 and 100, indicating the degree of similarity between the two images, where 0 indicates complete dissimilarity and 100 indicates exact similarity.
[0054] In summary, the image processing method provided in the present embodiment starts from the first image and the second image for image similarity calculation, performs image angle transformation on the first image and the second image respectively, obtains a plurality of first transformed images and a plurality of second transformed images, then obtains first pixel combination data by combining the color channel data of the plurality of first transformed images, and obtains second pixel combination data by combining the color channel data of the plurality of second transformed images, obtains first image data at all angles and second image data at all angles, then extracts texture features based on the first transformed image data to obtain a first texture feature sequence, and extracts texture features based on the second transformed image data to obtain a second texture feature sequence, performs feature transformation processing on each sub-texture feature in the first texture feature sequence, simulates the image features of each transformed angle image, and finally performs texture feature comparison on the obtained transformed features and the second texture feature sequence, determines image similarity according to the feature comparison result, avoids the situation where the image similarity cannot be calculated due to the different angles of the two images, and improves the accuracy of image similarity calculation; Furthermore, by sequentially combining the color channel data of each first transformed image and randomly combining the color channel data of each second transformed image, the obtained first pixel combination data and second pixel combination data can represent the first image and the second image at each transformation angle, thereby improving the comprehensiveness of feature extraction in the subsequent feature extraction process.
[0055] The following takes the application of an image processing method provided by this embodiment in an image similarity calculation scenario as an example, combined with Figure 5 , the image processing method provided in this embodiment is further described, see Figure 5 , an image processing method applied to image similarity calculation scenarios specifically includes the following steps.
[0056] Step S502: extracting a texture region in the texture image and extracting a texture region in the reference image.
[0057] Prior to this, an image collected based on a texture acquisition page is obtained, and the texture area contained in the image is identified, the texture area is scaled based on the area ratio of the texture area to the image, and the scaled texture area is spliced with the remaining area of the image to obtain a texture image.
[0058] Step S504, performing image angle transformation on the texture area of the texture image based on the angle transformation algorithm to obtain transformed texture areas of the texture image at each transformation angle, and performing image angle transformation on the texture area of the reference image based on the angle transformation algorithm to obtain transformed texture areas of the reference image at each transformation angle.
[0059] Optionally, the transformed texture regions of the texture images at each transformed angle may be first transformed texture regions, and the transformed texture regions of the reference images at each transformed angle may be second transformed texture regions.
[0060] Step S506, stitching the transformed texture areas of the texture images at each transformation angle with the remaining areas in the texture image to obtain a plurality of first transformed images, and stitching the transformed texture areas of the reference images at each transformation angle with the remaining areas in the reference image to obtain a plurality of second transformed images.
[0061] Step S508 , combining the color channel data of the plurality of first transformed images to obtain first pixel combination data, and combining the color channel data of the plurality of second transformed images to obtain second pixel combination data.
[0062] Step S510: input the first transformed image data into a texture feature extraction model to extract texture features to obtain a first texture feature sequence, and input the second pixel combination data into a texture feature extraction model to extract texture features to obtain a second texture feature sequence.
[0063] Step S512: performing feature transformation processing on each sub-texture feature in the first texture feature sequence to obtain a change feature.
[0064] Step S514, calculating the feature similarity between the transformed feature and the second texture feature sequence, and if the feature similarity is greater than or equal to the feature similarity threshold, it is determined that the texture image is similar to the reference image.
[0065] 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.
[0066] Reference Figure 6 , which shows a schematic diagram of an image processing device provided by this embodiment.
[0067] 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.
[0068] This embodiment provides an image processing device, including: An angle transformation module 602 is configured to perform image angle transformation on the first image and the second image respectively to obtain a plurality of first transformed images and a plurality of second transformed images; The data combination module 604 is configured to perform data combination on the color channel data of the plurality of first transformed images to obtain first pixel combination data, and to perform data combination on the color channel data of the plurality of second transformed images to obtain second pixel combination data; The texture feature extraction module 606 is configured to extract texture features based on the first transformed image data including the first pixel combination data to obtain a first texture feature sequence, and to extract texture features based on the second transformed image data including the second pixel combination data to obtain a second texture feature sequence; The feature comparison module 608 is configured to perform feature transformation processing on each sub-texture feature in the first texture feature sequence, and perform texture feature comparison between the obtained transformed features and the second texture feature sequence to determine image similarity based on the feature comparison result.
[0069] 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, the image processing device 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.
[0070] 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.
[0071] 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 angle transformation on the first image and the second image respectively to obtain a plurality of first transformed images and a plurality of second transformed images; Combining the color channel data of the plurality of first transformed images to obtain first pixel combination data, and combining the color channel data of the plurality of second transformed images to obtain second pixel combination data; Extracting texture features based on first transformed image data including the first pixel combination data to obtain a first texture feature sequence, and extracting texture features based on second transformed image data including the second pixel combination data to obtain a second texture feature sequence; Perform feature transformation processing on each sub-texture feature in the first texture feature sequence, and perform texture feature comparison between the obtained transformation features and the second texture feature sequence to determine image similarity based on the feature comparison result.
[0072] An embodiment of a computer-readable 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 computer-readable storage medium.
[0073] The computer-readable storage medium provided in this embodiment is used to store computer-executable instructions, and the computer-executable instructions implement the following process when executed: Performing image angle transformation on the first image and the second image respectively to obtain a plurality of first transformed images and a plurality of second transformed images; Combining the color channel data of the plurality of first transformed images to obtain first pixel combination data, and combining the color channel data of the plurality of second transformed images to obtain second pixel combination data; Extracting texture features based on first transformed image data including the first pixel combination data to obtain a first texture feature sequence, and extracting texture features based on second transformed image data including the second pixel combination data to obtain a second texture feature sequence; Perform feature transformation processing on each sub-texture feature in the first texture feature sequence, and perform texture feature comparison between the obtained transformation features and the second texture feature sequence to determine image similarity based on the feature comparison result.
[0074] It should be noted that an embodiment of a computer-readable 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.
[0075] 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 computer-readable storage medium embodiment are similar to the method embodiment, so the description is relatively simple. To read the relevant contents in the device embodiment, equipment embodiment and computer-readable storage medium embodiment, please refer to the partial description of the method embodiment.
[0076] 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.
[0077] In the 1930s, it was very clear whether the improvement of a technology was hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Design users almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with a hardware entity module. 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. The design user can "integrate" a digital system on a PLD by programming it himself, without having to ask a chip manufacturer to design and make a dedicated integrated circuit chip. 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. 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 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. Technical users in this field should also be aware that only by slightly programming the method flow in the above-mentioned hardware description languages and programming it into the integrated circuit, the hardware circuit that implements the logic method flow can be easily obtained.
[0078] The controller can be implemented in any suitable manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as 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 controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Users of the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can 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 can be considered as a hardware component, and the devices for implementing various functions included therein can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0079] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by commodities 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.
[0080] 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.
[0081] It should be understood by technical users in the art that one or more embodiments of this specification may be provided as a method, system or computer program commodity. Therefore, one or more embodiments of this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program commodity 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.
[0082] 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 box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes 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 data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data 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.
[0083] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising 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.
[0084] These computer program instructions can also be loaded onto a computer or other programmable data 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 implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0085] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0086] 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.
[0087] 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.
[0088] 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.
[0089] 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.
[0090] The above description is only an embodiment of this document and is not intended to limit this document. For users of this technical field, 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: Rotating the first image and the second image respectively to obtain a plurality of first transformed images and a plurality of second transformed images; Combining the color channel data of the plurality of first transformed images to obtain first pixel combination data and combining the color channel data of the plurality of second transformed images to obtain second pixel combination data; Extracting texture features based on first transformed image data including the first pixel combination data to obtain a first texture feature sequence, and extracting texture features based on second transformed image data including the second pixel combination data to obtain a second texture feature sequence; Perform feature transformation processing on each sub-texture feature in the first texture feature sequence, and perform texture feature comparison between the obtained transformation features and the second texture feature sequence to determine image similarity based on the feature comparison result.
2. According to the image processing method of claim 1, rotating the first image is achieved by: extracting a texture region in the first image; Performing image angle transformation on the texture region based on an angle transformation algorithm to obtain transformed texture regions at each transformation angle; The transformed texture areas at each transformation angle are respectively subjected to image stitching processing with the remaining areas in the first image to obtain the multiple first transformed images.
3. The image processing method according to claim 1, wherein the step of extracting texture features based on the first transformed image data including the first pixel combination data to obtain a first texture feature sequence comprises: extracting sub-transformed image data of each of the first transformed images contained in the first transformed image data; Inputting the sub-transformed image data into a texture feature extraction model in an angle transformation order to extract texture features, thereby obtaining sub-texture features of each first transformed image; The sub-texture features are spliced based on the angle transformation order to obtain the first texture feature sequence.
4. The image processing method according to claim 3, wherein the step of performing feature transformation processing on each sub-texture feature in the first texture feature sequence comprises: Determining a feature arrangement order of each sub-texture feature in the first texture feature sequence based on the angle transformation order; The feature arrangement order of each sub-texture feature is sequentially postponed, and a feature sequence composed of each sub-texture feature after the postponement is used as a first transformation feature; The feature arrangement order of each transformation feature in the first transformation feature is sequentially postponed, and a feature sequence composed of each sub-texture feature after the postponement is used as the second transformation feature.
5. The image processing method according to claim 1, wherein the step of performing feature transformation processing on each sub-texture feature in the first texture feature sequence comprises: Determine a feature ranking of each sub-texture feature in the first texture feature sequence; The feature ranking is updated, and each sub-texture feature after the ranking is updated is used as the transformation feature.
6. The image processing method according to claim 1, wherein the step of combining the color channel data of the plurality of first transformed images to obtain first pixel combination data and combining the color channel data of the plurality of second transformed images to obtain second pixel combination data comprises: Extracting color channel data of each first transformed image among the plurality of first transformed images and color channel data of each second transformed image among the plurality of second transformed images; The color channel data of the first transformed images are combined to obtain the first pixel combination data, and the color channel data of the second transformed images are combined to obtain the second pixel combination data.
7. The image processing method according to claim 1, wherein the step of comparing the obtained transformation features with the second texture feature sequence comprises: Calculating feature similarity between the transformation feature and the second texture feature; If the feature similarity is greater than or equal to a feature similarity threshold, determining that the first image is similar to the second image; If the feature similarity is less than a feature similarity threshold, it is determined that the first image is not similar to the second image.
8. The image processing method according to claim 3, wherein the texture feature extraction model is obtained by training in the following manner: Inputting the pixel data sample into the texture feature extraction model to be trained to extract texture features and obtain sample texture features; Calculating the training loss based on the feature similarity between the sample texture feature and the preset sample texture feature; Parameters of the texture feature extraction model to be trained are adjusted according to the training loss.
9. The image processing method according to claim 8, wherein the pixel data samples are obtained by: Performing image angle transformation on the image sample based on the angle transformation parameter to obtain a transformed image sample; Performing data combination processing on the sample data of the transformed image samples to obtain combined sample data; Mask processing is performed on the combined sample data according to the mask parameters to obtain the pixel data samples.
10. The image processing method according to claim 1, before the step of rotating the first image to obtain the first transformed image is performed, further comprising: Acquire a texture image collected based on a texture collection page, and identify a texture area contained in the texture image; The texture area is scaled based on the area ratio of the texture area to the texture image, and the scaled texture area is spliced with the remaining area of the texture image to obtain the first image.
11. The image processing method according to claim 2, after the sub-step of extracting the texture region in the first image is executed, and before the sub-step of performing image angle transformation on the texture region based on an angle transformation algorithm to obtain transformed texture regions at each transformed angle is executed, further comprising: determining image parameters of the first image; A region enhancement process is performed on a texture region in the first image based on a difference between the image parameter and an image parameter threshold.
12. An image processing device, comprising: An angle transformation module is configured to rotate the first image and the second image respectively to obtain a plurality of first transformed images and a plurality of second transformed images; A data combination module is configured to perform data combination on the color channel data of the plurality of first transformed images to obtain first pixel combination data and to perform data combination on the color channel data of the plurality of second transformed images to obtain second pixel combination data; a texture feature extraction module configured to extract texture features based on first transformed image data including the first pixel combination data to obtain a first texture feature sequence, and to extract texture features based on second transformed image data including the second pixel combination data to obtain a second texture feature sequence; The feature comparison module is configured to perform feature transformation processing on each sub-texture feature in the first texture feature sequence, and perform texture feature comparison between the obtained transformation features and the second texture feature sequence to determine image similarity based on the feature comparison result.
13. An image processing device, comprising: processor; and a memory configured to store computer executable instructions that, when executed, cause the processor to: Rotating the first image and the second image respectively to obtain a plurality of first transformed images and a plurality of second transformed images; Combining the color channel data of the plurality of first transformed images to obtain first pixel combination data and combining the color channel data of the plurality of second transformed images to obtain second pixel combination data; Extracting texture features based on first transformed image data including the first pixel combination data to obtain a first texture feature sequence, and extracting texture features based on second transformed image data including the second pixel combination data to obtain a second texture feature sequence; Perform feature transformation processing on each sub-texture feature in the first texture feature sequence, and perform texture feature comparison between the obtained transformation features and the second texture feature sequence to determine image similarity based on the feature comparison result.
14. A computer-readable storage medium for storing computer-executable instructions, wherein the computer-executable instructions implement the following process when executed: Rotating the first image and the second image respectively to obtain a plurality of first transformed images and a plurality of second transformed images; Combining the color channel data of the plurality of first transformed images to obtain first pixel combination data and combining the color channel data of the plurality of second transformed images to obtain second pixel combination data; Extracting texture features based on first transformed image data including the first pixel combination data to obtain a first texture feature sequence, and extracting texture features based on second transformed image data including the second pixel combination data to obtain a second texture feature sequence; Perform feature transformation processing on each sub-texture feature in the first texture feature sequence, and perform texture feature comparison between the obtained transformation features and the second texture feature sequence to determine image similarity based on the feature comparison result.