CN113344068B - Material processing method, device, electronic equipment and computer readable storage medium - Google Patents

Material processing method, device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN113344068B
CN113344068B CN202110605579.4A CN202110605579A CN113344068B CN 113344068 B CN113344068 B CN 113344068B CN 202110605579 A CN202110605579 A CN 202110605579A CN 113344068 B CN113344068 B CN 113344068B
Authority
CN
China
Prior art keywords
pixel
matrix
distance
points
point
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110605579.4A
Other languages
Chinese (zh)
Other versions
CN113344068A (en
Inventor
彭雨辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202110605579.4A priority Critical patent/CN113344068B/en
Publication of CN113344068A publication Critical patent/CN113344068A/en
Application granted granted Critical
Publication of CN113344068B publication Critical patent/CN113344068B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures

Abstract

The disclosure relates to a material processing method, a device, an electronic apparatus and a computer readable storage medium, wherein the method comprises the following steps: obtaining pixel values of a first material, obtaining a first pixel matrix of the first material, and obtaining pixel values of a second material, obtaining a second pixel matrix of the second material, wherein the size of the first material is different from that of the second material; establishing a corresponding relation between the pixel points in the first pixel matrix and the pixel points in the second pixel matrix to obtain the distance between the corresponding points, and obtaining the total distance according to the distance between the corresponding points; and under the condition that the total distance is smaller than or equal to a preset threshold value, determining that the first material and the second material are the materials with consistent content. By the method and the device, the problem that excessive resources are consumed when the material content is identified in the related technology is solved, and the effect that the material content can be identified by adopting fewer resources is achieved.

Description

Material processing method, device, electronic equipment and computer readable storage medium
Technical Field
The present disclosure relates to the field of computers, and in particular, to a material processing method, apparatus, electronic device, and computer readable storage medium.
Background
At present, material content recognition has many applications (such as face recognition and material search), most of which use complex algorithms such as machine learning, deep learning and the like, so that the complex content can be accurately recognized in different scenes. Through the complex algorithm, material collection, material preprocessing, feature extraction and material identification are performed to identify different targets and objects, but when the method is used for identifying the material content, more calculation resources are required to be consumed. Therefore, the related art has a problem of excessive resources consumption when identifying the material content.
Disclosure of Invention
The disclosure provides a material processing method, a device, an electronic device and a computer readable storage medium, so as to at least solve the problem of excessive resource consumption when identifying material content in the related technology. The technical scheme of the present disclosure is as follows:
according to a first aspect of an embodiment of the present disclosure, there is provided a material processing method, including: obtaining a pixel value of a first material, obtaining a first pixel matrix of the first material, and obtaining a pixel value of a second material, obtaining a second pixel matrix of the second material, wherein the size of the first material is different from the size of the second material; establishing a corresponding relation between pixel points in the first pixel matrix and pixel points in the second pixel matrix to obtain a distance between the corresponding points, and obtaining a total distance according to the distance between the corresponding points; and under the condition that the total distance is smaller than or equal to a preset threshold value, determining that the first material and the second material are materials with consistent content.
Optionally, in the case that the established correspondence is plural, the method further includes: determining a minimum total distance from the total distances corresponding to the corresponding relations; the minimum total distance is compared to the predetermined threshold.
Optionally, establishing a correspondence between the pixel points in the first pixel matrix and the pixel points in the second pixel matrix includes: respectively corresponding the pixel points of the four vertexes in the first pixel matrix to the pixel points of the four vertexes in the second pixel matrix; respectively corresponding the pixel points on the four sides of the first pixel matrix to the pixel points on the four sides of the second pixel matrix; and respectively corresponding first internal pixel points in the first pixel matrix to second internal pixel points in the second pixel matrix, wherein the first internal pixel points are pixel points except for the pixel points on four sides in the first pixel matrix, and the second internal pixel points are pixel points except for the pixel points on four sides in the second pixel matrix.
Optionally, the pixel points on the four sides in the first pixel matrix correspond to the pixel points on the four sides in the second pixel matrix respectively, including: for a first side of the four sides, taking a pixel point of the first side in the first pixel matrix as a row, and taking a pixel point of the first side in the second pixel matrix as a column, constructing a distance matrix, wherein a value of a matrix element in the distance matrix is a pixel difference value between a pixel value of a pixel point on a corresponding row and a pixel value of a pixel point on a corresponding column, and the first side is any one of the four sides; and taking one vertex corresponding to the first edge as a starting point and the other vertex as an end point, and finding a continuous shortest path from the starting point to the end point in the distance matrix, wherein matrix elements on the shortest path represent the corresponding relation between the pixel point of the first edge in the first pixel matrix and the pixel point of the first edge in the second pixel matrix.
Optionally, the step of respectively corresponding the first internal pixel points in the first pixel matrix to the second internal pixel points in the second pixel matrix includes: and adopting a local optimization algorithm to respectively correspond the first internal pixel points in the first pixel matrix to the second internal pixel points in the second pixel matrix.
Optionally, the locally optimizing algorithm is adopted to respectively correspond the first internal pixel points in the first pixel matrix to the second internal pixel points in the second pixel matrix, and the method includes: assume that pixel point B in the first internal pixel point i,j Corresponding to the pixel point S in the second internal pixel point m,n Wherein if B i-1,j Exist, and B i-1,j Corresponds to S a,b M is greater than or equal to a and n is greater than or equal to b; if B is i,j-1 Exist, and B i,j-1 Corresponds to S c,d M is greater than or equal to c and n is greater than or equal to d; acquiring a pixel point B in the first internal pixel point i,j And the pixel point S in the second internal pixel point a,b A first distance between the first internal pixel points is obtained to obtain a pixel point B in the first internal pixel points i,j And the pixel point S in the second internal pixel point c,d A second distance between the first and second internal pixels and obtaining a pixel point B in the first internal pixel point i,j And the pixel point S in the second internal pixel point a+1,b Or pixel point S c,d+1 A third distance therebetween; selecting the pixel point in the second internal pixel point corresponding to the minimum distance between the second distance and the third distance as the pixel point B in the first internal pixel point i,j Corresponding pixel point。
Optionally, determining that the first material and the second material are materials with consistent content includes: obtaining a candidate total distance, wherein the candidate total distance is obtained by summing candidate distances between the first internal pixel point and the second internal pixel point, and the candidate distance is at least one of the two distances except the minimum distance in the first distance, the second distance and the third distance; and under the condition that the candidate total distance is smaller than or equal to the preset threshold value, determining that the first material and the second material are materials with consistent content.
Optionally, establishing a correspondence between the pixel points in the first pixel matrix and the pixel points in the second pixel matrix includes: the rows of the larger of the first and second pixel matrices are equally mapped to the rows of the smaller matrix, and the columns of the larger of the first and second pixel matrices are equally mapped to the columns of the smaller matrix.
Optionally, the pixel value of the first material and the pixel value of the second material are at least one of the following pixels: red pixels, green pixels, blue pixels.
According to a second aspect of the embodiments of the present disclosure, there is provided a material processing method, including: displaying the first material and the second material on a display interface; receiving an identification instruction, wherein the identification instruction is used for identifying whether the first material and the second material are materials with consistent content; responding to the identification instruction, acquiring a pixel value of a first material, acquiring a first pixel matrix of the first material, and acquiring a pixel value of a second material, and acquiring a second pixel matrix of the second material, wherein the size of the first material is different from that of the second material; and displaying an identification result on the display interface, wherein the identification result is used for identifying whether the first material and the second material are materials with consistent content, the identification result is determined according to a total distance and a preset threshold value, the first material and the second material are determined to be materials with consistent content under the condition that the total distance is smaller than or equal to the preset threshold value, and the total distance is obtained by establishing a corresponding relation between pixel points in the first pixel matrix and pixel points in the second pixel matrix, and obtaining the distance between the corresponding points according to the distance between the corresponding points.
According to a third aspect of the embodiments of the present disclosure, there is provided a material processing apparatus including: the first acquisition module is configured to acquire a pixel value of a first material, obtain a first pixel matrix of the first material, and acquire a pixel value of a second material, obtain a second pixel matrix of the second material, wherein the size of the first material is different from the size of the second material; the establishing module is used for establishing a corresponding relation between the pixel points in the first pixel matrix and the pixel points in the second pixel matrix, obtaining the distance between the corresponding points and obtaining the total distance according to the distance between the corresponding points; the first determining module is configured to determine that the first material and the second material are materials with consistent content when the total distance is smaller than or equal to a preset threshold value.
Optionally, the apparatus further comprises: the second determining module is configured to determine a minimum total distance from total distances corresponding to the plurality of corresponding relations when the plurality of corresponding relations are established; a comparison module is arranged to compare the minimum total distance with the predetermined threshold.
Optionally, the establishing module includes: the first building unit is arranged to respectively correspond the pixel points of the four vertexes in the first pixel matrix to the pixel points of the four vertexes in the second pixel matrix; a second establishing unit, configured to respectively correspond the pixel points on the four sides in the first pixel matrix to the pixel points on the four sides in the second pixel matrix; the third establishing unit is configured to respectively correspond first internal pixel points in the first pixel matrix to second internal pixel points in the second pixel matrix, wherein the first internal pixel points are pixel points except for pixel points on four sides in the first pixel matrix, and the second internal pixel points are pixel points except for pixel points on four sides in the second pixel matrix.
Optionally, the second establishing unit includes: a constructing subunit, configured to construct a distance matrix by using, for a first side of the four sides, a pixel point of the first side in the first pixel matrix as a row and a pixel point of the first side in the second pixel matrix as a column, where a value of a matrix element in the distance matrix is a pixel difference value between a pixel value of a pixel point on a corresponding row and a pixel value of a pixel point on a corresponding column, and the first side is any one of the four sides; the first processing subunit is configured to find a continuous shortest path from the start point to the end point in the distance matrix by taking one vertex corresponding to the first edge as the start point and the other vertex as the end point, where a matrix element on the shortest path represents a correspondence between a pixel point of the first edge in the first pixel matrix and a pixel point of the first edge in the second pixel matrix.
Optionally, the third establishing unit includes: and the second processing subunit is configured to respectively correspond the first internal pixel points in the first pixel matrix to the second internal pixel points in the second pixel matrix by adopting a local optimization algorithm.
Optionally, the second processing subunit includes: a processing subunit configured to assume a pixel point B of the first internal pixel points i,j Corresponding to the pixel point S in the second internal pixel point m,n Wherein if B i-1,j Exist, and B i-1,j Corresponds to S a,b M is greater than or equal to a and n is greater than or equal to b; if B is i,j-1 Exist, and B i,j-1 Corresponds to S c,d M is greater than or equal to c and n is greater than or equal to d; an acquisition subunit configured to acquire pixel point B in the first internal pixel point i,j And the pixel point S in the second internal pixel point a,b A first distance between the first internal pixel points is obtained to obtain a pixel point B in the first internal pixel points i,j And the pixel point S in the second internal pixel point c,d A second distance between the first and second internal pixels and acquiring the first and second internal pixelsPixel B i,j And the pixel point S in the second internal pixel point a+1,b Or pixel point S c,d+1 A third distance therebetween; a selecting subunit configured to select the first distance, wherein the pixel point in the second internal pixel point corresponding to the minimum distance in the second distance and the third distance is the pixel point B in the first internal pixel point i,j And corresponding pixel points.
Optionally, the first determining module includes: an obtaining unit configured to obtain a candidate total distance, where the candidate total distance is obtained by summing candidate distances between the first internal pixel point and the second internal pixel point, where the candidate distance is at least one of two distances except a minimum distance from the first distance, the second distance, and the third distance; and a determining unit configured to determine that the first material and the second material are materials with consistent content in a case where the candidate total distance is less than or equal to the predetermined threshold.
Optionally, the building module is further configured to equally correspond rows of a larger matrix of the first and second pixel matrices to rows of a smaller matrix, and equally correspond columns of a larger matrix of the first and second pixel matrices to columns of a smaller matrix.
Optionally, the pixel value of the first material and the pixel value of the second material are at least one of the following pixels: red pixels, green pixels, blue pixels.
According to a fourth aspect of the embodiments of the present disclosure, there is provided a material processing apparatus including: the first display module is arranged to display the first material and the second material on the display interface; the receiving module is used for receiving an identification instruction, wherein the identification instruction is used for identifying whether the first material and the second material are materials with consistent content or not; the second acquisition module is configured to respond to the identification instruction, acquire a pixel value of a first material, obtain a first pixel matrix of the first material, and acquire a pixel value of a second material, obtain a second pixel matrix of the second material, wherein the size of the first material is different from the size of the second material; the second display module is configured to display a recognition result on the display interface, where the recognition result is used to identify whether the first material and the second material are materials with consistent content, the recognition result is determined according to a total distance and a preset threshold, where the first material and the second material are determined to be materials with consistent content when the total distance is smaller than or equal to the preset threshold, and the total distance is obtained by establishing a correspondence between a pixel point in the first pixel matrix and a pixel point in the second pixel matrix, and obtaining a distance between the corresponding points and a distance between the corresponding points.
According to a fifth aspect of embodiments of the present disclosure, there is provided an electronic device, comprising: a processor; a memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to implement the material processing method of any one of the above.
According to a sixth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium, which when executed by a processor of an electronic device, causes the electronic device to perform any one of the above-described material processing methods.
According to a seventh aspect of the embodiments of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, performs the material processing method of any one of the above.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
the method and the device can determine whether the content of the materials is consistent by comparing the total distance between the pixel points included by the two materials with the preset threshold value, and compared with the prior art that a deep neural network model is adopted to identify the materials and a large amount of calculation resources are required to be consumed, the method and the device can effectively reduce the resources consumed in identifying the materials on the premise that a certain identification accuracy can be achieved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure and do not constitute an undue limitation on the disclosure.
Fig. 1 is a block diagram showing a hardware configuration of a computer terminal for implementing a material processing method according to an exemplary embodiment.
Fig. 2 is a flow chart illustrating a material processing method one according to an exemplary embodiment.
Fig. 3 is a flowchart illustrating a material processing method two according to an exemplary embodiment.
Fig. 4 is a flowchart illustrating a material processing method three according to an exemplary embodiment.
Fig. 5 is a flowchart illustrating a material processing method four according to an exemplary embodiment.
Fig. 6 is a flowchart illustrating a material processing method five according to an exemplary embodiment.
Fig. 7 is a schematic diagram of a pixel matrix according to an exemplary embodiment.
Fig. 8 is a schematic diagram of a matrix classification in accordance with an exemplary embodiment.
Fig. 9 is a schematic diagram of a DTW algorithm according to an exemplary embodiment.
Fig. 10 is a schematic diagram of an overall flow diagram according to an exemplary embodiment.
Fig. 11 is a device block diagram of a material processing device one shown according to an exemplary embodiment.
Fig. 12 is a device block diagram of a material processing device two shown according to an exemplary embodiment.
Fig. 13 is a block diagram of an apparatus of a terminal according to an exemplary embodiment.
Fig. 14 is a block diagram illustrating a structure of a server according to an exemplary embodiment.
Detailed Description
In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or described herein. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
Example 1
According to the embodiment of the disclosure, a method embodiment of a material processing method is provided. It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is illustrated in the flowcharts, in some cases the steps illustrated or described may be performed in an order other than that illustrated herein.
The method embodiment provided in embodiment 1 of the present disclosure may be performed in a mobile terminal, a computer terminal, or a similar computing device. Fig. 1 is a block diagram showing a hardware configuration of a computer terminal (or mobile device) for implementing a material processing method according to an exemplary embodiment. As shown in fig. 1, the computer terminal 10 (or mobile device) may include one or more processors 102 (shown as 102a, 102b, … …,102 n) which may include, but are not limited to, a microprocessor MCU or a programmable logic device FPGA or the like processing means, a memory 104 for storing data, and transmission means for communication functions. In addition, the method may further include: a display, an input/output interface (I/O interface), a Universal Serial BUS (USB) port (which may be included as one of the ports of the BUS), a network interface, a power supply, and/or a camera. It will be appreciated by those of ordinary skill in the art that the configuration shown in fig. 1 is merely illustrative and is not intended to limit the configuration of the electronic device described above. For example, the computer terminal 10 may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
It should be noted that the one or more processors 102 and/or other data processing circuits described above may be referred to generally herein as "data processing circuits. The data processing circuit may be embodied in whole or in part in software, hardware, firmware, or any other combination. Furthermore, the data processing circuitry may be a single stand-alone processing module, or incorporated, in whole or in part, into any of the other elements in the computer terminal 10 (or mobile device). As referred to in the embodiments of the present disclosure, the data processing circuit acts as a processor control (e.g., selection of the variable resistance termination path to interface with).
The memory 104 may be used to store software programs and modules of application software, such as program instructions/data storage devices corresponding to the material processing methods in the embodiments of the present disclosure, and the processor 102 executes the software programs and modules stored in the memory 104, thereby executing various functional applications and data processing, that is, implementing the material processing methods of the application programs. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission means is used for receiving or transmitting data via a network. The specific examples of the network described above may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission means comprises a network adapter (Network Interface Controller, NIC) connectable to other network devices via the base station to communicate with the internet. In one example, the transmission device may be a Radio Frequency (RF) module, which is used to communicate with the internet wirelessly.
The display may be, for example, a touch screen type Liquid Crystal Display (LCD) that may enable a user to interact with a user interface of the computer terminal 10 (or mobile device).
It should be noted here that, in some alternative embodiments, the computer device (or mobile device) shown in fig. 1 described above may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be noted that fig. 1 is only one example of a specific example, and is intended to illustrate the types of components that may be present in the computer device (or mobile device) described above.
In the above-described operating environment, the present disclosure provides a material processing method as shown in fig. 2. Fig. 2 is a flowchart of a material processing method, shown in fig. 2, according to an exemplary embodiment, and the method is used in the above-mentioned computer terminal, and includes the following steps.
In step S21, obtaining a pixel value of a first material, obtaining a first pixel matrix of the first material, and obtaining a pixel value of a second material, obtaining a second pixel matrix of the second material, wherein the size of the first material is different from the size of the second material;
in step S22, a correspondence between the pixel points in the first pixel matrix and the pixel points in the second pixel matrix is established, so as to obtain a distance between the corresponding points, and a total distance is obtained according to the distance between the corresponding points;
in step S23, in the case where the total distance is less than or equal to the predetermined threshold, it is determined that the first material and the second material are materials whose contents are identical.
By adopting the processing, whether the content of the materials is consistent or not can be determined by comparing the total distance between the pixel points included in the two materials with the preset threshold value, and compared with the prior art that a deep neural network model is adopted to identify the materials and a large amount of calculation resources are required to be consumed, the embodiment of the invention can effectively reduce the resources consumed during the identification of the materials on the premise that a certain identification accuracy can be achieved.
In one or more alternative embodiments, the above method may be applied to a client device that does not have a high computing power, for identifying whether the content of two stories is consistent by the client device. In general, when whether the content of the material is consistent or not is identified in the client device, no particularly accurate identification is needed, and the difference between the identified objects is relatively large, which is relatively easy to identify. Therefore, the method can be used for identifying whether the contents of the two materials are consistent or not, so that the effects of considering the identification efficiency and saving the identification resources on the premise of meeting the accuracy of the result are achieved.
In one or more alternative embodiments, the first material and the second material may be various types of materials, for example, may be video, photos, pictures, and so on. The first material and the second material may be materials subjected to scaling operations by different scaling ratios. Different size materials are applied to different device screens, resolutions. That is, the first material and the second material may be materials with identical content or materials with different content. When the first material and the second material are placed in the same storage position, the method of the embodiment can be used for rapidly selecting the material with consistent content from the materials stored in the storage position, so that the problem that once the number of the materials is increased, manual classification errors are likely to occur is effectively avoided; in addition, when materials are made into different sizes, the situation of pixel point deletion may occur, and when a manual classification method is adopted for identification, the problem of low identification accuracy exists when the consistency of the materials is identified due to the pixel point deletion. By adopting the mode of comparing the total pixel distance with the preset threshold, the problem of low recognition accuracy can be effectively avoided because the total pixel distance is compared, and the total pixel distance is not influenced too much for the small part of missing pixel points.
In one or more alternative embodiments, the acquiring the pixel values of the first material and the second material may take a variety of manners when acquiring the pixel values of the materials, for example, a third party material processing library may be used to acquire the pixel information of the materials, where the third party material processing library may take a variety of materials as pictures, and the third party material processing library may be some picture processing libraries, for example, PIL (Python Image Library) library, OPENCV library, and so on. The third-party material processing library is used for processing the materials, so that the pixel information in the materials can be efficiently acquired, the pixel values of the materials can be rapidly and accurately obtained, the error of manual classification can be effectively avoided, and the automatic acquisition of the pixel values of the materials is realized.
In one or more alternative embodiments, where the content of the material is identified by comparing the total distance of pixels to a predetermined threshold, the particular pixel type may include a plurality of types, e.g., the pixel type may include at least one of: red pixels, green pixels, blue pixels. I.e. the corresponding pixel value is the pixel value of at least one of the following pixels: red pixels, green pixels, blue pixels. It should be noted that the number of the pixel types may be flexibly selected, for example, when one of the pixels is selected, for example, any one of the red pixel, the green pixel, and the blue pixel is selected, and whether the content of the material is uniform is identified according to the pixel value of the selected pixel. Because only one type of pixel is acquired and only the pixel values of that type of pixel need to be compared, whether or not the two materials are consistent in content can be obtained with fewer resources and more quickly and efficiently. However, since the recognition is performed based on only one type of pixel, there is also a case where the recognition result may be inaccurate. In order to ensure the accuracy of the identification result, three pixels can be selected, namely, red pixels, green pixels and blue pixels are respectively used for acquiring corresponding pixels, and the obtained total distances are respectively compared with corresponding preset thresholds, so that corresponding identification results are respectively obtained, the three identification results are arbitrated to obtain an arbitration result, and the arbitration result is used as an identification result of whether the contents of the two materials are consistent. Since a plurality of recognition results need to be arbitrated, a recognition result of whether the contents of the two materials are consistent is obtained, and the obtained recognition result of whether the contents of the two materials are consistent is more accurate than a recognition result determined only by one pixel. However, although the recognition result is more accurate, three comparisons and one arbitration are required, and thus, there is a problem that more calculation resources are required and a longer period of time is required. Of course, considering that only one pixel and three pixels are adopted to obtain the identification result, and the corresponding resource consumption, efficiency and accuracy are respectively adopted, one mode between the two modes can be selected, for example, two pixels are selected, and the identification result for identifying whether the content of the two materials is consistent is determined according to the identification results of the two pixels. By adopting the method, excessive resources are not required to be consumed, and a relatively accurate identification result can be obtained efficiently, so that the method is suitable for application scenes in which the client equipment locally identifies whether the material contents are consistent.
In one or more alternative embodiments, before the pixel value of the material is obtained, there may be various methods for obtaining the material, for example, the client receives the material with multiple sizes sent by the server, the client directly obtains the material with multiple sizes in the server, and so on. And in the materials with the multiple sizes, when the materials with the multiple sizes are identified and whether the content of the materials is consistent is determined, two materials, namely a first material and a second material, can be selected at will. The selection of the materials can be flexibly determined according to specific requirements, for example, the material identification can be applied to different scenes, for example, the materials to be identified can be used for judging whether the two materials are materials with consistent content before editing the materials; for another example, the material to be identified may be applied to material used at the time of IOS development, for example, material used at the time of development applies to different device screens, resolutions, and so on, respectively.
In one or more alternative embodiments, the pixel values of the materials are obtained, and a pixel matrix of the materials is obtained, where a material corresponds to a pixel matrix, the pixel matrix includes pixel values of pixel points on the material, and the size of each pixel matrix can be determined by the pixel size of the material. For example, if the material a has 10×10 pixels, that is, the pixel size is 10×10 pixels, a pixel matrix formed by the pixel values corresponding to each of the 10×10 pixels can be obtained by obtaining the pixel values of the material a. The size of the first material and the size of the second material may be different, that is, the number of pixels included in the material may be different.
In one or more alternative embodiments, in a case where the established correspondence is plural, the method further includes: determining a minimum total distance from the total distances corresponding to the corresponding relations; the minimum total distance is compared to a predetermined threshold. The minimum total distance is selected for comparison with the predetermined threshold, because the minimum total distance is the distance when the accuracy of identifying the content of the obtained material is highest, and the minimum distance is obtained according to the best corresponding relation between the two materials (namely, the best corresponding mode). By adopting the comparison between the minimum total distance and the preset threshold value, whether the two materials used for comparison are the materials with consistent contents can be determined, and the accuracy of identifying the contents of the materials is greatly improved.
In one or more alternative embodiments, when establishing the correspondence between the pixel points in the first pixel matrix and the pixel points in the second pixel matrix, various manners may be adopted, for example, may be implemented in the following manner: fig. 3 is a flowchart of a second material processing method according to an exemplary embodiment, and as shown in fig. 3, the method includes steps other than those included in fig. 2, where in step S22, a correspondence relationship between a pixel point in a first pixel matrix and a pixel point in a second pixel matrix is established, and the method includes the following steps.
In step S31, the pixel points of the four vertices in the first pixel matrix are respectively corresponding to the pixel points of the four vertices in the second pixel matrix;
in step S32, the pixel points on the four sides in the first pixel matrix are respectively corresponding to the pixel points on the four sides in the second pixel matrix;
in step S33, the first internal pixels in the first pixel matrix correspond to the second internal pixels in the second pixel matrix, respectively, where the first internal pixels are pixels in the first pixel matrix except for the pixels on the four sides, and the second internal pixels are pixels in the second pixel matrix except for the pixels on the four sides.
By establishing respective corresponding relations for the pixel points at different positions in the pixel matrix, the corresponding relations can be ensured to be accurate to a great extent, so that the corresponding relations can be processed conveniently, the material content can be identified, and errors of material content identification can be reduced. And the corresponding relation is established by adopting different methods for the pixel points at different positions, so that unnecessary calculation can be avoided, the occupation rate of calculation resources is reduced, the corresponding relation between two pixel matrixes can be more obviously expressed, and the determination of material content identification is facilitated. And establishing a corresponding relation between the two pixel matrixes, wherein each point in the two pixel matrixes has a corresponding relation, and the mapping relation between the pixel points cannot be crossed. The above requirements can be rapidly and accurately realized by adopting the corresponding modes of the points, the lines and the surfaces.
In one or more alternative embodiments, the pixel points of the four vertexes in the first pixel matrix correspond to the pixel points of the four vertexes in the second pixel matrix respectively, in the material content identification, the material is only subjected to scaling processing, the pixel points of the four vertexes are used as termination points or are kept unchanged, the pixel points of the four vertexes correspond to the pixel points of the four vertexes respectively, so that the basic accuracy of the corresponding relationship between the materials can be ensured, the distance between the materials can be calculated, and the accuracy of the material content identification is improved.
In one or more alternative embodiments, the pixels on the four sides of the first pixel matrix correspond to the pixels on the four sides of the second pixel matrix, respectively, and may be in various manners, for example: for a first side of the four sides, taking a pixel point of the first side in a first pixel matrix as a row, and taking a pixel point of the first side in a second pixel matrix as a column, constructing a distance matrix, wherein the value of a matrix element in the distance matrix is a pixel difference value between the pixel value of the pixel point on the corresponding row and the pixel value on the corresponding column, and the first side is any one of the four sides; and taking one vertex corresponding to the first edge as a starting point, and the other vertex as an end point, and finding a continuous shortest path from the starting point to the end point in the distance matrix, wherein matrix elements on the shortest path represent the corresponding relation between the pixel points of the first edge in the first pixel matrix and the pixel points of the first edge in the second pixel matrix. It should be noted that, the start point of the row of the first pixel matrix and the start point of the column of the second pixel matrix are two vertices corresponding to the first edge in the first pixel matrix and the first edge in the second pixel matrix. The range of the internal pixel points is limited by determining the corresponding relation of the pixel points of the edge part, and the corresponding relation between the pixel points of one side in the first pixel matrix and the pixel points of the corresponding side in the second pixel matrix is obtained by adopting the distance matrix mode, so that the logic is clear, the operation is simple, and the corresponding relation of the internal pixel points can be determined more accurately and efficiently.
As an alternative embodiment, the above-mentioned pixel points on the four sides in the first pixel matrix correspond to the pixel points on the four sides in the second pixel matrix, which may be understood as using a similar dynamic time warping DTW algorithm. The DTW algorithm is a dynamic time warping algorithm, belongs to a dynamic warping algorithm, is commonly used for voice recognition, is a classic algorithm which appears earlier in voice recognition, and can recognize whether different long and short data are matched. Based on the dynamic programming idea, the template matching problem of different pronunciation length is solved. With the help of the above-mentioned recognition data matching idea, specifically, the line number or the column number of the pixel matrix may be equivalent to the time in DTW, the pixel values of the pixel points on four sides in the pixel matrix may be equivalent to the voice signal amplitude in DRW, that is, the pixel value on any one side of the first pixel matrix is taken as the line, the pixel value on the corresponding side of the second pixel matrix is taken as the column, and a distance matrix (where the value of the element in the distance matrix is the pixel difference between the corresponding line and the corresponding column) is formed, so as to determine the correspondence of the two pixel matrices according to the shortest continuous path from the start vertex to the end vertex of the edge obtained from the distance matrix. According to the processing method, the similar DTW algorithm is adopted for other edges, the corresponding relation between the four edges in the two pixel matrixes is determined, the matching degree of the pixel points of the four edges of the first pixel matrix and the four edges of the second pixel matrix can be identified through the processing, and the identification accuracy of the material content is improved.
In one or more alternative embodiments, the first internal pixels in the first pixel matrix respectively correspond to the second internal pixels in the second pixel matrix, which may be implemented in various manners, for example, the following manners may be implemented: fig. 4 is a flowchart of a material processing method three according to an exemplary embodiment, and as shown in fig. 4, the method includes steps other than those included in fig. 3, in which a local optimization algorithm is adopted in step S33, and the steps of respectively corresponding first internal pixel points in a first pixel matrix to second internal pixel points in a second pixel matrix include the following steps.
In step S41, a local optimization algorithm is adopted to respectively correspond first internal pixels in the first pixel matrix to second internal pixels in the second pixel matrix.
On the premise that corresponding relations are established by adopting different methods for pixel points at different positions, an optimal algorithm is adopted for the pixel points with complex local corresponding relations, and the local optimal algorithm is adopted, so that the efficiency of obtaining the corresponding relations can be improved under the condition of ensuring accuracy. The purpose of adopting the local optimal algorithm is that the local optimal algorithm can save a large amount of computing resources relative to the global optimal algorithm, and because the local can reflect the global characteristic to a certain extent, the corresponding relation determined by the local optimal algorithm can also realize accurate identification of materials to a great extent, and can also save a large amount of computing resources.
In one or more alternative embodiments, when a local optimization algorithm is adopted to make the first internal pixel points in the first pixel matrix correspond to the second internal pixel points in the second pixel matrix respectively, in order to make the correspondence between the pixel points more accurate, the local optimization algorithm may be adopted based on a dynamic normalization algorithm, and an optimal correspondence may be selected from a plurality of different correspondences. For example, it may be implemented in the following manner: fig. 5 is a flowchart showing a material processing method four according to an exemplary embodiment, which includes the following steps in step S41 in addition to the steps included in fig. 4, as shown in fig. 5.
In step S51, it is assumed that pixel point B in the first internal pixel point i,j Corresponding to the pixel point S in the second internal pixel point m,n Wherein if B i-1,j Exist, and B i-1,j Corresponds to S a,b M is greater than or equal to a and n is greater than or equal to b; if B is i,j-1 Exist, and B i,j-1 Corresponds to S c,d M is greater than or equal to c and n is greater than or equal to d;
in step S52, a pixel B in the first internal pixel is acquired i,j And pixel point S in the second internal pixel point a,b A first distance between the first and second pixel points is obtained to obtain a pixel point B in the first internal pixel point i,j And pixel point S in the second internal pixel point c,d A second distance between the first and second internal pixels and obtaining a pixel point B in the first internal pixel point i,j And pixel point S in the second internal pixel point a+1,b Or pixel point S c,d+1 A third distance therebetween;
in step S53, the pixel point in the second internal pixel point corresponding to the smallest distance of the first distance, the second distance and the third distance is selected as the pixel point B in the first internal pixel point i,j And corresponding pixel points.
Adopting the above processing, the pixel point B in the first pixel matrix corresponding to the larger material i,j Mapping to the pixel point S in the second pixel matrix corresponding to the smaller material m,n At this time, one pixel point B in the first internal pixel point in the first pixel matrix is passed through i,j And a pixel point S in a second internal pixel point in the second pixel matrix m,n Comparing a plurality of distances among a plurality of nearby pixel points, and selecting a pixel in a second internal pixel point with the smallest distanceAnd the points are used for determining the corresponding relation between the first internal pixel point and the second internal pixel point, so that the corresponding relation which can reflect the similarity degree of the materials to the greatest extent is selected locally and optimally, and the efficiency of identifying whether the material contents are consistent or not is ensured on the premise of ensuring the accuracy of identifying the material contents.
In one or more alternative embodiments, the correspondence between the pixels in the first pixel matrix and the pixels in the second pixel matrix may be established by equally mapping the rows of the larger of the first and second pixel matrices to the rows of the smaller matrix and equally mapping the columns of the larger of the first and second pixel matrices to the columns of the smaller matrix. The corresponding relation of each point in the pixel matrix is ensured to be clear, errors of material content identification are reduced, and accordingly more accurate corresponding relation is obtained. Although the two materials are roughly corresponding to each other, the speed of obtaining the corresponding relation is high, and the operation is simple, so that the efficiency of identifying the materials can be improved to a certain extent.
In one or more optional embodiments, when the first material and the second material are determined to be materials with consistent content, the problem of identifying whether the two materials are consistent can be solved to a certain extent by determining the corresponding relationship according to the minimum total distance. To further ensure accuracy of the identification, the relationship between the candidate distances other than the minimum distance and the predetermined threshold may be continuously determined, and if there is also a candidate distance smaller than the predetermined threshold among the plurality of candidate distances, it may be determined that the two materials are materials whose contents are identical. For example, determining that the first material and the second material are consistent-content materials may further include: obtaining a candidate total distance, wherein the candidate total distance is obtained by summing candidate distances between the first internal pixel point and the second internal pixel point, and the candidate distance is at least one of the two distances except the minimum distance in the first distance, the second distance and the third distance; and under the condition that the candidate total distance is smaller than or equal to the preset threshold value, determining that the first material and the second material are materials with consistent content. By double comparison of the minimum total distance and the candidate total distance with the preset threshold value respectively, whether the identification result obtained by identifying the two materials is accurate or not can be realized, and double assurance is provided.
In one or more alternative embodiments, the first material and the second material are determined to be consistent content materials if the total distance is less than or equal to a predetermined threshold. And under the condition that the total distance is not smaller than a preset threshold value, determining that the first material and the second material are inconsistent in content. Or, more strictly, when the total distance obtained under a pixel value is greater than a predetermined threshold, it cannot be determined that the first material and the second material are materials with consistent contents, for example, it may be that the materials have a problem. Among other things, problems with material may include pixel loss, distortion of content, and so forth.
In one or more alternative embodiments, the predetermined threshold is different for different size differences in identifying different size material content. Different pixel sizes, different numbers of pixel points, different pixel point arrangements, different corresponding relations among the obtained pixel points, and different total distances according to the corresponding relations. Therefore, when identifying the material contents of different sizes, the predetermined threshold value can be set according to the sizes of the first material and the second material. When different materials are identified, different preset thresholds (the different preset thresholds can be obtained empirically or can be obtained by counting the difference values of pixel matrixes when a plurality of groups of materials are consistent in content or are inconsistent in content) can be set, and after the factors are fully considered, the accuracy of identifying the content when the materials in different sizes are identified can be ensured.
Fig. 6 is a flowchart of a material processing method five, which is applied to a server as shown in fig. 6, according to an exemplary embodiment, and further includes the following steps.
In step S61, the first material and the second material are displayed on the display interface;
in step S62, an identification instruction is received, where the identification instruction is used to identify whether the first material and the second material are materials with consistent content;
in step S63, in response to the identification instruction, obtaining a pixel value of the first material, to obtain a first pixel matrix of the first material, and obtaining a pixel value of the second material, to obtain a second pixel matrix of the second material, where the size of the first material is different from the size of the second material;
in step S64, a recognition result is displayed on the display interface, where the recognition result is used to identify whether the first material and the second material are consistent content materials, the recognition result is determined according to a total distance and a predetermined threshold, where the first material and the second material are determined to be consistent content materials when the total distance is less than or equal to the predetermined threshold, and the total distance is obtained by establishing a correspondence between a pixel point in the first pixel matrix and a pixel point in the second pixel matrix, and obtaining a distance between the corresponding points according to the distance between the corresponding points.
By adopting the processing, the identification instruction is received, the pixel information of the material is obtained for the material displayed on the display interface, the material is processed by an algorithm, the identification result is determined according to the total distance and a preset threshold value and displayed on the display interface, and the identification result represents whether the content of the material is consistent or not. Through the processing, the problems existing in the related technology when whether the content of the materials with different sizes is consistent or not can be solved, the purposes of reducing the occupation rate of computing resources and efficiently acquiring the material identification result can be achieved, the effect of acquiring the identification result after the material identification on the display interface after the material to be identified is input in a man-machine interaction mode is achieved, and the user experience is effectively improved.
Based on the above embodiments and alternative embodiments, an alternative implementation is provided.
In order to achieve the purpose of efficiently and accurately identifying the content of the material, taking the material as an example of a picture, an optional implementation manner is provided, in the picture processing method provided in the optional implementation manner, a dynamic normalization algorithm concept similar to DTW is adopted, and the content of the picture is identified by comparing the minimum total distance with a preset threshold value. The picture processing method in the optional implementation mode does not need manual classification, does not occupy a large amount of computing resources, and can identify the picture content.
Fig. 7 is a schematic diagram of a pixel matrix according to an exemplary embodiment. Fig. 8 is a schematic diagram of a matrix classification in accordance with an exemplary embodiment. Fig. 9 is a schematic diagram of a DTW algorithm according to an exemplary embodiment. When the pixel information of the picture is acquired through the third party picture processing library, the third party picture processing library takes a PIL library, namely a python third party image processing library as an example. In the case of establishing the correspondence, red pixels in two pictures are taken as an example.
S1, establishing a pixel matrix;
and obtaining pixel information of pictures with different sizes in the same folder by using a PIL library, wherein the pictures comprise three pixels of R (red), G (green) and B (blue). Assuming that three types of pictures with consistent content exist in a picture material folder issued by a server, the pixel sizes of the three pictures are respectively 10 x 10 pixels, 30 x 30 pixels and 100 x 100 pixels, and nine pixel matrixes can be obtained by reading the pixel information of each picture through PIL. Three matrices of 10×10 pixels, three matrices of 30×30 pixels, and three matrices of 100×100 pixels correspond to three matrices of R, G, B pixels, respectively, wherein the matrix of 10×10 pixels corresponds to the R pixel, as shown in fig. 7. I.e. pictures of different sizes, a similar matrix of pixels can also be obtained by processing in a third party picture processing library.
S2, establishing a corresponding relation;
1. mapping each point in the large-size material matrix into the small-size material matrix;
wherein the mapping process needs to obey three conditions:
1) The pixel points of the four vertexes of the matrix should be in one-to-one correspondence, because the picture is only scaled, and the pixel points of the four vertexes are used as termination points or are maintained unchanged;
2) Each point in the two matrixes has a corresponding relation;
3) The mapping relation can not be crossed, a large-size material matrix is set as a matrix B, a small-size material matrix is set as a matrix S, and one point B in the matrix B i,j Mapped to a certain point S in the matrix S m,n. . If B is i-1,j Exist, and B i-1,j Mapping to S a,b Then m is greater than or equal to a and n is greater than or equal to b; if B is i,j-1 Exist, and B i,j-1 Mapping to S c,d Then m.gtoreq.c and n.gtoreq.d need to be satisfied.
2. Dividing the pixel matrix into three types, and determining the corresponding relation of each type of pixel matrix;
as shown in fig. 8. First, the correspondence of the full black part, that is, the correspondence of the pixel points on the four vertexes, is determined. And then determining the corresponding relation of the full white part, namely the corresponding relation of the pixel points on the four sides. Wherein, the full white parts can respectively determine the corresponding relation through a DTW algorithm. And finally, determining the corresponding relation of the oblique line part, namely the corresponding relation of the internal pixel points. Wherein, the diagonal line parts can respectively determine the corresponding relation through a dynamic normalization algorithm. For the inner diagonal line part, a certain point B i,j There are only three corresponding ways: 1) Correspond to B i-1,j Corresponding point S a,b The method comprises the steps of carrying out a first treatment on the surface of the 2) Correspond to B i,j-1 Corresponding point S c,d The method comprises the steps of carrying out a first treatment on the surface of the 3) Corresponding point S a+1,b (S c,d+1 )。
3. In the mapping process, a corresponding relation which enables the total distance to be minimum can be found by dynamic planning and using a total distance calculation formula.
The total distance calculation formula is shown below.
D total =D now +min{D 1 ,D 2 ,D 3 };
Wherein D is total : the total distance obtained finally; d (D) now : the current accumulated distance; d (D) 1 : the total distance generated corresponds to selection 1.
Wherein the operation of D is to sum and square the values of the corresponding pixels to obtain the distance between the corresponding pixels, such as D 1 ,D 2 ,D 3 . Summing all the accumulated distances to obtain the total distance between the two pictures, as described in D now . Selecting the sum of the minimum total distance and the accumulated distance to obtain the total distance of the two pictures according to the formula, wherein the sum is D total . So as to obtain the correct corresponding relation.
S3, circulating comparison.
And setting a preset threshold value, and screening out pictures with excessive differences by comparing the total distance with the preset threshold value, wherein the total distance obtained from each pixel value of the pictures is compared with the preset threshold value, namely, multi-round operation is carried out. And (3) zooming the pictures with consistent contents, wherein the generated total distance is maintained at a smaller value, and when the contents of the pictures are different or the condition of pixel point missing occurs, a larger total distance is obtained. When a certain total distance exceeds a predetermined threshold, it is determined that the group of pictures is problematic. The larger the total distance, the larger the difference between the two pictures.
In the process of determining the full-white part corresponding relation, the corresponding relation is determined in a similar manner to the DTW algorithm, as shown in fig. 9, and based on the DTW algorithm thought, the DTW algorithm compares two sections of voice signals with different time lengths through time warping. The principle is that by mapping each point of the shorter speech signal to the longer speech signal, as shown in a diagram a in fig. 9, if the comparison is made using euclidean distance, point a corresponds to point b', and the true feature point should be point b, where euclidean distance is the straight line distance of two points in space. As shown in graph B of fig. 9, the DWT algorithm finds a suitable warping method by dynamic programming, and corresponds the feature points instead of simply according to time.
In the process of determining the corresponding relation of the oblique line part, based on the thought of a DTW dynamic time warping algorithm, as the DTW algorithm aims at a time domain signal, which is equivalent to a 1*n matrix, the pixel contrast of a picture is n matrix contrast, and some improvements are made on the point, one pixel point in one pixel matrix is corresponding to a plurality of pixel points in the other pixel matrix, in the corresponding process, three methods for establishing the corresponding relation are provided, the most suitable corresponding relation can be compared and selected, the similarity degree between two pictures is obtained, and the picture content identification can be efficiently and accurately realized.
FIG. 10 is a schematic diagram of an overall flow diagram, as shown in FIG. 10, according to an exemplary embodiment, including the steps of:
(1) Acquiring a pixel matrix of a picture;
(2) Selecting a pixel matrix of the same pixel of two pictures;
(3) Obtaining a total distance of two pixel matrixes;
(4) The total distance is compared to a predetermined threshold (i.e., the threshold in the figure);
if the total distance is smaller than or equal to a preset threshold value, performing the operation in the step (2), repeating the same way for a plurality of rounds, and if the operation results of the rounds are the same, judging that the two pictures are pictures with consistent content; if the total distance is greater than the preset threshold value, judging that the material is problematic.
By the above alternative embodiments, the following effects can be achieved:
and comparing the total distance with a preset threshold value, so as to realize the identification of the material content, realize the high efficiency of the identification of the material content and effectively improve the accuracy of the identification of the material content. The problems of complex material content identification and calculation, overlarge consumed resources and low accuracy are solved, and the effects of saving a large amount of calculation resources, efficiently and accurately identifying whether the picture content is consistent or not are achieved.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present disclosure is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present disclosure. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all of the preferred embodiments, and that the acts and modules referred to are not necessarily required by the present disclosure.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present disclosure may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a computer readable storage medium (such as ROM/RAM, magnetic disk, optical disk) including several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method of the embodiments of the present disclosure.
Example 2
According to an embodiment of the present disclosure, there is further provided an apparatus for implementing the above-described material processing method one, and fig. 11 is an apparatus block diagram of the material processing apparatus one shown according to an exemplary embodiment. Referring to fig. 11, the apparatus includes a first acquisition module 111, a setup module 112, and a first determination module 113, and is described below.
A first obtaining module 111, configured to obtain a pixel value of a first material, obtain a first pixel matrix of the first material, and obtain a pixel value of a second material, obtain a second pixel matrix of the second material, where a size of the first material is different from a size of the second material; the establishing module 112, connected to the first obtaining module 111, is configured to establish a correspondence between the pixel points in the first pixel matrix and the pixel points in the second pixel matrix, obtain a distance between the corresponding points, and obtain a total distance according to the distance between the corresponding points; the first determining module 113 is connected to the establishing module 112 and configured to determine that the first material and the second material are materials with consistent content when the total distance is less than or equal to a predetermined threshold.
Here, the first obtaining module 111, the establishing module 112 and the first determining module 113 correspond to steps S21 to S23 in embodiment 1, and the modules correspond to examples and application scenarios implemented by the corresponding steps, but are not limited to those disclosed in embodiment 1. It should be noted that the above-described module may be operated as a part of the apparatus in the computer terminal 10 provided in embodiment 1.
In one or more alternative embodiments, the material processing apparatus one further includes: the system comprises a first determining module and a comparing module, wherein the first determining module is used for determining a minimum total distance from total distances corresponding to a plurality of corresponding relations when the established corresponding relations are a plurality of; and a comparison module, connected to the above second determination module, configured to compare the minimum total distance with the predetermined threshold.
In one or more alternative embodiments, the establishing module includes: the first building unit is arranged to respectively correspond the pixel points of the four vertexes in the first pixel matrix to the pixel points of the four vertexes in the second pixel matrix; a second establishing unit, configured to respectively correspond the pixel points on the four sides in the first pixel matrix to the pixel points on the four sides in the second pixel matrix; the third establishing unit is configured to respectively correspond first internal pixel points in the first pixel matrix to second internal pixel points in the second pixel matrix, wherein the first internal pixel points are pixel points except for pixel points on four sides in the first pixel matrix, and the second internal pixel points are pixel points except for pixel points on four sides in the second pixel matrix.
In one or more alternative embodiments, the second establishing unit includes: the device comprises a construction subunit and a first processing subunit, wherein the construction subunit is configured to construct a distance matrix by taking a pixel point of a first edge in the first pixel matrix as a row and a pixel point of the first edge in the second pixel matrix as a column for a first edge in the four edges, wherein a value of a matrix element in the distance matrix is a pixel difference value between a pixel value of a pixel point on a corresponding row and a pixel value of a pixel point on a corresponding column, and the first edge is any one of the four edges; the first processing subunit is connected to the above-mentioned construction subunit, and is configured to find a continuous shortest path from the start point to the end point in the distance matrix by taking one vertex corresponding to the first edge as the start point and the other vertex as the end point, where matrix elements on the shortest path represent a correspondence between a pixel point of the first edge in the first pixel matrix and a pixel point of the first edge in the second pixel matrix.
In one or more alternative embodiments, the third building unit comprises a second processing subunit configured to use a local optimization algorithm to respectively correspond the first internal pixel points in the first pixel matrix to the second internal pixel points in the second pixel matrix.
In one or more alternative embodiments, the second processing subunit includes: processing a subunit, obtaining a subunit and selecting a subunit, wherein the processing subunit is configured to assume a pixel point B in the first internal pixel point i,j Corresponding to the pixel point S in the second internal pixel point m,n Wherein if B i-1,j Exist, and B i-1,j Corresponds to S a,b M is greater than or equal to a and n is greater than or equal to b; if B is i,j-1 Exist, and B i,j-1 Corresponds to S c,d M is greater than or equal to c and n is greater than or equal to d; an acquisition subunit connected to the processing subunit and configured to acquire a pixel point B in the first internal pixel point i,j And the pixel point S in the second internal pixel point a,b A first distance between the first internal pixel points is obtained to obtain a pixel point B in the first internal pixel points i,j And the pixel point S in the second internal pixel point c,d A second distance between the first and second internal pixels and obtaining a pixel point B in the first internal pixel point i,j And the pixel point S in the second internal pixel point a+1,b Or pixel point S c,d+1 A third distance therebetween; a selection subunit connected to the acquisition subunit and configured to select the first distanceThe pixel point in the second internal pixel point corresponding to the minimum distance between the second distance and the third distance is the pixel point B in the first internal pixel point i,j And corresponding pixel points.
In one or more alternative embodiments, the first determining module includes: an acquisition unit and a determination unit, wherein the acquisition unit is configured to acquire a candidate total distance, wherein the candidate total distance is obtained by summing candidate distances between the first internal pixel point and the second internal pixel point, and the candidate distance is at least one of two distances except a minimum distance in the first distance, the second distance and the third distance; and the determining unit is connected with the acquiring unit and is used for determining that the first material and the second material are materials with consistent content when the candidate total distance is smaller than or equal to the preset threshold value.
In one or more alternative embodiments, the above-mentioned building block is further arranged to equally correspond rows of a larger matrix of the first and second pixel matrices to rows of a smaller matrix, and to equally correspond columns of a larger matrix of the first and second pixel matrices to columns of a smaller matrix.
In one or more alternative embodiments, the pixel values of the first material and the pixel values of the second material are pixel values of at least one of the following pixels: red pixels, green pixels, blue pixels.
According to an embodiment of the present disclosure, there is further provided an apparatus for implementing the above-described material processing method five, and fig. 12 is an apparatus block diagram of a material processing apparatus two shown according to an exemplary embodiment. Referring to fig. 12, the apparatus includes a first display module 121, a receiving module 122, a second obtaining module 123, and a second display module 124, and the apparatus will be described below.
A first display module 121 configured to display a first material and a second material on a display interface; a receiving module 122 connected to the first display module 121 and configured to receive an identification instruction, where the identification instruction is used to identify whether the first material and the second material are materials with consistent content; a second obtaining module 123, connected to the receiving module 122, configured to obtain a pixel value of the first material in response to the identification instruction, to obtain a first pixel matrix of the first material, and to obtain a pixel value of the second material, to obtain a second pixel matrix of the second material, where a size of the first material is different from a size of the second material; the second display module 124 is connected to the second obtaining module 123 and configured to display a recognition result on the display interface, where the recognition result is used to identify whether the first material and the second material are consistent content materials, and the recognition result is determined according to a total distance and a predetermined threshold, where the first material and the second material are determined to be consistent content materials when the total distance is less than or equal to the predetermined threshold, and the total distance is obtained by establishing a correspondence between a pixel point in the first pixel matrix and a pixel point in the second pixel matrix, and obtaining a distance between the corresponding points according to the distance between the corresponding points.
Here, the first display module 121, the receiving module 122, the second obtaining module 123, and the second display module 124 correspond to steps S61 to S64 in embodiment 1, and the foregoing modules are consistent with examples and application scenarios implemented by the corresponding steps, but are not limited to those disclosed in embodiment 1. It should be noted that the above-described module may be operated as a part of the apparatus in the computer terminal 10 provided in embodiment 1.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
Example 3
Embodiments of the present disclosure may provide an electronic device, which may be a terminal or a server. For example, when the electronic device is a terminal, the terminal may be any one of a group of computer terminals. Alternatively, in this embodiment, the terminal may be a terminal device such as a mobile terminal.
Alternatively, in this embodiment, the terminal may be located in at least one network device among a plurality of network devices of the computer network.
Alternatively, fig. 10 is a block diagram of a structure of a terminal according to an exemplary embodiment. As shown in fig. 10, the terminal may include: one or more (only one is shown) processors 101, a memory 102 for storing processor-executable instructions; wherein the processor is configured to execute instructions to implement the material processing method of any one of the above.
The memory may be used to store software programs and modules, such as program instructions/modules corresponding to the material processing methods and apparatuses in the embodiments of the present disclosure, and the processor executes the software programs and modules stored in the memory, thereby executing various functional applications and data processing, that is, implementing the material processing methods described above. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include memory remotely located relative to the processor, which may be connected to the computer terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The processor may call the information and the application program stored in the memory through the transmission device to perform the following steps: obtaining pixel values of a first material, obtaining a first pixel matrix of the first material, and obtaining pixel values of a second material, obtaining a second pixel matrix of the second material, wherein the size of the first material is different from that of the second material; establishing a corresponding relation between the pixel points in the first pixel matrix and the pixel points in the second pixel matrix to obtain the distance between the corresponding points, and obtaining the total distance according to the distance between the corresponding points; and under the condition that the total distance is smaller than or equal to a preset threshold value, determining that the first material and the second material are the materials with consistent content.
Optionally, the above processor may further execute program code for: in the case that the established correspondence is a plurality of, the method further comprises: determining a minimum total distance from the total distances corresponding to the corresponding relations; the minimum total distance is compared to a predetermined threshold.
Optionally, the above processor may further execute program code for: establishing a correspondence between pixel points in the first pixel matrix and pixel points in the second pixel matrix includes: respectively corresponding the pixel points of the four vertexes in the first pixel matrix to the pixel points of the four vertexes in the second pixel matrix; respectively corresponding the pixel points on the four sides in the first pixel matrix to the pixel points on the four sides in the second pixel matrix; and respectively corresponding the first internal pixel points in the first pixel matrix to the second internal pixel points in the second pixel matrix, wherein the first internal pixel points are the pixel points except the pixel points on the four sides in the first pixel matrix, and the second internal pixel points are the pixel points except the pixel points on the four sides in the second pixel matrix.
Optionally, the above processor may further execute program code for: respectively corresponding the pixel points on the four sides in the first pixel matrix to the pixel points on the four sides in the second pixel matrix, wherein the method comprises the following steps: for a first side of the four sides, taking a pixel point of the first side in a first pixel matrix as a row, and taking a pixel point of the first side in a second pixel matrix as a column, constructing a distance matrix, wherein the value of a matrix element in the distance matrix is a pixel difference value between the pixel value of the pixel point on the corresponding row and the pixel value on the corresponding column, and the first side is any one of the four sides; and taking one vertex corresponding to the first edge as a starting point, and the other vertex as an end point, and finding a continuous shortest path from the starting point to the end point in the distance matrix, wherein matrix elements on the shortest path represent the corresponding relation between the pixel points of the first edge in the first pixel matrix and the pixel points of the first edge in the second pixel matrix.
Optionally, the above processor may further execute program code for: adopting a local optimization algorithm to respectively correspond first internal pixel points in a first pixel matrix to second internal pixel points in a second pixel matrix A partial pixel, comprising: assume that pixel point B in the first interior pixel point i,j Corresponding to the pixel point S in the second internal pixel point m,n Wherein if B i-1,j Exist, and B i-1,j Corresponds to S a,b M is greater than or equal to a and n is greater than or equal to b; if B is i,j-1 Exist, and B i,j-1 Corresponds to S c,d M is greater than or equal to c and n is greater than or equal to d; acquiring a pixel point B in the first internal pixel point i,j And pixel point S in the second internal pixel point a,b A first distance between the first and second pixel points is obtained to obtain a pixel point B in the first internal pixel point i,j And pixel point S in the second internal pixel point c,d A second distance between the first and second internal pixels and obtaining a pixel point B in the first internal pixel point i,j And pixel point S in the second internal pixel point a+1,b Or pixel point S c,d+1 A third distance therebetween; selecting the pixel point in the second internal pixel point corresponding to the minimum distance in the first distance, the second distance and the third distance as the pixel point B in the first internal pixel point i,j And corresponding pixel points.
Optionally, the above processor may further execute program code for: the method for determining the first material and the second material as the materials with consistent content comprises the following steps: obtaining a candidate total distance, wherein the candidate total distance is obtained by summing candidate distances between a first internal pixel point and a second internal pixel point, and the candidate distance is at least one of two distances except a minimum distance in the first distance, the second distance and the third distance; and under the condition that the candidate total distance is smaller than or equal to a preset threshold value, determining that the first material and the second material are the materials with consistent content.
Optionally, the above processor may further execute program code for: establishing a correspondence between pixel points in the first pixel matrix and pixel points in the second pixel matrix includes: the rows of the larger of the first and second pixel matrices are equally mapped to the rows of the smaller matrix, and the columns of the larger of the first and second pixel matrices are equally mapped to the columns of the smaller matrix.
Optionally, the above processor may further execute program code for: the pixel value of the first material and the pixel value of the second material are pixel values of at least one of the following pixels: red pixels, green pixels, blue pixels.
The processor may call the information and the application program stored in the memory through the transmission device to perform the following steps: displaying the first material and the second material on a display interface; receiving an identification instruction, wherein the identification instruction is used for identifying whether the first material and the second material are the materials with consistent content; responding to the identification instruction, acquiring a pixel value of a first material, acquiring a first pixel matrix of the first material, and acquiring a pixel value of a second material, and acquiring a second pixel matrix of the second material, wherein the size of the first material is different from that of the second material; and displaying a recognition result on a display interface, wherein the recognition result is used for identifying whether the first material and the second material are the materials with consistent content, the recognition result is determined according to the total distance and a preset threshold value, wherein the first material and the second material are determined to be the materials with consistent content under the condition that the total distance is smaller than or equal to the preset threshold value, and the total distance is obtained by establishing a corresponding relation between pixel points in a first pixel matrix and pixel points in a second pixel matrix, and obtaining the distance between the corresponding points according to the distance between the corresponding points.
As described above, the electronic device may also be a server, and embodiments of the present disclosure provide a server, and fig. 11 is a block diagram illustrating a structure of a server according to an exemplary embodiment. As shown in fig. 11, the server 110 may include: one or more (only one is shown in the figure) processing components 111, a memory 112 for storing instructions executable by the processing components 111, a power supply component 113 for supplying power, a network interface 114 for communicating with an external network, and an I/O input-output interface 115 for data transmission with the outside; wherein the processing component 111 is configured to execute instructions to implement the material processing method of any of the above.
The memory may be used to store software programs and modules, such as program instructions/modules corresponding to the material processing methods and apparatuses in the embodiments of the present disclosure, and the processor executes the software programs and modules stored in the memory, thereby executing various functional applications and data processing, that is, implementing the material processing methods described above. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include memory remotely located relative to the processor, which may be connected to the computer terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The processing component may call the information and the application program stored in the memory through the transmission device to perform the following steps: obtaining pixel values of a first material, obtaining a first pixel matrix of the first material, and obtaining pixel values of a second material, obtaining a second pixel matrix of the second material, wherein the size of the first material is different from that of the second material; establishing a corresponding relation between the pixel points in the first pixel matrix and the pixel points in the second pixel matrix to obtain the distance between the corresponding points, and obtaining the total distance according to the distance between the corresponding points; and under the condition that the total distance is smaller than or equal to a preset threshold value, determining that the first material and the second material are the materials with consistent content.
Optionally, the processing component may further execute program code for: in the case that the established correspondence is a plurality of, the method further comprises: determining a minimum total distance from the total distances corresponding to the corresponding relations; the minimum total distance is compared to a predetermined threshold.
Optionally, the processing component may further execute program code for: establishing a correspondence between pixel points in the first pixel matrix and pixel points in the second pixel matrix includes: respectively corresponding the pixel points of the four vertexes in the first pixel matrix to the pixel points of the four vertexes in the second pixel matrix; respectively corresponding the pixel points on the four sides in the first pixel matrix to the pixel points on the four sides in the second pixel matrix; and respectively corresponding the first internal pixel points in the first pixel matrix to the second internal pixel points in the second pixel matrix, wherein the first internal pixel points are the pixel points except the pixel points on the four sides in the first pixel matrix, and the second internal pixel points are the pixel points except the pixel points on the four sides in the second pixel matrix.
Optionally, the processing component may further execute program code for: respectively corresponding the pixel points on the four sides in the first pixel matrix to the pixel points on the four sides in the second pixel matrix, wherein the method comprises the following steps: for a first side of the four sides, taking a pixel point of the first side in a first pixel matrix as a row, and taking a pixel point of the first side in a second pixel matrix as a column, constructing a distance matrix, wherein the value of a matrix element in the distance matrix is a pixel difference value between the pixel value of the pixel point on the corresponding row and the pixel value on the corresponding column, and the first side is any one of the four sides; and taking one vertex corresponding to the first edge as a starting point, and the other vertex as an end point, and finding a continuous shortest path from the starting point to the end point in the distance matrix, wherein matrix elements on the shortest path represent the corresponding relation between the pixel points of the first edge in the first pixel matrix and the pixel points of the first edge in the second pixel matrix.
Optionally, the processing component may further execute program code for: respectively corresponding first internal pixel points in a first pixel matrix to second internal pixel points in a second pixel matrix, wherein the method comprises the following steps: and adopting a local optimization algorithm to respectively correspond the first internal pixel points in the first pixel matrix to the second internal pixel points in the second pixel matrix.
Optionally, the processing component may further execute program code for: adopting a local optimization algorithm, respectively corresponding first internal pixel points in a first pixel matrix to second internal pixel points in a second pixel matrix, wherein the method comprises the following steps: assume that pixel point B in the first interior pixel point i,j Corresponding to the pixel point S in the second internal pixel point m,n Wherein if B i-1,j Exist, and B i-1,j Corresponds to S a,b M is greater than or equal to a and n is greater than or equal to b; if B is i,j-1 Exist, and B i,j-1 Corresponds to S c,d M is greater than or equal to c andn is more than or equal to d; acquiring a pixel point B in the first internal pixel point i,j And pixel point S in the second internal pixel point a,b A first distance between the first and second pixel points is obtained to obtain a pixel point B in the first internal pixel point i,j And pixel point S in the second internal pixel point c,d A second distance between the first and second internal pixels and obtaining a pixel point B in the first internal pixel point i,j And pixel point S in the second internal pixel point a+1,b Or pixel point S c,d+1 A third distance therebetween; selecting the pixel point in the second internal pixel point corresponding to the minimum distance in the first distance, the second distance and the third distance as the pixel point B in the first internal pixel point i,j And corresponding pixel points.
Optionally, the processing component may further execute program code for: the method for determining the first material and the second material as the materials with consistent content comprises the following steps: obtaining a candidate total distance, wherein the candidate total distance is obtained by summing candidate distances between a first internal pixel point and a second internal pixel point, and the candidate distance is at least one of two distances except a minimum distance in the first distance, the second distance and the third distance; and under the condition that the candidate total distance is smaller than or equal to a preset threshold value, determining that the first material and the second material are the materials with consistent content.
Optionally, the processing component may further execute program code for: establishing a correspondence between pixel points in the first pixel matrix and pixel points in the second pixel matrix includes: the rows of the larger of the first and second pixel matrices are equally mapped to the rows of the smaller matrix, and the columns of the larger of the first and second pixel matrices are equally mapped to the columns of the smaller matrix.
Optionally, the processing component may further execute program code for: the pixel value of the first material and the pixel value of the second material are pixel values of at least one of the following pixels: red pixels, green pixels, blue pixels.
The processing component may call the information and the application program stored in the memory through the transmission device to perform the following steps: displaying the first material and the second material on a display interface; receiving an identification instruction, wherein the identification instruction is used for identifying whether the first material and the second material are the materials with consistent content; responding to the identification instruction, acquiring a pixel value of a first material, acquiring a first pixel matrix of the first material, and acquiring a pixel value of a second material, and acquiring a second pixel matrix of the second material, wherein the size of the first material is different from that of the second material; and displaying a recognition result on a display interface, wherein the recognition result is used for identifying whether the first material and the second material are the materials with consistent content, the recognition result is determined according to the total distance and a preset threshold value, wherein the first material and the second material are determined to be the materials with consistent content under the condition that the total distance is smaller than or equal to the preset threshold value, and the total distance is obtained by establishing a corresponding relation between pixel points in a first pixel matrix and pixel points in a second pixel matrix, and obtaining the distance between the corresponding points according to the distance between the corresponding points.
It will be appreciated by those skilled in the art that the structures shown in fig. 10 and 11 are only schematic, and the terminal may be a smart phone (such as an Android mobile phone, an iOS mobile phone, etc.), a tablet computer, a palm computer, a mobile internet device (Mobile Internet Devices, MID), a PAD, etc. Fig. 10 and 11 are not limited to the above-mentioned structure of the electronic device. For example, more or fewer components than shown in 10, FIG. 11 (e.g., network interfaces, display devices, etc.) may be included, or have a different configuration than shown in 10, FIG. 11.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be implemented by a program for instructing a terminal device to execute in association with hardware, the program may be stored in a computer readable storage medium, and the computer readable storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
Example 4
In an exemplary embodiment, there is also provided a computer-readable storage medium including instructions that, when executed by a processor of a terminal, enable the terminal to perform the material processing method of any one of the above. Alternatively, the computer readable storage medium may be a non-transitory computer readable storage medium, for example, a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Alternatively, in the present embodiment, the above-described computer-readable storage medium may be used to store program codes executed by the material processing method provided in the above-described embodiment 1.
Alternatively, in this embodiment, the above-mentioned computer-readable storage medium may be located in any one of the computer terminals in the computer terminal group in the computer network, or in any one of the mobile terminals in the mobile terminal group.
Optionally, in the present embodiment, the computer readable storage medium is configured to store program code for performing the steps of: obtaining pixel values of a first material, obtaining a first pixel matrix of the first material, and obtaining pixel values of a second material, obtaining a second pixel matrix of the second material, wherein the size of the first material is different from that of the second material; establishing a corresponding relation between the pixel points in the first pixel matrix and the pixel points in the second pixel matrix to obtain the distance between the corresponding points, and obtaining the total distance according to the distance between the corresponding points; and under the condition that the total distance is smaller than or equal to a preset threshold value, determining that the first material and the second material are the materials with consistent content.
Optionally, in the present embodiment, the computer readable storage medium is further configured to store program code for performing the steps of: in the case that the established correspondence is a plurality of, the method further comprises: determining a minimum total distance from the total distances corresponding to the corresponding relations; the minimum total distance is compared to a predetermined threshold.
Optionally, in the present embodiment, the computer readable storage medium is further configured to store program code for performing the steps of: establishing a correspondence between pixel points in the first pixel matrix and pixel points in the second pixel matrix includes: respectively corresponding the pixel points of the four vertexes in the first pixel matrix to the pixel points of the four vertexes in the second pixel matrix; respectively corresponding the pixel points on the four sides in the first pixel matrix to the pixel points on the four sides in the second pixel matrix; and respectively corresponding the first internal pixel points in the first pixel matrix to the second internal pixel points in the second pixel matrix, wherein the first internal pixel points are the pixel points except the pixel points on the four sides in the first pixel matrix, and the second internal pixel points are the pixel points except the pixel points on the four sides in the second pixel matrix.
Optionally, in the present embodiment, the computer readable storage medium is further configured to store program code for performing the steps of: respectively corresponding the pixel points on the four sides in the first pixel matrix to the pixel points on the four sides in the second pixel matrix, wherein the method comprises the following steps: for a first side of the four sides, taking a pixel point of the first side in a first pixel matrix as a row, and taking a pixel point of the first side in a second pixel matrix as a column, constructing a distance matrix, wherein the value of a matrix element in the distance matrix is a pixel difference value between the pixel value of the pixel point on the corresponding row and the pixel value on the corresponding column, and the first side is any one of the four sides; and taking one vertex corresponding to the first edge as a starting point, and the other vertex as an end point, and finding a continuous shortest path from the starting point to the end point in the distance matrix, wherein matrix elements on the shortest path represent the corresponding relation between the pixel points of the first edge in the first pixel matrix and the pixel points of the first edge in the second pixel matrix.
Optionally, in the present embodiment, the computer readable storage medium is further configured to store program code for performing the steps of: respectively corresponding first internal pixel points in a first pixel matrix to second internal pixel points in a second pixel matrix, wherein the method comprises the following steps: and adopting a local optimization algorithm to respectively correspond the first internal pixel points in the first pixel matrix to the second internal pixel points in the second pixel matrix.
Alternatively, in the present embodiment, the computer-readable storage medium is further configured to store a program for executing the steps ofCode: adopting a local optimization algorithm, respectively corresponding first internal pixel points in a first pixel matrix to second internal pixel points in a second pixel matrix, wherein the method comprises the following steps: assume that pixel point B in the first interior pixel point i,j Corresponding to the pixel point S in the second internal pixel point m,n Wherein if B i-1,j Exist, and B i-1,j Corresponds to S a,b M is greater than or equal to a and n is greater than or equal to b; if B is i,j-1 Exist, and B i,j-1 Corresponds to S c,d M is greater than or equal to c and n is greater than or equal to d; acquiring a pixel point B in the first internal pixel point i,j And pixel point S in the second internal pixel point a,b A first distance between the first and second pixel points is obtained to obtain a pixel point B in the first internal pixel point i,j And pixel point S in the second internal pixel point c,d A second distance between the first and second internal pixels and obtaining a pixel point B in the first internal pixel point i,j And pixel point S in the second internal pixel point a+1,b Or pixel point S c,d+1 A third distance therebetween; selecting the pixel point in the second internal pixel point corresponding to the minimum distance in the first distance, the second distance and the third distance as the pixel point B in the first internal pixel point i,j And corresponding pixel points.
Optionally, in the present embodiment, the computer readable storage medium is further configured to store program code for performing the steps of: the method for determining the first material and the second material as the materials with consistent content comprises the following steps: obtaining a candidate total distance, wherein the candidate total distance is obtained by summing candidate distances between a first internal pixel point and a second internal pixel point, and the candidate distance is at least one of two distances except a minimum distance in the first distance, the second distance and the third distance; and under the condition that the candidate total distance is smaller than or equal to a preset threshold value, determining that the first material and the second material are the materials with consistent content.
Optionally, in the present embodiment, the computer readable storage medium is further configured to store program code for performing the steps of: establishing a correspondence between pixel points in the first pixel matrix and pixel points in the second pixel matrix includes: the rows of the larger of the first and second pixel matrices are equally mapped to the rows of the smaller matrix, and the columns of the larger of the first and second pixel matrices are equally mapped to the columns of the smaller matrix.
Optionally, in the present embodiment, the computer readable storage medium is further configured to store program code for performing the steps of: the pixel value of the first material and the pixel value of the second material are pixel values of at least one of the following pixels: red pixels, green pixels, blue pixels.
Optionally, in the present embodiment, the computer readable storage medium is further configured to store program code for performing the steps of: displaying the first material and the second material on a display interface; receiving an identification instruction, wherein the identification instruction is used for identifying whether the first material and the second material are the materials with consistent content; responding to the identification instruction, acquiring a pixel value of a first material, acquiring a first pixel matrix of the first material, and acquiring a pixel value of a second material, and acquiring a second pixel matrix of the second material, wherein the size of the first material is different from that of the second material; and displaying a recognition result on a display interface, wherein the recognition result is used for identifying whether the first material and the second material are the materials with consistent content, the recognition result is determined according to the total distance and a preset threshold value, wherein the first material and the second material are determined to be the materials with consistent content under the condition that the total distance is smaller than or equal to the preset threshold value, and the total distance is obtained by establishing a corresponding relation between pixel points in a first pixel matrix and pixel points in a second pixel matrix, and obtaining the distance between the corresponding points according to the distance between the corresponding points.
In an exemplary embodiment, a computer program product is also provided, which, when executed by a processor of a terminal, enables the terminal to perform the material processing method of any one of the above.
The foregoing embodiment numbers of the present disclosure are merely for description and do not represent advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present disclosure, the descriptions of the various embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed technology may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and are merely a logical functional division, and there may be other manners of dividing the apparatus in actual implementation, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present disclosure may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present disclosure may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a computer readable storage medium, including several instructions to cause a computer device (which may be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the methods of the various embodiments of the present disclosure. And the aforementioned computer-readable storage medium includes: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (23)

1. A material processing method, characterized by comprising:
obtaining a pixel value of a first material, obtaining a first pixel matrix of the first material, and obtaining a pixel value of a second material, obtaining a second pixel matrix of the second material, wherein the size of the first material is different from the size of the second material;
establishing a corresponding relation between pixel points in the first pixel matrix and pixel points in the second pixel matrix to obtain a distance between the corresponding points, and obtaining a total distance according to the distance between the corresponding points;
Under the condition that the total distance is smaller than or equal to a preset threshold value, determining that the first material and the second material are materials with consistent content;
wherein, the established corresponding relation satisfies the following conditions: the pixel points of the four vertexes of the two matrixes are in one-to-one correspondence, each pixel point in the two matrixes has a corresponding relation, and the corresponding relations are not crossed.
2. The method according to claim 1, wherein in the case where the established correspondence is plural, the method further comprises:
determining a minimum total distance from the total distances corresponding to the corresponding relations;
the minimum total distance is compared to the predetermined threshold.
3. The method of claim 2, wherein establishing a correspondence between pixels in the first pixel matrix and pixels in the second pixel matrix comprises:
respectively corresponding the pixel points of the four vertexes in the first pixel matrix to the pixel points of the four vertexes in the second pixel matrix;
respectively corresponding the pixel points on the four sides of the first pixel matrix to the pixel points on the four sides of the second pixel matrix;
and respectively corresponding first internal pixel points in the first pixel matrix to second internal pixel points in the second pixel matrix, wherein the first internal pixel points are pixel points except for the pixel points on four sides in the first pixel matrix, and the second internal pixel points are pixel points except for the pixel points on four sides in the second pixel matrix.
4. A method according to claim 3, wherein the respectively corresponding pixels on four sides of the first pixel matrix to pixels on four sides of the second pixel matrix comprises:
for a first side of the four sides, taking a pixel point of the first side in the first pixel matrix as a row, and taking a pixel point of the first side in the second pixel matrix as a column, constructing a distance matrix, wherein a value of a matrix element in the distance matrix is a pixel difference value between a pixel value of a pixel point on a corresponding row and a pixel value of a pixel point on a corresponding column, and the first side is any one of the four sides;
and taking one vertex corresponding to the first edge as a starting point and the other vertex as an end point, and finding a continuous shortest path from the starting point to the end point in the distance matrix, wherein matrix elements on the shortest path represent the corresponding relation between the pixel point of the first edge in the first pixel matrix and the pixel point of the first edge in the second pixel matrix.
5. A method according to claim 3, wherein the respectively corresponding first inner pixels in the first pixel matrix to second inner pixels in the second pixel matrix comprises:
And adopting a local optimization algorithm to respectively correspond the first internal pixel points in the first pixel matrix to the second internal pixel points in the second pixel matrix.
6. The method of claim 5, wherein using the local optimization algorithm to respectively correspond first interior pixels in the first pixel matrix to second interior pixels in the second pixel matrix comprises:
assume that a pixel point in the first internal pixel pointCorresponding to pixel points in the second interior pixel point +.>Wherein, if->Exist and->Corresponding to->Then->And->The method comprises the steps of carrying out a first treatment on the surface of the If->Exist and->Corresponding toThen->And->
Acquiring pixel points in the first internal pixel pointsAnd pixel point +.>A first distance between the first internal pixel points is obtained>And the pixel point in the second internal pixel pointA second distance between the first and second internal pixels and obtaining a pixel of the first internal pixels>And pixel point +.>Or pixel dot +.>A third distance therebetween;
selecting the pixel point in the second internal pixel point corresponding to the minimum distance between the second distance and the third distance as the pixel point in the first internal pixel point And corresponding pixel points.
7. The method of claim 6, wherein determining that the first material and the second material are consistent content materials comprises:
obtaining a candidate total distance, wherein the candidate total distance is obtained by summing candidate distances between the first internal pixel point and the second internal pixel point, and the candidate distance is at least one of the two distances except the minimum distance in the first distance, the second distance and the third distance;
and under the condition that the candidate total distance is smaller than or equal to the preset threshold value, determining that the first material and the second material are materials with consistent content.
8. The method of claim 1, wherein establishing a correspondence between pixel points in the first pixel matrix and pixel points in the second pixel matrix comprises:
the rows of the larger of the first and second pixel matrices are equally mapped to the rows of the smaller matrix, and the columns of the larger of the first and second pixel matrices are equally mapped to the columns of the smaller matrix.
9. The method according to any one of claims 1 to 8, wherein the pixel values of the first material and the pixel values of the second material are pixel values of at least one of: red pixels, green pixels, blue pixels.
10. A material processing method, characterized by comprising:
displaying the first material and the second material on a display interface;
receiving an identification instruction, wherein the identification instruction is used for identifying whether the first material and the second material are materials with consistent content;
responding to the identification instruction, acquiring a pixel value of a first material, acquiring a first pixel matrix of the first material, and acquiring a pixel value of a second material, and acquiring a second pixel matrix of the second material, wherein the size of the first material is different from that of the second material;
displaying a recognition result on the display interface, wherein the recognition result is used for identifying whether the first material and the second material are materials with consistent content, the recognition result is determined according to a total distance and a preset threshold value, and when the total distance is smaller than or equal to the preset threshold value, the first material and the second material are determined to be materials with consistent content, and the total distance is obtained according to the distance between the corresponding points by establishing a corresponding relation between the pixel points in the first pixel matrix and the pixel points in the second pixel matrix;
Wherein, the established corresponding relation satisfies the following conditions: the pixel points of the four vertexes of the two matrixes are in one-to-one correspondence, each pixel point in the two matrixes has a corresponding relation, and the corresponding relations are not crossed.
11. A material processing apparatus, comprising:
the first acquisition module is configured to acquire a pixel value of a first material, obtain a first pixel matrix of the first material, and acquire a pixel value of a second material, obtain a second pixel matrix of the second material, wherein the size of the first material is different from the size of the second material;
the establishing module is used for establishing a corresponding relation between the pixel points in the first pixel matrix and the pixel points in the second pixel matrix to obtain the distance between the corresponding points and obtain the total distance;
the first determining module is configured to determine that the first material and the second material are materials with consistent content when the total distance is smaller than or equal to a preset threshold, wherein the established corresponding relation satisfies the following conditions: the pixel points of the four vertexes of the two matrixes are in one-to-one correspondence, each pixel point in the two matrixes has a corresponding relation, and the corresponding relations are not crossed.
12. The apparatus as recited in claim 11, further comprising:
the second determining module is configured to determine a minimum total distance from total distances corresponding to the plurality of corresponding relations when the plurality of corresponding relations are established;
a comparison module is arranged to compare the minimum total distance with the predetermined threshold.
13. The apparatus of claim 12, wherein the means for establishing comprises:
the first building unit is arranged to respectively correspond the pixel points of the four vertexes in the first pixel matrix to the pixel points of the four vertexes in the second pixel matrix;
a second establishing unit, configured to respectively correspond the pixel points on the four sides in the first pixel matrix to the pixel points on the four sides in the second pixel matrix;
the third establishing unit is configured to respectively correspond first internal pixel points in the first pixel matrix to second internal pixel points in the second pixel matrix, wherein the first internal pixel points are pixel points except for pixel points on four sides in the first pixel matrix, and the second internal pixel points are pixel points except for pixel points on four sides in the second pixel matrix.
14. The apparatus of claim 13, wherein the second establishing unit comprises:
a constructing subunit, configured to construct a distance matrix by using, for a first side of the four sides, a pixel point of the first side in the first pixel matrix as a row and a pixel point of the first side in the second pixel matrix as a column, where a value of a matrix element in the distance matrix is a pixel difference value between a pixel value of a pixel point on a corresponding row and a pixel value of a pixel point on a corresponding column, and the first side is any one of the four sides;
the first processing subunit is configured to find a continuous shortest path from the start point to the end point in the distance matrix by taking one vertex corresponding to the first edge as the start point and the other vertex as the end point, where a matrix element on the shortest path represents a correspondence between a pixel point of the first edge in the first pixel matrix and a pixel point of the first edge in the second pixel matrix.
15. The apparatus of claim 13, wherein the third establishing unit comprises:
and the second processing subunit is configured to respectively correspond the first internal pixel points in the first pixel matrix to the second internal pixel points in the second pixel matrix by adopting a local optimization algorithm.
16. The apparatus of claim 15, wherein the second processing subunit comprises:
a processing subunit configured to assume that a pixel in the first interior pixel corresponds to a pixel in the second interior pixel, wherein if present, and corresponds to; if present, and corresponds to;
an acquisition subunit configured to acquire a first distance between a pixel in the first internal pixel and a pixel in the second internal pixel, acquire a second distance between a pixel in the first internal pixel and a pixel in the second internal pixel, and acquire a third distance between a pixel in the first internal pixel and a pixel in the second internal pixel or a pixel;
and selecting a secondary subunit, wherein the secondary subunit is configured to select the first distance, and the pixel point in the second internal pixel point corresponding to the minimum distance in the second distance and the third distance is the pixel point corresponding to the pixel point in the first internal pixel point.
17. The apparatus of claim 16, wherein the first determining module comprises:
An obtaining unit configured to obtain a candidate total distance, where the candidate total distance is obtained by summing candidate distances between the first internal pixel point and the second internal pixel point, where the candidate distance is at least one of two distances except a minimum distance from the first distance, the second distance, and the third distance;
and a determining unit configured to determine that the first material and the second material are materials with consistent content in a case where the candidate total distance is less than or equal to the predetermined threshold.
18. The apparatus of claim 11, wherein the setup module is further configured to equally correspond rows of a larger of the first and second pixel matrices to rows of a smaller matrix and equally correspond columns of a larger of the first and second pixel matrices to columns of a smaller matrix.
19. The apparatus according to any one of claims 11 to 18, wherein the pixel values of the first material and the pixel values of the second material are pixel values of at least one of: red pixels, green pixels, blue pixels.
20. A material processing apparatus, comprising:
the first display module is arranged to display the first material and the second material on the display interface;
the receiving module is used for receiving an identification instruction, wherein the identification instruction is used for identifying whether the first material and the second material are materials with consistent content or not;
the second acquisition module is configured to respond to the identification instruction, acquire a pixel value of a first material, obtain a first pixel matrix of the first material, and acquire a pixel value of a second material, obtain a second pixel matrix of the second material, wherein the size of the first material is different from the size of the second material;
the second display module is configured to display a recognition result on the display interface, wherein the recognition result is used for identifying whether the first material and the second material are materials with consistent content, the recognition result is determined according to a total distance and a preset threshold, and the first material and the second material are determined to be materials with consistent content when the total distance is smaller than or equal to the preset threshold, and the total distance is obtained by establishing a corresponding relation between a pixel point in the first pixel matrix and a pixel point in the second pixel matrix;
Wherein, the established corresponding relation satisfies the following conditions: the pixel points of the four vertexes of the two matrixes are in one-to-one correspondence, each pixel point in the two matrixes has a corresponding relation, and the corresponding relations are not crossed.
21. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the material processing method of any one of claims 1 to 10.
22. A computer-readable storage medium, wherein instructions in the computer-readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the material processing method of any one of claims 1 to 10.
23. A computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the material processing method of any one of claims 1 to 10.
CN202110605579.4A 2021-05-31 2021-05-31 Material processing method, device, electronic equipment and computer readable storage medium Active CN113344068B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110605579.4A CN113344068B (en) 2021-05-31 2021-05-31 Material processing method, device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110605579.4A CN113344068B (en) 2021-05-31 2021-05-31 Material processing method, device, electronic equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN113344068A CN113344068A (en) 2021-09-03
CN113344068B true CN113344068B (en) 2023-10-17

Family

ID=77473584

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110605579.4A Active CN113344068B (en) 2021-05-31 2021-05-31 Material processing method, device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN113344068B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104599247A (en) * 2015-01-04 2015-05-06 深圳市腾讯计算机系统有限公司 Image correction method and device
CN104981105A (en) * 2015-07-09 2015-10-14 广东工业大学 Detecting and error-correcting method capable of rapidly and accurately obtaining element center and deflection angle
CN108182686A (en) * 2017-12-28 2018-06-19 山东师范大学 Based on the matched OCT eye fundus images semi-automatic partition method of group of curves and device
CN110503010A (en) * 2019-08-06 2019-11-26 北京达佳互联信息技术有限公司 Material display methods, device and electronic equipment, storage medium
CN111540217A (en) * 2020-04-16 2020-08-14 成都旸谷信息技术有限公司 Mask matrix-based intelligent average vehicle speed monitoring method and system
CN111612757A (en) * 2020-05-18 2020-09-01 苏州精濑光电有限公司 Screen crack detection method, device, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104599247A (en) * 2015-01-04 2015-05-06 深圳市腾讯计算机系统有限公司 Image correction method and device
CN104981105A (en) * 2015-07-09 2015-10-14 广东工业大学 Detecting and error-correcting method capable of rapidly and accurately obtaining element center and deflection angle
CN108182686A (en) * 2017-12-28 2018-06-19 山东师范大学 Based on the matched OCT eye fundus images semi-automatic partition method of group of curves and device
CN110503010A (en) * 2019-08-06 2019-11-26 北京达佳互联信息技术有限公司 Material display methods, device and electronic equipment, storage medium
CN111540217A (en) * 2020-04-16 2020-08-14 成都旸谷信息技术有限公司 Mask matrix-based intelligent average vehicle speed monitoring method and system
CN111612757A (en) * 2020-05-18 2020-09-01 苏州精濑光电有限公司 Screen crack detection method, device, equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
张金萍 ; 刘杰 ; 李允公 ; 倪洪启 ; .一种基于PCA的工件图像匹配方法的研究.东北大学学报(自然科学版).2008,(第11期),全文. *
谢毓湘 ; 栾悉道 ; 魏迎梅 ; 张芯 ; 吴玲达 ; 邓莉琼 ; .面向交互式快速动画制作的素材标注与检索系统.小型微型计算机系统.2012,(第10期),全文. *

Also Published As

Publication number Publication date
CN113344068A (en) 2021-09-03

Similar Documents

Publication Publication Date Title
EP3454250A1 (en) Facial image processing method and apparatus and storage medium
US20170116765A1 (en) Methods and systems for color processing of digital images
CN107749986B (en) Teaching video generation method and device, storage medium and computer equipment
CN109120854A (en) Image processing method, device, electronic equipment and storage medium
CN109690611B (en) Image correction method and device
CN112991178A (en) Image splicing method, device, equipment and medium
CN114298902A (en) Image alignment method and device, electronic equipment and storage medium
CN111462221A (en) Method, device and equipment for extracting shadow area of object to be detected and storage medium
CN113011403B (en) Gesture recognition method, system, medium and device
CN113344068B (en) Material processing method, device, electronic equipment and computer readable storage medium
CN113139905B (en) Image stitching method, device, equipment and medium
US8953893B2 (en) System and method to determine feature candidate pixels of an image
US11741612B2 (en) Image binarization method and electronic device
CN113516697A (en) Image registration method and device, electronic equipment and computer-readable storage medium
CN111507894B (en) Image stitching processing method and device
CN110458232B (en) Method and equipment for determining image style similarity
CN112883762A (en) Living body detection method, device, system and storage medium
US20220301278A1 (en) Image processing method and apparatus, storage medium, and electronic device
CN110751703A (en) Winding picture generation method, device, equipment and storage medium
JP2017162179A (en) Information processing apparatus, information processing method, and program
CN114827562A (en) Projection method, projection device, projection equipment and computer storage medium
CN110310341B (en) Method, device, equipment and storage medium for generating default parameters in color algorithm
CN116188808B (en) Image feature extraction method and system, storage medium and electronic device
CN113850238B (en) Document detection method and device, electronic equipment and storage medium
EP4231253A1 (en) A method and system for dynamic cropping of full body pose images

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant