CN113344068A - Material processing method and device, electronic equipment and computer readable storage medium - Google Patents
Material processing method and device, electronic equipment and computer readable storage medium Download PDFInfo
- Publication number
- CN113344068A CN113344068A CN202110605579.4A CN202110605579A CN113344068A CN 113344068 A CN113344068 A CN 113344068A CN 202110605579 A CN202110605579 A CN 202110605579A CN 113344068 A CN113344068 A CN 113344068A
- Authority
- CN
- China
- Prior art keywords
- pixel
- matrix
- points
- distance
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/22—Matching criteria, e.g. proximity measures
Landscapes
- Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Image Analysis (AREA)
Abstract
The disclosure relates to a material processing method, a material processing device, an electronic device and a computer-readable storage medium, wherein the method comprises the following steps: the method comprises the steps of obtaining a pixel value of a first material to obtain a first pixel matrix of the first material, obtaining a pixel value of a second material to obtain 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 pixel points in the first pixel matrix and pixel points in the second pixel matrix to obtain a distance between corresponding points, and obtaining a total distance according to the distance between the corresponding points; and determining the first material and the second material as materials with consistent contents when the total distance is smaller than or equal to a preset threshold value. Through 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 less resources is achieved.
Description
Technical Field
The present disclosure relates to the field of computers, and in particular, to a method and an apparatus for processing a material, an electronic device, and a computer-readable storage medium.
Background
At present, material content identification has more applications (such as face identification and material search), and most of the applications use complex algorithms such as machine learning and deep learning, so that the complex content can be accurately identified in different scenes. Different targets and objects are identified through the complex algorithm, material collection, material preprocessing, feature extraction and material identification, but when the method is adopted to identify the content of the material, more computing resources are consumed. Therefore, there is a problem in that the related art uses excessive resources to identify the content of the material.
Disclosure of Invention
The disclosure provides a material processing method, a material processing device, an electronic device and a computer-readable storage medium, which are used for at least solving the problem of excessive resource consumption when material content is identified in the related art. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided a material processing method, including: the method comprises the steps of obtaining a pixel value of a first material to obtain a first pixel matrix of the first material, obtaining a pixel value of a second material to obtain 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 a distance between corresponding points, and obtaining a total distance according to the distance between the corresponding points; and determining that the first material and the second material are consistent in content when the total distance is smaller than or equal to a preset threshold value.
Optionally, in a case that the established correspondence is multiple, the method further includes: determining a minimum total distance from the total distances corresponding to the plurality of corresponding relations; comparing the minimum total distance to the predetermined threshold.
Optionally, establishing a correspondence between a pixel point in the first pixel matrix and a pixel point 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 pixel points on four edges in the first pixel matrix to pixel points on four edges in 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 pixel points on four edges in the first pixel matrix, and the second internal pixel points are pixel points except for pixel points on four edges in the second pixel matrix.
Optionally, the 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 respectively includes: for a first side of the four sides, constructing a distance matrix by taking pixel points of the first side in the first pixel matrix as rows and taking pixel points of the first side in the second pixel matrix as columns, wherein values of matrix elements in the distance matrix are pixel difference values between pixel values of pixel points on corresponding rows and corresponding columns, and the first side is any one of the four sides; and finding a continuous shortest path from the starting point to the end point in the distance matrix by taking one vertex corresponding to the first edge as a starting point and the other vertex as an end point, wherein a matrix element on the shortest path represents 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 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 respectively corresponding first internal pixel points in the first pixel matrix to second internal pixel points in the second pixel matrix by adopting a local optimal algorithm.
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 by using the local optimal algorithm includes: assume pixel B of the first internal pixelsi,jCorresponding to the pixel point S in the second internal pixel pointm,nWherein, if B isi-1,jExist and B isi-1,jCorresponds to Sa,bIf m is greater than or equal to a and n is greater than or equal to b; if B is presenti,j-1Exist and B isi,j-1Corresponds to Sc,dIf m is greater than or equal to c and n is greater than or equal to d; obtaining a pixel point B in the first internal pixel pointsi,jAnd a pixel point S in the second internal pixel pointa,bA first distance between the first internal pixel points, and a pixel point B in the first internal pixel pointsi,jAnd a pixel point S in the second internal pixel pointc,dAnd obtaining a pixel point B of the first internal pixel pointi,jAnd a pixel point S in the second internal pixel pointa+1,bOr pixel point Sc,d+1A third distance therebetween; selecting 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 pointi,jAnd (4) corresponding pixel points.
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 first distance, the second distance and the third distance except for the minimum distance; and determining the first material and the second material as materials with consistent contents when the candidate total distance is smaller than or equal to the preset threshold value.
Optionally, establishing a correspondence between a pixel point in the first pixel matrix and a pixel point in the second pixel matrix includes: equally corresponding rows of a larger one of the first and second pixel matrices to rows of a smaller matrix, and equally corresponding columns of the larger one of the first and second pixel matrices to columns of the smaller matrix.
Optionally, 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.
According to a second aspect of the embodiments of the present disclosure, there is provided a material processing method including: displaying a first material and a 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 consistent materials; responding to the identification instruction, acquiring a pixel value of a first material to obtain a first pixel matrix of the first material, and acquiring a pixel value of a second material to obtain 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 contents or not, the recognition result is determined according to a total distance and a preset threshold, wherein the first material and the second material are determined to be materials with consistent contents under the condition that the total distance is smaller than or equal to the preset threshold, 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 the distance between corresponding points is obtained according to the distance between corresponding points.
According to a third aspect of the embodiments of the present disclosure, there is provided a material processing apparatus including: the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a pixel value of a first material to obtain a first pixel matrix of the first material and acquiring a pixel value of a second material to obtain a second pixel matrix of the second material, and the size of the first material is different from that of the second material; an establishing module configured to establish a correspondence between pixel points in the first pixel matrix and pixel points in the second pixel matrix, to obtain a distance between corresponding points, and to obtain a total distance according to the distance between corresponding points; a first determining module configured to determine that the first material and the second material are materials with consistent content if the total distance is less than or equal to a predetermined threshold.
Optionally, the apparatus further comprises: a second determining module configured to determine a minimum total distance from total distances corresponding to the plurality of correspondence relationships, when the plurality of correspondence relationships are established; a comparison module configured to compare the minimum total distance to the predetermined threshold.
Optionally, the establishing module includes: a first establishing unit configured to correspond pixel points of four vertexes in the first pixel matrix to pixel points of four vertexes in the second pixel matrix, respectively; 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; and 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 in the first pixel matrix except for pixel points on four sides, and the second internal pixel points are pixel points in the second pixel matrix except for pixel points on four sides.
Optionally, the second establishing unit includes: a constructing subunit configured to construct, for a first edge of the four edges, a distance matrix by using, as rows, pixel points of the first edge in the first pixel matrix and using, as columns, pixel points of the first edge in the second pixel matrix, where a value of a matrix element in the distance matrix is a pixel difference value between pixel values of pixel points on a corresponding row and a corresponding column, and the first edge is any one of the four edges; and the first processing subunit is configured to find a continuous shortest path from the starting point to the end point in the distance matrix by taking one vertex corresponding to the first edge as a starting point and the other vertex as an end point, wherein a matrix element on the shortest path represents a corresponding relationship 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 using a local optimal algorithm.
Optionally, the second processing subunit includes: a processing subunit configured to assume a pixel point B of the first internal pixel pointsi,jCorresponding to the pixel point S in the second internal pixel pointm,nWherein, if B isi-1,jExist and B isi-1,jCorresponds to Sa,bIf m is greater than or equal to a and n is greater than or equal to b; if B is presenti,j-1Exist, and areBi,j-1Corresponds to Sc,dIf m is greater than or equal to c and n is greater than or equal to d; an acquisition subunit configured to acquire a pixel point B of the first internal pixel pointsi,jAnd a pixel point S in the second internal pixel pointa,bA first distance between the first internal pixel points, and a pixel point B in the first internal pixel pointsi,jAnd a pixel point S in the second internal pixel pointc,dAnd obtaining a pixel point B of the first internal pixel pointi,jAnd a pixel point S in the second internal pixel pointa+1,bOr pixel point Sc,d+1A third distance therebetween; a selecting sub-unit configured to select the first distance, wherein a pixel point of a second internal pixel point corresponding to a minimum distance of the second distance and the third distance is a pixel point B of the first internal pixel pointi,jAnd (4) corresponding pixel points.
Optionally, the first determining module includes: an obtaining unit, configured to obtain a total candidate distance, where the total candidate distance is obtained by summing candidate distances between the first internal pixel point and the second internal pixel point, where the candidate distance is the first distance, and at least one of two distances other than a minimum distance in the second distance and the third distance; a determination unit configured to determine that the first material and the second material are materials having consistent contents if the candidate total distance is less than or equal to the predetermined threshold.
Optionally, the creating module is further configured to equally correspond rows of a larger one of the first and second pixel matrices to rows of a smaller matrix and equally correspond columns of the larger one of the first and second pixel matrices to columns of the smaller matrix.
Optionally, 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.
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 used for displaying a first material and a second material on a 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 consistent materials; a second obtaining module, configured to, in response to the identification instruction, obtain a pixel value of a first material to obtain a first pixel matrix of the first material, and obtain a pixel value of a 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 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 predetermined threshold, where the first material and the second material are determined to be materials with consistent content 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 to obtain a distance between corresponding points and obtaining a distance between corresponding points according to the distance between corresponding points.
According to a fifth aspect of embodiments of the present disclosure, there is provided an electronic apparatus including: 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 in which instructions, when executed by a processor of an electronic device, enable 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 including a computer program that, 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:
whether the content of the material is consistent or not can be determined by comparing the total distance between the pixel points included in the two materials with a preset threshold value, and compared with the prior art that the material is identified by adopting a deep neural network model and a large amount of computing resources need to be consumed, the method and the device for identifying the material can effectively reduce the resources consumed in the process of identifying the material on the premise that 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 present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting 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 first material processing method according to an exemplary embodiment.
Fig. 3 is a flow chart 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 in accordance with an exemplary embodiment.
Fig. 6 is a flow diagram illustrating a method five of material processing 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 according to an exemplary embodiment.
Fig. 9 is a diagram of a DTW algorithm in accordance with an exemplary embodiment.
Fig. 10 is a general flow diagram in accordance with an exemplary embodiment.
Fig. 11 is a device block diagram of the first material processing device shown according to an exemplary embodiment.
Fig. 12 is a device block diagram of the second material processing device shown according to an exemplary embodiment.
Fig. 13 is an apparatus block diagram of a terminal shown in accordance with an example embodiment.
FIG. 14 is a block diagram illustrating a configuration of a server according to an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in 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 above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended 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 different than presented herein.
The method provided by the embodiment 1 of the present disclosure can be executed in a mobile terminal, a computer terminal or a similar operation 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 (shown as 102a, 102b, … …, 102 n) processors 102 (the processors 102 may include, but are not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA, etc.), memories 104 for storing data, and a transmission device for communication functions. Besides, the method can also comprise the following steps: 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 source, and/or a camera. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the electronic device. 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 circuitry described above may be referred to generally herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part in software, hardware, firmware, or any combination thereof. Further, the data processing circuit 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 disclosed embodiments, the data processing circuit acts as a processor control (e.g., selection of a variable resistance termination path connected to the interface).
The memory 104 can be used for storing software programs and modules of application software, such as program instructions/data storage devices corresponding to the material processing method in the embodiment of the disclosure, and the processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implementing the material processing method of the application program. The 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 device is used for receiving or transmitting data via a network. 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 device includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmission device may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
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 particular 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 operating environment, the present disclosure provides a material processing method as shown in fig. 2. Fig. 2 is a flowchart illustrating a first material processing method according to an exemplary embodiment, which is used in the computer terminal described above and includes the following steps, as shown in fig. 2.
In step S21, obtaining a pixel value of a first material to obtain a first pixel matrix of the first material, and obtaining a pixel value of a second material to 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;
in step S22, a correspondence relationship between pixel points in the first pixel matrix and pixel points in the second pixel matrix is established to obtain a distance between corresponding points, and a total distance is obtained according to the distance between corresponding points;
in step S23, in the case where the total distance is less than or equal to the predetermined threshold, the first material and the second material are determined to be 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 the deep neural network model is adopted to identify the materials and a large amount of computing resources are consumed, the method and the device can effectively reduce the resources consumed during material identification on the premise that certain identification accuracy can be achieved.
In one or more alternative embodiments, the above method may be applied to a client device without strong computing power, and is used for the client device to identify whether the contents of two materials are consistent. Generally, when identifying whether or not the material contents match in the client device, it is not necessary to identify the material contents particularly accurately, and the difference between the identified objects is relatively large, which is relatively easy to identify. Therefore, whether the contents of the two materials are consistent or not can be identified by adopting the method, so that the effects of considering the identification efficiency and saving the identification resources on the premise of meeting the requirement of accurate results are achieved.
In one or more alternative embodiments, the first material and the second material may be various types of materials, such as videos, photos, pictures, and the like. The first material and the second material may also be materials subjected to scaling operations at different scaling ratios. The materials with different sizes are applied to different equipment screens and resolutions. That is, the first material and the second material may be materials having the same content or materials having different contents. When the first material and the second material are placed at the same storage position, the method of the embodiment can quickly select the material with consistent content from the plurality of materials stored at the storage position, thereby effectively avoiding the problem that manual classification errors are likely to occur once the number of the materials is increased by adopting a manual classification method; in addition, when the material is made into different sizes, the situation of missing of pixel points may occur, and when the manual classification method is adopted for identification, the problem of low identification accuracy rate exists when the consistency of the material is identified due to the missing of the pixel points. By adopting the above method of comparing the total pixel distance with the predetermined threshold, the total pixel distance is less missing to the pixel point, and the total pixel distance is not affected, so that the problem of low identification accuracy can be effectively avoided.
In one or more optional embodiments, in the above-mentioned obtaining the pixel values of the first material and the second material, when obtaining the pixel values of the materials, a variety of manners may be adopted, for example, a third-party material processing library may be adopted to obtain pixel information of the materials, where the third-party material processing library may be a variety of types, taking the materials as pictures as an example, and the third-party material processing library is some picture processing libraries, for example, a pil (python Image library) library, an OPENCV library, and the like. The material is processed by the third-party material processing library, so that the pixel information in the material can be efficiently acquired, the pixel value of the material can be quickly and accurately acquired, the manual classification errors can be effectively avoided, and the automatic acquisition of the pixel value of the material is realized.
In one or more alternative embodiments, when identifying whether the content of the material is consistent by comparing the total distance of the pixels with a predetermined threshold, the specific pixel type may include a plurality of types, for example, the pixel type may include at least one of: red pixels, green pixels, blue pixels. That is, the corresponding pixel value is a pixel value of at least one of the following pixels: red pixels, green pixels, blue pixels. It should be noted that the number of pixel types can be flexibly selected, for example, when one of the pixels is selected, for example, one of red pixel, green pixel and blue pixel is arbitrarily selected, and whether the material contents are consistent or not is identified according to the pixel value of the selected pixel. Because only one type of pixel is obtained and only the pixel value of the type of pixel needs to be compared, whether two materials are materials with consistent content can be obtained with less 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 kinds of pixels can be selected, namely, a red pixel, a green pixel and a blue pixel are used for obtaining corresponding pixels, the obtained total distances are respectively compared with corresponding preset thresholds, so that corresponding identification results are respectively obtained, an arbitration result is obtained by arbitrating the three kinds of identification results, and the arbitration result is used as an identification result for judging whether the contents of the two materials are consistent or not. Since the plurality of recognition results need to be arbitrated, the 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 compared with the recognition result determined only by one pixel. However, although the recognition result is more accurate, three comparisons and one arbitration are required, and thus, the problems of consuming more computing resources and having a longer time are also present. Of course, considering the resource consumption, efficiency and accuracy corresponding to the identification results obtained by only one pixel and three pixels, a mode between the two pixels may be selected, for example, two pixels are selected, and the identification result for identifying whether the contents of the two materials are consistent is determined according to the identification results of the two pixels. By adopting the method, not only is excessive resource consumption not needed, but also a more accurate identification result can be efficiently obtained, and the method is more suitable for the application scene that whether the material content of the local identification material of the client equipment is consistent or not.
In one or more optional embodiments, before obtaining the pixel values of the material, there may be multiple 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. In the materials with multiple sizes, when the materials with multiple sizes are identified and whether the material contents are consistent or not is determined, two materials can be selected at will, namely a first material and a second material. The selection of the material can be flexibly determined according to specific requirements, for example, the material identification can be applied to different scenes, for example, the material to be identified can be a material used for judging whether the two materials are consistent in content before the material is edited; for another example, the material to be recognized may be applied to the material used in the IOS development session, for example, the material used in the development may be applied to different device screens, resolutions, and the like, respectively.
In one or more optional embodiments, pixel values of a material are obtained to obtain a pixel matrix of the material, where one material corresponds to one pixel matrix, the pixel matrix includes pixel values of pixel points on the material, and the size of each pixel matrix may be determined by the pixel size of the material. For example, the material a has 10 × 10 pixels, that is, the pixel size is 10 × 10 pixels, and by obtaining the pixel value of the material a, a pixel matrix formed by the pixel value corresponding to each pixel point in the 10 × 10 pixels can be obtained. It should be noted that the size of the first material is different from the size of the second material, that is, the number of the pixels included in the first material is different from the number of the pixels included in the second material.
In one or more optional embodiments, in the case that there are a plurality of established correspondence relationships, the method further comprises: determining a minimum total distance from the total distances corresponding to the plurality of corresponding relations; the minimum total distance is compared to a predetermined threshold. The minimum total distance is selected to compare with the predetermined threshold because the minimum total distance is the distance at which the content identification accuracy of the obtained material is the highest, and the minimum distance is obtained according to the best correspondence between the two materials (i.e., the best way of correspondence). By comparing the minimum total distance with a preset threshold value, whether the two materials used for comparison are materials with consistent content or not can be determined, and the accuracy of material content identification is greatly improved.
In one or more optional embodiments, when the corresponding relationship between the pixel point in the first pixel matrix and the pixel point in the second pixel matrix is established, various manners may be adopted, for example, the following manners may be adopted: fig. 3 is a flowchart illustrating a second material processing method according to an exemplary embodiment, and as shown in fig. 3, the method includes the steps included in fig. 2, wherein the step of establishing correspondence between pixel points in the first pixel matrix and pixel points in the second pixel matrix in step S22 includes the following steps.
In step S31, the pixel points at the four vertices in the first pixel matrix are respectively corresponding to the pixel points at the four vertices in the second pixel matrix;
in step S32, 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, respectively;
in step S33, the first internal pixel points in the first pixel matrix are respectively corresponding to the second internal pixel points in the second pixel matrix, where the first internal pixel points are the pixel points in the first pixel matrix except the pixel points on the four sides, and the second internal pixel points are the pixel points in the second pixel matrix except the pixel points on the four sides.
By establishing respective corresponding relations of the pixel points at different positions in the pixel matrix, the corresponding relation which is accurate to a great extent can be ensured, so that the corresponding relation can be processed subsequently, the material content can be identified, and the error of material content identification can be reduced. The corresponding relation is established by adopting different methods for the pixel points at different positions, so that unnecessary calculation can be avoided, the occupancy rate of calculation resources is reduced, the corresponding relation between two pixel matrixes can be more obviously expressed, and the material content identification is favorably determined. And establishing a corresponding relation between the two pixel matrixes, wherein each point in the two pixel matrixes needs to have a corresponding relation, and the mapping relation between the pixel point and the pixel point cannot be crossed. By adopting the corresponding mode of the points, the lines and the surfaces, the requirements can be quickly and accurately realized.
In one or more optional embodiments, the pixel points at four vertexes in the first pixel matrix respectively correspond to the pixel points at four vertexes in the second pixel matrix, in the material content identification, the material is only subjected to scaling processing, the pixel points at four vertexes are used as termination points or are kept unchanged, the pixel points at four vertexes respectively correspond to each other, the basic accuracy of the corresponding relation between the materials can be ensured, the distance between the materials can be calculated, and therefore the accuracy of the material content identification is improved.
In one or more optional embodiments, the pixel points on the four sides of the first pixel matrix are respectively corresponding to the pixel points on the four sides of the second pixel matrix, and various manners may be adopted, for example: aiming at a first side of the four sides, constructing a distance matrix by taking pixel points of the first side in a first pixel matrix as rows and taking pixel points of the first side in a second pixel matrix as columns, wherein the value of a matrix element in the distance matrix is a pixel difference value between pixel values of pixel points on a corresponding row and a corresponding column, and the first side is any one of the four sides; and finding a continuous shortest path from the starting point to the end point in the distance matrix by taking one vertex corresponding to the first edge as the starting point and the other vertex as the end point, wherein the 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. The starting point of the first pixel matrix as a row and the starting point of the second pixel matrix as a column are two vertexes corresponding to the first edge of the first pixel matrix and the first edge of the second pixel matrix. The corresponding relation of the pixel points of the edge part is determined, the range of the internal pixel points is limited, the corresponding relation between the pixel point of one edge in the first pixel matrix and the pixel point of the corresponding edge in the second pixel matrix is obtained by adopting the distance matrix mode, 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 corresponding pixel points on four sides in the first pixel matrix to pixel points on four sides in the second pixel matrix respectively can be understood as adopting 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 an early and more classical algorithm in voice recognition, and can recognize whether data with different lengths are matched or not. Based on the idea of dynamic programming, the problem of template matching with different pronunciation lengths is solved. With the above idea of identifying data matching, specifically, the row number or 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 a row, and the pixel value on the corresponding side of the second pixel matrix is taken as a column, to form a distance matrix (where the value of an element in the distance matrix is the pixel difference between the corresponding row and the corresponding column), and the corresponding relationship of the side in the two pixel matrices may be determined according to the shortest continuous path from the starting vertex to the ending vertex of the side 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 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 material content identification accuracy is improved.
In one or more optional embodiments, the first internal pixel points in the first pixel matrix respectively correspond to the second internal pixel points in the second pixel matrix, and may be implemented in various manners, for example, in the following manners: fig. 4 is a flowchart illustrating a third material processing method according to an exemplary embodiment, and as shown in fig. 4, the method includes the steps included in fig. 3, wherein, in step S33, the step of using a local optimal 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 includes the following steps.
In step S41, a local optimal algorithm is used to respectively correspond the first internal pixel points in the first pixel matrix to the second internal pixel points 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 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 local optimization algorithm is adopted for the purpose that the local optimization algorithm can save a large amount of computing resources compared with the global optimization algorithm, and the local optimization algorithm can reflect global characteristics to a certain extent, so that the corresponding relation determined by the local optimization algorithm can also realize accurate identification of materials to a great extent, and a large amount of computing resources can be saved.
In one or more optional embodiments, when the local optimal algorithm is adopted and the first internal pixel points in the first pixel matrix respectively correspond to the second internal pixel points in the second pixel matrix, in order to make the correspondence between the pixel points more accurate, the local optimal algorithm may be adopted based on the dynamic warping algorithm to select the optimal correspondence among a plurality of different correspondences. For example, the following can be used: fig. 5 is a flowchart illustrating a fourth material processing method 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, assume that the pixel B among the first internal pixels isi,jCorresponding to the pixel point S in the second internal pixel pointm,nWherein, if B isi-1,jExist and B isi-1,jCorresponds to Sa,bIf m is greater than or equal to a and n is greater than or equal to b; if B is presenti,j-1Exist and B isi,j-1Corresponds to Sc,dIf m is greater than or equal to c and n is greater than or equal to d;
in step S52, a pixel B of the first internal pixels is obtainedi,jAnd pixel point S in the second internal pixel pointa,bA first distance between the first and second internal pixel points, and a pixel point B in the first internal pixel pointi,jAnd pixel point S in the second internal pixel pointc,dA second distance between the first and second internal pixel points, and obtaining a pixel point B in the first internal pixel pointi,jAnd pixel point S in the second internal pixel pointa+1,bOr pixel point Sc,d+1A third distance therebetween;
in step S53, the pixel point in the second internal pixel point corresponding to the minimum distance among the first distance, the second distance, and the third distance is selected as the pixel point B in the first internal pixel pointi,jAnd (4) corresponding pixel points.
With the above-described process, it is possible to,pixel B in the first pixel matrix corresponding to the larger materiali,jMapping to pixel point S in second pixel matrix corresponding to smaller materialm,nThen, the first pixel matrix is passed through one pixel B in the first internal pixelsi,jAnd a pixel point S in a second internal pixel point in a second pixel matrixm,nAnd comparing a plurality of distances among a plurality of nearby pixel points, and selecting the pixel point in the second internal pixel point with the minimum distance, so that the corresponding relation between the first internal pixel point and the second internal pixel point is determined, the corresponding relation which can reflect the similarity degree of the material to the maximum extent is selected and selected locally and optimally, and the efficiency of identifying whether the material content is consistent or not is ensured on the premise of ensuring the accuracy of identifying the material content.
In one or more optional embodiments, the correspondence between the pixel points in the first pixel matrix and the pixel points in the second pixel matrix may be established by equally corresponding rows of a larger one of the first pixel matrix and the second pixel matrix to rows of a smaller one of the first pixel matrix and the second pixel matrix, and equally corresponding columns of the larger one of the first pixel matrix and the second pixel matrix to columns of the smaller one of the first pixel matrix and the second pixel matrix. The rows correspond to the rows, and the columns correspond to the columns, so that the corresponding relation of each point in the pixel matrix is ensured to be clear, errors in material content identification are reduced, and more accurate corresponding relation is obtained. Although the method is used for roughly corresponding the two materials, the speed of obtaining the corresponding relation is high, the operation is simple, and therefore 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 contents, the corresponding relationship is determined according to the minimum total distance, so that the problem of identifying whether the two materials are consistent or not can be solved to a certain extent. In order to further ensure the accuracy of the identification, the relation between the candidate distances except the minimum distance and the predetermined threshold value can be continuously judged, and if the candidate distances smaller than the predetermined threshold value also exist in the plurality of candidate distances, the two materials can be determined to be materials with consistent contents. 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 first distance, the second distance and the third distance except for the minimum distance; and determining the first material and the second material as materials with consistent contents when the candidate total distance is smaller than or equal to the preset threshold value. Through the 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 guarantee is provided.
In one or more optional embodiments, the first material and the second material are determined to be content-consistent material if the total distance is less than or equal to a predetermined threshold. And in the case that the total distance is not less than the predetermined threshold value, determining that the first material and the second material are materials with inconsistent contents. Alternatively, more strictly, when there is a kind of pixel value where the resultant total distance is larger than a predetermined threshold, it cannot be determined that the first material and the second material are materials whose contents are identical, for example, there may be a problem with the materials. The problems of the material may include missing pixel points, content distortion, and the like.
In one or more alternative embodiments, the different sizes differ and the predetermined threshold differs when identifying different sized material content. Different pixel sizes, different numbers of pixel points and different arrangement of the pixel points result in different corresponding relations between the pixel points, and the total distance obtained according to the corresponding relations is different. Therefore, when the content of the material with different sizes is identified, 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 predetermined threshold values (which may be obtained empirically, or obtained by counting differences of pixel matrixes when multiple groups of materials are materials with consistent contents, or materials with inconsistent contents) may be set, and after the above factors are fully considered, the accuracy of identifying the contents when the contents of the materials with different sizes are identified can be ensured.
Fig. 6 is a flowchart illustrating a fifth material processing method according to an exemplary embodiment, where the method is applied to a server, as shown in fig. 6, and further includes the following steps.
In step S61, displaying the first material and the second material on the display interface;
in step S62, receiving an identification instruction, 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, wherein 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 materials with consistent content, the recognition result is determined according to a total distance and a predetermined threshold, where, when the total distance is less than or equal to the predetermined threshold, the first material and the second material are determined to be materials with consistent content, 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 corresponding points according to the distance between corresponding points.
By adopting the processing, the pixel information of the material is acquired for the material displayed on the display interface by receiving the identification instruction, the material is processed by an algorithm, the identification result is determined and displayed on the display interface according to the total distance and the preset threshold value, and the identification result represents whether the material content is consistent or not. Through the processing, the problem existing in the prior art that whether the material contents of different sizes are consistent or not is identified can be solved, the purposes of reducing the occupancy rate of computing resources and efficiently acquiring the material identification result can be achieved, the effect of obtaining the identification result after the material identification on a display interface after the material to be identified is input in a man-machine interaction mode is further 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, an optional implementation is provided by taking the material as an image as an example, and in the image processing method provided in the optional implementation, a dynamic warping algorithm idea similar to DTW is adopted, and the content of the image is identified by comparing the minimum total distance with a predetermined threshold value. The image processing method of the optional embodiment can identify the image content more efficiently and accurately by receiving the image to identify the content of the image and judge the consistency of the image.
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 according to an exemplary embodiment. Fig. 9 is a diagram of a DTW algorithm in accordance with 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. Wherein, when establishing the corresponding relationship, red pixels in two pictures are taken as an example.
S1, establishing a pixel matrix;
and acquiring 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 there are three sizes and pictures with the same content in the picture material folder sent by the server, the pixel sizes of the three pictures are respectively 10 × 10 pixels, 30 × 30 pixels and 100 × 100 pixels, and the pixel information of each picture is read through the PIL, so that a total of nine pixel matrixes can be obtained. Three 10 × 10 pixel matrices, three 30 × 30 pixel matrices, and three 100 × 100 pixel matrices respectively correspond to R, G, B pixels, where the R pixel corresponds to the 10 × 10 pixel matrix, as shown in fig. 7. I.e. pictures of different sizes, a similar pixel matrix can be obtained by processing of the third party picture processing library.
S2, establishing a corresponding relation;
1. mapping each point in the large-size material matrix to the small-size material matrix;
among them, the mapping process needs to obey three conditions:
1) the pixel points of the four vertexes of the matrix should correspond one to one, and because the image is only subjected to scaling processing, the pixel points of the four vertexes as termination points are still kept 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 a point B in the matrix Bi,jMapping to a certain point S in the matrix Sm,n.. If B is presenti-1,jExist and B isi-1,jMapping to Sa,bThen m is more than or equal to a and n is more than or equal to b; if B is presenti,j-1Exist and B isi,j-1Mapping to Sc,dThen m.gtoreq.c and n.gtoreq.d need to be satisfied.
2. Dividing the pixel matrixes into three classes, and determining the corresponding relation of each class of pixel matrixes;
as shown in fig. 8. First, the corresponding relationship of the full black part, i.e. the corresponding relationship of the pixel points on the four vertices, is determined. And then determining the corresponding relation of the full white part, namely the corresponding relation of pixel points on the four edges. Wherein, the white part 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. The oblique line parts can respectively determine the corresponding relation through a dynamic warping algorithm. For the inner diagonal line part, a certain point Bi,jThere are only three corresponding ways: 1) corresponds to Bi-1,jCorresponding point Sa,b(ii) a 2) Corresponds to Bi,j-1Corresponding point Sc,d(ii) a 3) Corresponding point Sa+1,b(Sc,d+1)。
3. The corresponding relation which enables the total distance to be minimum can be found by dynamic planning and a total distance calculation formula in the mapping process.
The total distance calculation formula is as follows.
Dtotal=Dnow+min{D1,D2,D3};
Wherein D istotal: the total distance finally obtained; dnow: the current accumulated distance; d1: corresponding to the total distance resulting from selection 1.
Wherein, the operation of D is that the numerical value of the corresponding pixel points is subtracted and squared to obtain the distance between the corresponding pixel points, as mentioned above D1,D2,D3. The sum of all accumulated distances yields the total distance of two pictures, as described above Dnow. According to the above formula, the sum of the minimum total distance and the accumulated distance is selected to obtain the total distance between the two pictures, as shown in Dtotal. To obtain the correct correspondence.
And S3, circularly comparing.
And setting a preset threshold, and screening out the pictures with overlarge differences by comparing the total distance with the preset threshold, wherein the total distance obtained by each pixel value of the pictures is compared with the preset threshold, namely, the multiple rounds of operations are carried out. The pictures with consistent content are zoomed, the total distance generated by the zooming is maintained at a smaller value, and when the picture content is different or the pixel point is lost, a larger total distance can be obtained. When a certain total distance exceeds a preset threshold value, the group of pictures is judged to have problems. The larger the total distance is, the larger the difference between the contents of the two pictures is.
In the process of determining the white-all part corresponding relationship, the corresponding relationship is determined in a manner similar to a DTW algorithm, as shown in fig. 9, based on the idea of the DTW algorithm, the DTW algorithm compares two segments of voice signals with different time lengths through time warping. The principle is that by mapping each point of a shorter speech signal to a longer speech signal, as shown in graph a in fig. 9, point a corresponds to point b' if compared by using the euclidean distance, which is the linear distance between two points in space, and the true feature point should be point b. As shown in the B diagram of fig. 9, the DWT algorithm finds a suitable warping method by dynamic programming, and corresponds feature points rather than simply in time.
In the process of determining the corresponding relation of the oblique line part, based on the idea of a DTW dynamic time warping algorithm, because the DTW algorithm aims at time domain signals, namely 1 x n matrix, and the picture pixel comparison is n x n matrix comparison, improvements are made to 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, and the most appropriate corresponding relation can be selected by comparison, so that the similarity degree between two pictures can be obtained, and the picture content identification can be efficiently and accurately realized.
FIG. 10 is a general flow diagram, according to an exemplary embodiment, as shown in FIG. 10, including the steps of:
(1) acquiring a pixel matrix of a picture;
(2) selecting a pixel matrix of the same pixel of the two pictures;
(3) obtaining a two-pixel matrix "total distance";
(4) the total distance is compared to a predetermined threshold (i.e., a threshold in the graph);
if the total distance is smaller than or equal to the preset threshold value, performing the operation in the step (2), repeating multiple rounds in the same way, and if the multiple rounds of operation results are the same, judging that the two pictures are pictures with the same content; and if the total distance is larger than a preset threshold value, judging that the material has a problem.
Through the above alternative embodiment, the following effects can be achieved:
the obtained total distance of the two pictures about a certain pixel value is subjected to similar multi-round operation, whether the picture contents are consistent or not is determined by comparing the total distance with a preset threshold value, and compared with the traditional algorithm or manual classification for identifying the material, the material content identification can be realized by comparing the total distance with the preset threshold value, so that the high efficiency of the material content identification is realized, and the accuracy of the material content identification is effectively improved. The method not only solves the problems of complex material content identification and calculation, overlarge consumed resources and low accuracy, but also achieves the effects of saving a large amount of calculation resources and efficiently and accurately identifying whether the picture contents are consistent or not.
It is noted that while for simplicity of explanation, the foregoing method embodiments have been described as a series of acts or combination of acts, it will be appreciated by those skilled in the art that the present disclosure is not limited by the order of acts, as some steps may, in accordance with the present disclosure, occur in other orders and concurrently. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required for the disclosure.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present disclosure may be embodied in the form of a software product, which is stored in a computer-readable storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (which may be a mobile phone, a computer, a server, or a network device) to execute the method of the embodiments of the present disclosure.
Example 2
According to an embodiment of the present disclosure, there is also provided an apparatus for implementing the first material processing method, and fig. 11 is an apparatus block diagram of the first material processing apparatus according to an exemplary embodiment. Referring to fig. 11, the apparatus includes a first obtaining module 111, a establishing module 112 and a first determining module 113, which will be described below.
A first obtaining module 111, configured to obtain a pixel value of a first material to obtain a first pixel matrix of the first material, and obtain a pixel value of a 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; an establishing module 112, connected to the first obtaining module 111, configured to establish a correspondence between a pixel point in the first pixel matrix and a pixel point in the second pixel matrix, obtain a distance between corresponding points, and obtain a total distance according to the distance between corresponding points; and a first determining module 113, connected to the establishing module 112, 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.
It should be noted that 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 are consistent with examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure in embodiment 1. It should be noted that the above modules may be operated in the computer terminal 10 provided in embodiment 1 as a part of the apparatus.
In one or more optional embodiments, the first material processing device further comprises: the second determining module is configured to determine a minimum total distance from total distances corresponding to a plurality of corresponding relations when the plurality of corresponding relations are established; a comparing module, connected to the second determining module, configured to compare the minimum total distance with the predetermined threshold.
In one or more optional embodiments, the establishing module includes: the first establishing unit is set to respectively correspond the pixel points of four vertexes in the first pixel matrix to the pixel points of 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; and 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 in the first pixel matrix except for pixel points on four sides, and the second internal pixel points are pixel points in the second pixel matrix except for pixel points on four sides.
In one or more optional embodiments, the second establishing unit includes: the method comprises a constructing subunit and a first processing subunit, wherein the constructing subunit is configured to construct a distance matrix by taking a pixel point of a 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 aiming at the first side in the four sides, wherein a value of a matrix element in the distance matrix is a pixel difference value between pixel values of pixel points on the corresponding row and the corresponding column, and the first side is any one of the four sides; the first processing subunit, connected to the constructing subunit, is configured to find a continuous shortest path from a starting point to an end point in the distance matrix with one vertex corresponding to the first edge as a starting point and the other vertex as an 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.
In one or more optional embodiments, the third establishing unit includes a second processing subunit 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 using a local optimal algorithm.
In one or more optional embodiments, the second processing subunit comprises: a processing subunit, an obtaining subunit and a selecting subunit, wherein the processing subunit is configured to assume a pixel point B of the first internal pixel pointi,jCorresponding to the pixel point S in the second internal pixel pointm,nWherein, if B isi-1,jExist and B isi-1,jCorresponds to Sa,bIf m is greater than or equal to a and n is greater than or equal to b; if B is presenti,j-1Exist and B isi,j-1Corresponds to Sc,dIf 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, configured to acquire a pixel point B of the first internal pixel pointi,jAnd a pixel point S in the second internal pixel pointa,bFirst of (1) inDistance, obtaining pixel B in the first internal pixeli,jAnd a pixel point S in the second internal pixel pointc,dAnd obtaining a pixel point B of the first internal pixel pointi,jAnd a pixel point S in the second internal pixel pointa+1,bOr pixel point Sc,d+1A third distance therebetween; a selecting sub-unit connected to the obtaining sub-unit and configured to select the first distance, wherein a pixel point in a second internal pixel point corresponding to a minimum distance between the second distance and the third distance is a pixel point B in the first internal pixel pointi,jAnd (4) corresponding pixel points.
In one or more optional embodiments, the first determining module includes: the image processing device comprises 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, the candidate distance is at least one of the first distance, the second distance and the third distance except for the minimum distance; and the determining unit is connected to the acquiring unit and is used for determining the first material and the second material as materials with consistent contents when the candidate total distance is smaller than or equal to the preset threshold value.
In one or more alternative embodiments, the above-mentioned creating module is further configured to equally correspond rows of a larger one of the first and second pixel matrices to rows of a smaller matrix, and equally correspond columns of the larger one of the first and second pixel matrices to columns of the smaller matrix.
In one or more optional embodiments, 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.
According to an embodiment of the present disclosure, there is also provided an apparatus for implementing the material processing method five described above, and fig. 12 is an apparatus block diagram of a second material processing apparatus 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, which 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, 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, in response to the identification instruction, a pixel value of the first material to obtain a first pixel matrix of the first material, and 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 materials with consistent content, 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 materials with consistent content when the total distance is less than or equal to the predetermined threshold, and the total distance is obtained by establishing a corresponding relationship between a pixel point in the first pixel matrix and a pixel point in the second pixel matrix, and obtaining a distance between corresponding points according to a distance between corresponding points.
It should be noted that 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 modules are consistent with the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure in embodiment 1. It should be noted that the above modules may be operated in the computer terminal 10 provided in embodiment 1 as a part of the apparatus.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Example 3
The embodiment of the disclosure can provide an electronic device, which can be a terminal or a server. For example, when the electronic device is a terminal, the terminal may be any one of computer terminal devices in a computer terminal group. Optionally, in this embodiment, the terminal may also be a terminal device such as a mobile terminal.
Optionally, in this embodiment, the terminal may be located in at least one network device of a plurality of network devices of a computer network.
Alternatively, fig. 10 is a block diagram illustrating a structure of a terminal according to an exemplary embodiment. As shown in fig. 10, the terminal may include: one or more processors (only one shown) 101, a memory 102 for storing processor-executable instructions; wherein the processor is configured to execute the 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 method and apparatus in the embodiments of the disclosure, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, implementing the material processing method. 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 located remotely from the processor, and these remote memories may be connected to the computer terminal through 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 can call the information and application program stored in the memory through the transmission device to execute the following steps: the method comprises the steps of obtaining a pixel value of a first material to obtain a first pixel matrix of the first material, obtaining a pixel value of a second material to obtain 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 pixel points in the first pixel matrix and pixel points in the second pixel matrix to obtain a distance between corresponding points, and obtaining a total distance according to the distance between the corresponding points; and determining the first material and the second material as materials with consistent contents when the total distance is smaller than or equal to a preset threshold value.
Optionally, the processor may further execute the program code of the following steps: in case that the established correspondence is multiple, the method further comprises: determining a minimum total distance from the total distances corresponding to the plurality of corresponding relations; the minimum total distance is compared to a predetermined threshold.
Optionally, the processor may further execute the program code of the following steps: establishing a corresponding relationship between pixel points in the first pixel matrix and pixel points in the second pixel matrix, including: respectively corresponding pixel points of four vertexes in the first pixel matrix to pixel points of four vertexes in the second pixel matrix; respectively corresponding pixel points on four edges in the first pixel matrix to pixel points on four edges in 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 pixel points on four edges in the first pixel matrix, and the second internal pixel points are pixel points except pixel points on four edges in the second pixel matrix.
Optionally, the processor may further execute the program code of the following steps: respectively corresponding pixel points on four edges in the first pixel matrix to pixel points on four edges in the second pixel matrix, including: aiming at a first side of the four sides, constructing a distance matrix by taking pixel points of the first side in a first pixel matrix as rows and taking pixel points of the first side in a second pixel matrix as columns, wherein the value of a matrix element in the distance matrix is a pixel difference value between pixel values of pixel points on a corresponding row and a corresponding column, and the first side is any one of the four sides; and finding a continuous shortest path from the starting point to the end point in the distance matrix by taking one vertex corresponding to the first edge as the starting point and the other vertex as the end point, wherein the 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 processor may further execute the program code of the following steps: adopting local optimal 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, comprising: suppose pixel B of the first internal pixelsi,jCorresponding to the pixel point S in the second internal pixel pointm,nWherein, if B isi-1,jExist and B isi-1,jCorresponds to Sa,bIf m is greater than or equal to a and n is greater than or equal to b; if B is presenti,j-1Exist and B isi,j-1Corresponds to Sc,dIf m is greater than or equal to c and n is greater than or equal to d; obtaining a pixel point B in a first internal pixel pointi,jAnd pixel point S in the second internal pixel pointa,bA first distance between the first and second internal pixel points, and a pixel point B in the first internal pixel pointi,jAnd pixel point S in the second internal pixel pointc,dA second distance between the first and second internal pixel points, and obtaining a pixel point B in the first internal pixel pointi,jAnd pixel point S in the second internal pixel pointa+1,bOr pixel point Sc,d+1A third distance therebetween; selecting the pixel point in the second internal pixel point corresponding to the minimum distance among the first distance, the second distance and the third distance as the pixel point B in the first internal pixel pointi,jAnd (4) corresponding pixel points.
Optionally, the processor may further execute the program code of the following steps: determining that the first material and the second material are consistent in content, including: acquiring 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 for the minimum distance in the first distance, the second distance and the third distance; and determining the first material and the second material as materials with consistent contents when the candidate total distance is smaller than or equal to a preset threshold value.
Optionally, the processor may further execute the program code of the following steps: establishing a corresponding relationship between pixel points in the first pixel matrix and pixel points in the second pixel matrix, including: the rows of the larger one of the first and second pixel matrices are equally corresponding to the rows of the smaller matrix, and the columns of the larger one of the first and second pixel matrices are equally corresponding to the columns of the smaller matrix.
Optionally, the processor may further execute the program code of the following steps: 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.
The processor can call the information and application program stored in the memory through the transmission device to execute the following steps: displaying a first material and a 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 contents; responding to the identification instruction, acquiring a pixel value of a first material to obtain a first pixel matrix of the first material, acquiring a pixel value of a second material to obtain 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 a display interface, wherein the recognition result is used for identifying whether the first material and the second material are materials with consistent contents or not, the recognition result is determined according to a total distance and a preset threshold, the first material and the second material are determined to be materials with consistent contents under the condition that the total distance is smaller than or equal to the preset threshold, the total distance obtains the distance between corresponding points by establishing a corresponding relation between pixel points in the first pixel matrix and pixel points in the second pixel matrix, and the distance is obtained according to the distance between the corresponding points.
As described above, the electronic device may also be a server, an embodiment of the present disclosure provides 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 shown) 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 implementing communication 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 any of the material processing methods described above.
The memory may be used to store software programs and modules, such as program instructions/modules corresponding to the material processing method and apparatus in the embodiments of the disclosure, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, implementing the material processing method. 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 located remotely from the processor, and these remote memories may be connected to the computer terminal through 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 can call the information and the application program stored in the memory through the transmission device to execute the following steps: the method comprises the steps of obtaining a pixel value of a first material to obtain a first pixel matrix of the first material, obtaining a pixel value of a second material to obtain 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 pixel points in the first pixel matrix and pixel points in the second pixel matrix to obtain a distance between corresponding points, and obtaining a total distance according to the distance between the corresponding points; and determining the first material and the second material as materials with consistent contents when the total distance is smaller than or equal to a preset threshold value.
Optionally, the processing component may further execute program codes of the following steps: in case that the established correspondence is multiple, the method further comprises: determining a minimum total distance from the total distances corresponding to the plurality of corresponding relations; the minimum total distance is compared to a predetermined threshold.
Optionally, the processing component may further execute program codes of the following steps: establishing a corresponding relationship between pixel points in the first pixel matrix and pixel points in the second pixel matrix, including: respectively corresponding pixel points of four vertexes in the first pixel matrix to pixel points of four vertexes in the second pixel matrix; respectively corresponding pixel points on four edges in the first pixel matrix to pixel points on four edges in 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 pixel points on four edges in the first pixel matrix, and the second internal pixel points are pixel points except pixel points on four edges in the second pixel matrix.
Optionally, the processing component may further execute program codes of the following steps: respectively corresponding pixel points on four edges in the first pixel matrix to pixel points on four edges in the second pixel matrix, including: aiming at a first side of the four sides, constructing a distance matrix by taking pixel points of the first side in a first pixel matrix as rows and taking pixel points of the first side in a second pixel matrix as columns, wherein the value of a matrix element in the distance matrix is a pixel difference value between pixel values of pixel points on a corresponding row and a corresponding column, and the first side is any one of the four sides; and finding a continuous shortest path from the starting point to the end point in the distance matrix by taking one vertex corresponding to the first edge as the starting point and the other vertex as the end point, wherein the 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 codes of the following steps: respectively corresponding first internal pixel points in the first pixel matrix to second internal pixel points in the second pixel matrix, including: and respectively corresponding 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 optimal algorithm.
Optionally, the processing component may further execute program codes of the following steps: using a local optimization algorithm, willFirst interior pixel in the first pixel matrix corresponds the second interior pixel in the second pixel matrix respectively, includes: suppose pixel B of the first internal pixelsi,jCorresponding to the pixel point S in the second internal pixel pointm,nWherein, if B isi-1,jExist and B isi-1,jCorresponds to Sa,bIf m is greater than or equal to a and n is greater than or equal to b; if B is presenti,j-1Exist and B isi,j-1Corresponds to Sc,dIf m is greater than or equal to c and n is greater than or equal to d; obtaining a pixel point B in a first internal pixel pointi,jAnd pixel point S in the second internal pixel pointa,bA first distance between the first and second internal pixel points, and a pixel point B in the first internal pixel pointi,jAnd pixel point S in the second internal pixel pointc,dA second distance between the first and second internal pixel points, and obtaining a pixel point B in the first internal pixel pointi,jAnd pixel point S in the second internal pixel pointa+1,bOr pixel point Sc,d+1A third distance therebetween; selecting the pixel point in the second internal pixel point corresponding to the minimum distance among the first distance, the second distance and the third distance as the pixel point B in the first internal pixel pointi,jAnd (4) corresponding pixel points.
Optionally, the processing component may further execute program codes of the following steps: determining that the first material and the second material are consistent in content, including: acquiring 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 for the minimum distance in the first distance, the second distance and the third distance; and determining the first material and the second material as materials with consistent contents when the candidate total distance is smaller than or equal to a preset threshold value.
Optionally, the processing component may further execute program codes of the following steps: establishing a corresponding relationship between pixel points in the first pixel matrix and pixel points in the second pixel matrix, including: the rows of the larger one of the first and second pixel matrices are equally corresponding to the rows of the smaller matrix, and the columns of the larger one of the first and second pixel matrices are equally corresponding to the columns of the smaller matrix.
Optionally, the processing component may further execute program codes of the following steps: 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.
The processing component can call the information and the application program stored in the memory through the transmission device to execute the following steps: displaying a first material and a 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 contents; responding to the identification instruction, acquiring a pixel value of a first material to obtain a first pixel matrix of the first material, acquiring a pixel value of a second material to obtain 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 a display interface, wherein the recognition result is used for identifying whether the first material and the second material are materials with consistent contents or not, the recognition result is determined according to a total distance and a preset threshold, the first material and the second material are determined to be materials with consistent contents under the condition that the total distance is smaller than or equal to the preset threshold, the total distance obtains the distance between corresponding points by establishing a corresponding relation between pixel points in the first pixel matrix and pixel points in the second pixel matrix, and the distance is obtained according to the distance between the corresponding points.
It can be understood by those skilled in the art that the structures shown in fig. 10 and fig. 11 are only schematic, for example, the terminal may also be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palmtop computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 10 and 11 do not limit the structure of the electronic device. For example, it may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 10, FIG. 11, or have a different configuration than shown in FIG. 10, FIG. 11.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the computer-readable storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, 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, the non-transitory computer readable storage medium may be 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 this embodiment, the computer-readable storage medium may be used to store the program codes executed by the material processing method provided in embodiment 1.
Optionally, in this embodiment, the computer-readable storage medium may be located in any one of a group of computer terminals in a computer network, or in any one of a group of mobile terminals.
Optionally, in this embodiment, the computer readable storage medium is configured to store program code for performing the following steps: the method comprises the steps of obtaining a pixel value of a first material to obtain a first pixel matrix of the first material, obtaining a pixel value of a second material to obtain 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 pixel points in the first pixel matrix and pixel points in the second pixel matrix to obtain a distance between corresponding points, and obtaining a total distance according to the distance between the corresponding points; and determining the first material and the second material as materials with consistent contents when the total distance is smaller than or equal to a preset threshold value.
Optionally, in this embodiment, the computer readable storage medium is further configured to store program code for performing the following steps: in case that the established correspondence is multiple, the method further comprises: determining a minimum total distance from the total distances corresponding to the plurality of corresponding relations; the minimum total distance is compared to a predetermined threshold.
Optionally, in this embodiment, the computer readable storage medium is further configured to store program code for performing the following steps: establishing a corresponding relationship between pixel points in the first pixel matrix and pixel points in the second pixel matrix, including: respectively corresponding pixel points of four vertexes in the first pixel matrix to pixel points of four vertexes in the second pixel matrix; respectively corresponding pixel points on four edges in the first pixel matrix to pixel points on four edges in 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 pixel points on four edges in the first pixel matrix, and the second internal pixel points are pixel points except pixel points on four edges in the second pixel matrix.
Optionally, in this embodiment, the computer readable storage medium is further configured to store program code for performing the following steps: respectively corresponding pixel points on four edges in the first pixel matrix to pixel points on four edges in the second pixel matrix, including: aiming at a first side of the four sides, constructing a distance matrix by taking pixel points of the first side in a first pixel matrix as rows and taking pixel points of the first side in a second pixel matrix as columns, wherein the value of a matrix element in the distance matrix is a pixel difference value between pixel values of pixel points on a corresponding row and a corresponding column, and the first side is any one of the four sides; and finding a continuous shortest path from the starting point to the end point in the distance matrix by taking one vertex corresponding to the first edge as the starting point and the other vertex as the end point, wherein the 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 this embodiment, the computer readable storage medium is further configured to store program code for performing the following steps: respectively corresponding first internal pixel points in the first pixel matrix to second internal pixel points in the second pixel matrix, including: and respectively corresponding 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 optimal algorithm.
Optionally, in this embodiment, the computer readable storage medium is further configured to store program code for performing the following steps: adopting local optimal 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, comprising: suppose pixel B of the first internal pixelsi,jCorresponding to the pixel point S in the second internal pixel pointm,nWherein, if B isi-1,jExist and B isi-1,jCorresponds to Sa,bIf m is greater than or equal to a and n is greater than or equal to b; if B is presenti,j-1Exist and B isi,j-1Corresponds to Sc,dIf m is greater than or equal to c and n is greater than or equal to d; obtaining a pixel point B in a first internal pixel pointi,jAnd pixel point S in the second internal pixel pointa,bA first distance between the first and second internal pixel points, and a pixel point B in the first internal pixel pointi,jAnd pixel point S in the second internal pixel pointc,dA second distance between the first and second internal pixel points, and obtaining a pixel point B in the first internal pixel pointi,jAnd pixel point S in the second internal pixel pointa+1,bOr pixel point Sc,d+1A third distance therebetween; selecting the pixel point in the second internal pixel point corresponding to the minimum distance among the first distance, the second distance and the third distance as the pixel point B in the first internal pixel pointi,jAnd (4) corresponding pixel points.
Optionally, in this embodiment, the computer readable storage medium is further configured to store program code for performing the following steps: determining that the first material and the second material are consistent in content, including: acquiring 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 for the minimum distance in the first distance, the second distance and the third distance; and determining the first material and the second material as materials with consistent contents when the candidate total distance is smaller than or equal to a preset threshold value.
Optionally, in this embodiment, the computer readable storage medium is further configured to store program code for performing the following steps: establishing a corresponding relationship between pixel points in the first pixel matrix and pixel points in the second pixel matrix, including: the rows of the larger one of the first and second pixel matrices are equally corresponding to the rows of the smaller matrix, and the columns of the larger one of the first and second pixel matrices are equally corresponding to the columns of the smaller matrix.
Optionally, in this embodiment, the computer readable storage medium is further configured to store program code for performing the following steps: 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.
Optionally, in this embodiment, the computer readable storage medium is further configured to store program code for performing the following steps: displaying a first material and a 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 contents; responding to the identification instruction, acquiring a pixel value of a first material to obtain a first pixel matrix of the first material, acquiring a pixel value of a second material to obtain 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 a display interface, wherein the recognition result is used for identifying whether the first material and the second material are materials with consistent contents or not, the recognition result is determined according to a total distance and a preset threshold, the first material and the second material are determined to be materials with consistent contents under the condition that the total distance is smaller than or equal to the preset threshold, the total distance obtains the distance between corresponding points by establishing a corresponding relation between pixel points in the first pixel matrix and pixel points in the second pixel matrix, and the distance is obtained according to the distance between the corresponding points.
In an exemplary embodiment, there is also provided a computer program product, in which a computer program is enabled to perform the material processing method of any one of the above when the computer program is executed by a processor of a terminal.
The above-mentioned serial numbers of the embodiments of the present disclosure are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present disclosure, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, a division of a unit is merely a division of a logic function, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present disclosure may be embodied in the form of a software product, which is stored in a computer-readable storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present disclosure. And the aforementioned computer-readable storage media comprise: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and 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 variations, 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 will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims (10)
1. A method for processing material, comprising:
the method comprises the steps of obtaining a pixel value of a first material to obtain a first pixel matrix of the first material, obtaining a pixel value of a second material to obtain 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 a distance between corresponding points, and obtaining a total distance according to the distance between the corresponding points;
and determining that the first material and the second material are consistent in content when the total distance is smaller than or equal to a preset threshold value.
2. The method of claim 1, wherein in case that the established correspondence is plural, the method further comprises:
determining a minimum total distance from the total distances corresponding to the plurality of corresponding relations;
comparing the minimum total distance to the predetermined threshold.
3. The method of claim 2, wherein establishing a correspondence between pixel points in the first pixel matrix and pixel points 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 pixel points on four edges in the first pixel matrix to pixel points on four edges in 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 pixel points on four edges in the first pixel matrix, and the second internal pixel points are pixel points except for pixel points on four edges in the second pixel matrix.
4. The method of claim 3, wherein the step of respectively corresponding the pixel points on four sides of the first pixel matrix to the pixel points on four sides of the second pixel matrix comprises:
for a first side of the four sides, constructing a distance matrix by taking pixel points of the first side in the first pixel matrix as rows and taking pixel points of the first side in the second pixel matrix as columns, wherein values of matrix elements in the distance matrix are pixel difference values between pixel values of pixel points on corresponding rows and corresponding columns, and the first side is any one of the four sides;
and finding a continuous shortest path from the starting point to the end point in the distance matrix by taking one vertex corresponding to the first edge as a starting point and the other vertex as an end point, wherein a matrix element on the shortest path represents 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. The method of claim 3, wherein associating first interior pixels of the first pixel matrix with second interior pixels of the second pixel matrix comprises:
and respectively corresponding first internal pixel points in the first pixel matrix to second internal pixel points in the second pixel matrix by adopting a local optimal algorithm.
6. The method of claim 5, wherein using the local optimal algorithm to map first interior pixels in the first pixel matrix to second interior pixels in the second pixel matrix comprises:
assume pixel B of the first internal pixelsi,jCorresponding to the pixel point S in the second internal pixel pointm,nWherein, if B isi-1,jExist and B isi-1,jCorresponds to Sa,bIf m is greater than or equal to a and n is greater than or equal to b; if B is presenti,j-1Exist and B isi,j-1Corresponds to Sc,dIf m is greater than or equal to c and n is greater than or equal to d;
obtaining a pixel point B in the first internal pixel pointsi,jAnd a pixel point S in the second internal pixel pointa,bA first distance between the first internal pixel points, and a pixel point B in the first internal pixel pointsi,jAnd a pixel point S in the second internal pixel pointc,dA second distance therebetween, andobtaining a pixel point B in the first internal pixel pointsi,jAnd a pixel point S in the second internal pixel pointa+1,bOr pixel point Sc,d+1A third distance therebetween;
selecting 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 pointi,jAnd (4) corresponding pixel points.
7. A material processing apparatus, comprising:
the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a pixel value of a first material to obtain a first pixel matrix of the first material and acquiring a pixel value of a second material to obtain a second pixel matrix of the second material, and the size of the first material is different from that of the second material;
an establishing module configured to establish a correspondence between pixel points in the first pixel matrix and pixel points in the second pixel matrix, to obtain a distance between corresponding points, to obtain a total distance;
a first determining module configured to determine that the first material and the second material are materials with consistent content if the total distance is less than or equal to a predetermined threshold.
8. 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 6.
9. 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 6.
10. A computer program product comprising a computer program, characterized in that the computer program realizes the material processing method of any one of claims 1 to 6 when executed by a processor.
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 true CN113344068A (en) | 2021-09-03 |
CN113344068B 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)
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 |
-
2021
- 2021-05-31 CN CN202110605579.4A patent/CN113344068B/en active Active
Patent Citations (6)
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)
Title |
---|
张金萍;刘杰;李允公;倪洪启;: "一种基于PCA的工件图像匹配方法的研究", 东北大学学报(自然科学版), no. 11 * |
谢毓湘;栾悉道;魏迎梅;张芯;吴玲达;邓莉琼;: "面向交互式快速动画制作的素材标注与检索系统", 小型微型计算机系统, no. 10 * |
Also Published As
Publication number | Publication date |
---|---|
CN113344068B (en) | 2023-10-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110136229B (en) | Method and equipment for real-time virtual face changing | |
EP2916291B1 (en) | Method, apparatus and computer program product for disparity map estimation of stereo images | |
EP2887312A1 (en) | Method, apparatus and computer program product for depth estimation of stereo images | |
EP2680222A1 (en) | Method, apparatus and computer program product for processing media content | |
US20170116765A1 (en) | Methods and systems for color processing of digital images | |
CN105427263A (en) | Method and terminal for realizing image registering | |
CN109116129B (en) | Terminal detection method, detection device, system and storage medium | |
CN110334746B (en) | Image detection method and device | |
CN113011403B (en) | Gesture recognition method, system, medium and device | |
CN110866473B (en) | Target object tracking detection method and device, storage medium and electronic device | |
CN114096994A (en) | Image alignment method and device, electronic equipment and storage medium | |
US20150332472A1 (en) | Method, apparatus and computer program product for disparity estimation in images | |
CN114298902A (en) | Image alignment method and device, electronic equipment and storage medium | |
CN110266926B (en) | Image processing method, image processing device, mobile terminal and storage medium | |
CN114827562B (en) | Projection method, projection device, projection equipment and computer storage medium | |
CN109919164B (en) | User interface object identification method and device | |
US20130322761A1 (en) | System and Method to Determine Feature Candidate Pixels of an Image | |
CN112883762A (en) | Living body detection method, device, system and storage medium | |
EP2669894A1 (en) | Method for creating thumbnail images of videos and an electronic device for display thereof | |
US9489741B2 (en) | Method, apparatus and computer program product for disparity estimation of foreground objects in images | |
CN113516739B (en) | Animation processing method and device, storage medium and electronic equipment | |
CN113344068B (en) | Material processing method, device, electronic equipment and computer readable storage medium | |
WO2023151210A1 (en) | Image processing method, electronic device and computer-readable storage medium | |
CN113822280B (en) | Text recognition method, device, system and nonvolatile storage medium | |
CN111866383A (en) | Image processing method, terminal and storage medium |
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 |