Image blocking method, device and equipment and readable storage medium

By performing boundary recognition and pixel division of stored images and combining pixel mapping relationships for image chunking, the problem of image data being converted into one-dimensional data streams in the prior art is solved, and a more efficient data deduplication is achieved.

CN119887822APending Publication Date: 2025-04-25CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411791219.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

When the prior art converts the image files of the two-dimensional data structure into one-dimensional data stream for data deletion, the similarity semantic information of the image in two-dimensionality will be lost, reducing the redundancy of the image, which is not conducive to deduplication.

Method used

By acquiring the first pixel matrix and the second pixel matrix of the image to be stored, the second pixel matrix is ​​a pixel matrix after boundary recognition of the first pixel matrix. The pixel value of each pixel point represents the edge intensity, and the pixel points are divided into the corresponding pixel set according to the pixel difference value, and the image is chunked according to the pixel mapping relationship.

Benefits of technology

Retain the redundant semantic information of the image to improve the accuracy of determining data duplication, and improve the effect of data deduplication by dividing images in the same connected domain into the same data block.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119887822A_ABST
    Figure CN119887822A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an image blocking method, device and equipment and a readable storage medium. The method comprises the following steps: acquiring a first pixel matrix of a to-be-stored image, and acquiring a second pixel matrix; according to a pixel difference value between a target pixel point and an adjacent pixel point, dividing each pixel point in the second pixel matrix into a corresponding pixel set; wherein each pixel set corresponds to one connected domain of the image to be stored; according to a pixel mapping relation, a corresponding target pixel set mapped by each pixel set in the first pixel matrix is obtained, and the pixel mapping relation comprises a corresponding relation between pixel points of the first pixel matrix and pixel points of the second pixel matrix; and according to the plurality of target pixel sets, carrying out image partitioning on the to-be-stored image. According to the method, redundant semantic information of the image can be reserved, and the accuracy of determining data repetition is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of data processing technology, and in particular relates to an image segmentation method, device, equipment and a readable storage medium. Background Art

[0002] Current data reduction technologies include deduplication technology, which is to delete duplicate data. By eliminating identical files or data blocks in distributed storage systems, the physical storage space occupied by data can be effectively reduced. During the deduplication process, duplicate data needs to be segmented and detected. Duplicate data block detection technology is divided into fixed sized partition (FSP) and variable sized partition (VSP), where VSP includes content defined chunking (CDC).

[0003] In the related art, when deduplicating image data, the image file with a two-dimensional data structure is usually converted into a one-dimensional data stream, and then the one-dimensional data stream is segmented. However, in actual use, image data is highly redundant. Converting the image file with a two-dimensional data structure into a one-dimensional data stream will lose the similarity semantic information of the image in two dimensions, and the resulting data segmentation will also reduce the redundancy of the image, which is not conducive to deduplication. Summary of the invention

[0004] The present invention provides an image segmentation method, device, equipment and readable storage medium to solve the problem in the related art that an image file with a two-dimensional data structure is converted into a one-dimensional data stream, the similarity semantic information of the image in two dimensions is lost, the redundancy of the image is reduced, and it is not conducive to deduplication.

[0005] In a first aspect, the present invention provides an image segmentation method, the method comprising:

[0006] Acquire a first pixel matrix of an image to be stored, and acquire a second pixel matrix, wherein the second pixel matrix is ​​a pixel matrix obtained after boundary recognition is performed on the first pixel matrix, and the pixel value at each pixel point in the second pixel matrix represents the edge strength at the point;

[0007] According to the pixel difference between the target pixel and the adjacent pixel, each pixel in the second pixel matrix is ​​divided into a corresponding pixel set; wherein each pixel set corresponds to a connected domain of the image to be stored; and the target pixel includes any pixel in the second pixel matrix;

[0008] Obtaining a corresponding target pixel set mapped by each pixel set in the first pixel matrix according to a pixel mapping relationship, wherein the pixel mapping relationship includes a correspondence relationship between pixel points of the first pixel matrix and pixel points of the second pixel matrix;

[0009] The image to be stored is divided into image blocks according to the multiple target pixel sets.

[0010] In a second aspect, the present invention provides an image segmentation device, the device comprising:

[0011] an acquisition module, configured to acquire a first pixel matrix of an image to be stored, and to acquire a second pixel matrix, wherein the second pixel matrix is ​​a pixel matrix obtained after boundary recognition is performed on the first pixel matrix, and the pixel value at each pixel point in the second pixel matrix represents the edge strength at the point;

[0012] A division module, used for dividing each pixel point in the second pixel matrix into a corresponding pixel set according to a pixel difference between a target pixel point and an adjacent pixel point; wherein each pixel set corresponds to a connected domain of the image to be stored; and the target pixel point includes any pixel point in the second pixel matrix that is not divided into a pixel set;

[0013] a mapping module, configured to obtain a corresponding target pixel set mapped by each pixel set in the first pixel matrix according to a pixel mapping relationship, wherein the pixel mapping relationship includes a correspondence relationship between pixel points of the first pixel matrix and pixel points of the second pixel matrix;

[0014] The blocking module is used to block the image to be stored according to the multiple target pixel sets.

[0015] In a third aspect, the present invention provides an electronic device comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the program.

[0016] In a fourth aspect, the present invention provides a readable storage medium, which, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute the method described in the first aspect.

[0017] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:

[0018] By obtaining a first pixel matrix of an image to be stored, and obtaining a second pixel matrix, wherein the second pixel matrix is ​​a pixel matrix obtained after boundary recognition is performed on the first pixel matrix, and the pixel value at each pixel point in the second pixel matrix represents the edge strength at the point; according to the pixel difference between the target pixel point and the adjacent pixel point, each pixel point in the second pixel matrix is ​​divided into a corresponding pixel set; wherein each of the pixel sets corresponds to a connected domain of the image to be stored; the target pixel point includes any pixel point in the second pixel matrix; according to the pixel mapping relationship, the corresponding target pixel set mapped by each of the pixel sets in the first pixel matrix is ​​obtained, and the pixel mapping relationship includes the correspondence between the pixel points of the first pixel matrix and the pixel points of the second pixel matrix; according to the multiple target pixel sets, the image to be stored is divided into image blocks. In this way, the boundaries of the image to be stored can be identified to obtain the identified pixel matrix, and the pixel points of the identified pixel matrix can be divided into corresponding pixel sets. The pixel difference between the pixel point and the adjacent pixel points can determine different connected domains. Different connected domains correspond to different pixel sets. Then, the corresponding set of each pixel set in the original pixel matrix of the image to be stored is obtained according to the pixel mapping relationship. The original pixel matrix of the image to be stored can be divided into blocks according to the boundaries of the image connected domain. In this way, images in the same connected domain can be divided into the same data block, the redundant semantic information of the image can be retained, and the accuracy of determining data duplication is improved.

[0019] Additional aspects and advantages of the present invention will be given in part in the following description, and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0021] Figure 1 It is a flow chart of a data segmentation method provided by the background technology of this application;

[0022] Figure 2 is a flow chart of an image segmentation method provided in an embodiment of the present application;

[0023] Figure 3 is a schematic diagram of a pixel matrix provided in an embodiment of the present application;

[0024] Figure 4is a schematic diagram of a mapping relationship provided in an embodiment of the present application;

[0025] Figure 5 is a flowchart of another image segmentation method provided by an embodiment of the present application;

[0026] Figure 6 is a block diagram of an image segmentation provided by an embodiment of the present application;

[0027] Figure 7 It is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0028] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0029] Before introducing the image segmentation method, device, equipment and storage medium provided by the present disclosure, the application scenarios involved in each embodiment of the present disclosure are first introduced. The present disclosure can be applied to the data segmentation scenario during data deduplication, and the image segmentation method provided by the embodiment of the present disclosure can be applied to electronic devices, wherein the electronic device includes a device capable of realizing data storage function.

[0030] Specifically, the electronic device may include a handheld device, a vehicle-mounted device, a wearable device, a computing device or other processing device connected to a wireless modem, as well as various forms of user equipment (UE) (e.g., a mobile phone), a mobile station (MS) and other devices.

[0031] In recent years, with the popularization and development of the Internet, the amount of data information storage has exploded. According to analysis, 75% of the information is redundant and repeated. Therefore, data deduplication (Data Deduplication) as a technology that can effectively eliminate redundant data has become a research hotspot in the storage field in recent years. Data deduplication technology can not only save storage space, but also avoid the repeated transmission of redundant data and save network bandwidth.

[0032] Current data reduction technologies include deduplication technology, which is to delete duplicate data. By eliminating identical files or data blocks in distributed storage systems, the physical storage space occupied by data can be effectively reduced. During the deduplication process, duplicate data needs to be segmented and detected. Duplicate data block detection technology is divided into fixed sized partition (FSP) and variable sized partition (VSP), where VSP includes content defined chunking (CDC).

[0033] In related technologies, such as Figure 1 As shown, when deduplication is performed on image data, the image file with a two-dimensional data structure is usually converted into a one-dimensional data stream, and then the one-dimensional data stream is segmented. However, in actual use, image data is highly redundant. Converting an image file with a two-dimensional data structure into a one-dimensional data stream will lose the similarity semantic information of the image in two dimensions, and the resulting data segmentation will also reduce the redundancy of the image, which is not conducive to deduplication.

[0034] In order to solve the above problems, the present disclosure provides an image segmentation method, device, equipment and readable storage medium, which can obtain an identified pixel matrix by performing boundary recognition on an image to be stored, and divide the pixel points of the identified pixel matrix into corresponding pixel sets. The pixel difference between a pixel point and an adjacent pixel point can determine different connected domains, and different connected domains correspond to different pixel sets. Then, according to the pixel mapping relationship, the corresponding set of each pixel set in the original pixel matrix of the image to be stored is obtained, and the original pixel matrix of the image to be stored can be segmented according to the boundary of the image connected domain. In this way, images in the same connected domain can be divided into the same data block, and the redundant semantic information of the image can be retained, thereby improving the accuracy of determining data duplication.

[0035] Before describing the solution provided by the present disclosure in detail, some terms in the present disclosure are first explained to facilitate understanding by those skilled in the art.

[0036] Compression is a mechanism that uses a specific algorithm to reduce the size of computer files. Compression technology can be divided into lossless compression and lossy compression. Lossless compression means that the compressed data is used for decompression, and the obtained data is exactly the same as the original data. The main compression algorithms used in storage systems are Huffman coding, LZ77, LZW, DEFLATE, etc. Lossy compression means that the compressed data is used for decompression, and the obtained data is different from the original data. It is mainly applicable to the field of image or video compression.

[0037] Fixed sized partition (FSP) refers to a fixed-length data block. FSP is used for fixed-length data deduplication. Fixed partition is also called fixed-length partition. Fixed-length partition means that the file is divided into data blocks of the same size. In the data deduplication process based on fixed partition, the computer device calculates the deduplication fingerprint of each fixed-length data block. The data with the same deduplication fingerprint represents the same content of the data block. Therefore, for the data blocks with the same deduplication fingerprint, the original data only needs to be stored once.

[0038] Content defined chunking (CDC) refers to variable-length chunking based on data content. The basis for determining whether chunking should be done is to identify whether the data content meets the preset conditions through a sliding window. Only when a sliding window that meets the conditions is found will chunking be considered at the beginning of the sliding window. In this way, when inserting and deleting data, only a small number of corresponding data blocks will be affected, and the content of all subsequent data blocks will not be changed, nor will it affect the data chunking deduplication based on the CDC method. Compared with the fixed chunking method, it effectively improves the deduplication rate.

[0039] The method provided in the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.

[0040] Figure 2 is a flowchart of an image segmentation method provided in an embodiment of the present application, the method is applied to electronic devices such as Figure 2 As shown, the method may include the following steps.

[0041] In step S101, a first pixel matrix of an image to be stored is obtained, and a second pixel matrix is ​​obtained.

[0042] The second pixel matrix is ​​a pixel matrix obtained after boundary recognition of the first pixel matrix, and the pixel value at each pixel point in the second pixel matrix represents the edge strength at the point. The image to be stored may include image data in RGB (Red Green Blue) color image format.

[0043] In this step, the electronic device can receive the image to be stored, and the image to be stored is used for the electronic device to perform data deduplication. The image to be stored can be data that the electronic device needs to back up, or data that the electronic device needs to archive, without specific limitation.

[0044] In some embodiments, image data in RGB color image format corresponding to the image to be stored can be first obtained. The image data can be represented in a pixel matrix format. The image to be stored can be represented as a three-dimensional first pixel matrix, which specifically includes the correspondence between pixels and channel information; the first pixel matrix can be represented as n×m×3.

[0045] Each pixel consists of the intensity values ​​of three colors: red (R), green (G), and blue (B). Each intensity value is usually an integer between 0 and 255, which can represent 256 levels of grayscale. In the first pixel matrix, n is the height of the image (i.e., the number of rows of pixels in the image), m is the width of the image (i.e., the number of columns of pixels in the image), and 3 represents the three color channels (red, green, and blue). For example, an image with a height of 6 pixels and a width of 5 pixels will have 6×5 pixels, and each pixel has three corresponding RGB values.

[0046] When the first pixel matrix of the image to be stored is obtained, the first pixel matrix can be used as the input of the trained boundary recognition model to obtain a second pixel matrix identified by the boundary recognition model, wherein the pixel value at each pixel point in the second pixel matrix represents the edge strength at the point.

[0047] Optionally, a Sobel operator (Sobel operator) may be used to perform boundary detection and recognition on the image to be stored to obtain a second pixel matrix of the image to be stored.

[0048] The pixel gradient calculation of the first pixel matrix can be performed by using a Sobel operator to detect pixels with step changes in pixel grayscale, and thus obtain the second pixel matrix.

[0049] In a possible implementation, the image to be stored may first be converted from an RGB color image format to a grayscale image format, and then a pixel matrix corresponding to the grayscale image format is used as the new second pixel matrix.

[0050] For example, the Sobel operator may include filter templates in two directions, vertical and horizontal, which are respectively plane-convolved with the first pixel matrix to obtain vertical and horizontal brightness difference approximations.

[0051] Among them, the vertical filter can be expressed as: The horizontal filter can be expressed as:

[0052] Then, the vertical direction filter and the horizontal direction filter can be convolved with the first pixel matrix respectively through the following formula to obtain the second pixel matrix:

[0053] O x =Y⊙ω x ;

[0054] O y =Y⊙ω y ;

[0055]

[0056] Among them, O x Represents the horizontal gradient image, O y represents the vertical gradient image, Y represents the first pixel matrix, Z represents the second pixel matrix, and the ⊙ symbol represents the convolution operation.

[0057] Optionally, the second pixel matrix may be filled with pixels to obtain the second pixel matrix having the same matrix size as the first pixel matrix.

[0058] By adopting the above technical solution, the boundary of the first pixel matrix of the image to be stored can be identified.

[0059] Considering that the acquired image to be stored includes noise interference, which will affect the subsequent image segmentation operation, therefore, optionally, the first pixel matrix of the image to be stored can be first denoised using mean filtering. Mean filtering can reduce sharp changes in the image and remove noise in the image.

[0060] In some embodiments, a third pixel matrix of the image to be stored is obtained.

[0061] The third pixel matrix is ​​a pixel matrix obtained by removing noise from the first pixel matrix.

[0062] In this step, when the first pixel matrix of the image to be stored is obtained, the first pixel matrix X can be expressed as m×n, and the mean filter can be expressed as Therefore, the first pixel matrix can be subjected to mean filtering and denoising by the following formula to obtain the third pixel matrix:

[0063] Y=X⊙ω;

[0064] Among them, Y can represent the third pixel matrix, X represents the first pixel matrix, and the ⊙ symbol represents a convolution operation.

[0065] In step S102, each pixel point in the second pixel matrix is ​​divided into a corresponding pixel set according to the pixel difference between the target pixel point and the adjacent pixel points.

[0066] Each of the pixel sets corresponds to a connected domain of the image to be stored; and the target pixel point includes any pixel point in the second pixel matrix.

[0067] Optionally, a set partitioning operation may be performed first to partition the second pixel matrix into a plurality of pixel sets.

[0068] The set division operation includes: dividing the target pixel point into corresponding pixel sets, and determining a plurality of pixel points corresponding to the pixel set according to a pixel difference between the target pixel point and adjacent pixel points.

[0069] When the pixel set is obtained, any pixel point in the second pixel matrix that is not divided into the pixel set can be used as a new target pixel point, and the set division operation can be repeatedly performed until the second pixel matrix does not include pixel points that are not divided into the pixel set, so as to obtain multiple pixel sets.

[0070] Each pixel set includes a plurality of pixel points, and the pixel points between the pixel sets are not repeated.

[0071] In this step, if Figure 3 As shown, Figure 3 The matrix in can represent the second pixel matrix. When performing a set partitioning operation on the second pixel matrix, taking the a11 pixel point as an example, when the a11 pixel point is used as the target pixel point, the a11 pixel point can be divided into the B1 pixel set, and then the other pixel points included in the B1 pixel set can be determined based on the pixel difference between the a11 pixel point and the adjacent pixel points.

[0072] After obtaining all the pixels in the B1 pixel set, any pixel point can be selected as a new target pixel point from the other pixel points in the second pixel matrix except the pixel points included in the B1 pixel set. For example, the a13 pixel point can be selected as the new target pixel point, and then the B2 pixel set is determined through the above steps of determining the B1 pixel set, and the above steps are repeated in sequence until the second pixel matrix does not include pixel points that are not divided into pixel sets. In this way, multiple pixel sets including B1, B2,..., Bn pixel sets and so on can be obtained.

[0073] In a possible implementation manner, the plurality of pixel points corresponding to the pixel set may be determined according to the pixel difference between the target pixel point and adjacent pixel points in the following manner.

[0074] Optionally, a pixel division operation may be performed first to obtain a plurality of pixel points included in the pixel set.

[0075] Among them, the pixel division operation includes: determining whether the candidate pixel point meets the boundary difference condition based on the pixel value of the target pixel point; the candidate pixel point is any pixel point adjacent to the target pixel point, and the boundary difference condition includes that the pixel difference is the minimum difference among all adjacent pixel differences, and the adjacent pixel difference is the pixel difference between the pixel point adjacent to the target pixel point and the target pixel point.

[0076] For example, the coordinates of the target pixel point can be assumed to be (i, j), and then a pixel set can be searched starting from the (i, j) coordinates. The search can be started from the three directions of (i+1, j), (i, j+1), and (i+1, j+1), and then the absolute difference values ​​in these three directions can be compared respectively:

[0077] V x =|V i+1,j -V i,j |;

[0078] V y =|V i,j+1 -V i,j |;

[0079] V xy =|V i+1,j+1 -V i,j |;

[0080] Among them, V x is the differential value on the X-axis, V y is the differential value on the Y axis, V xy is the difference value in the (0, x, y) direction, V i+1,j is the pixel value of the pixel point adjacent to the target pixel point on the X axis, V i,j+1 is the pixel value of the pixel point adjacent to the target pixel point on the Y axis, V i+1,j+1 It is the pixel value of the pixel point adjacent to the target pixel point in the (0, x, y) direction.

[0081] And calculate the minimum difference value in the three directions: V min =min(V x ,V y ,V xy ), and the pixel point with the minimum difference value corresponding to the coordinates in the three directions is taken as the candidate pixel point that meets the boundary difference condition.

[0082] When it is determined that the candidate pixel point satisfies the boundary difference condition, the candidate pixel point is used as a new target pixel point, and the pixel division operation is re-executed until the target pixel point satisfies the boundary termination condition.

[0083] Among them, the boundary termination condition includes that the pixel points adjacent to the target pixel point do not include pixel points in an undivided set, or that the pixel differences between the pixel points adjacent to the target pixel point and the target pixel point are greater than or equal to a preset difference threshold.

[0084] Then, all the determined target pixel points may be used as a plurality of pixel points corresponding to the pixel set.

[0085] In this step, if Figure 3 As shown, Figure 3 The matrix in can represent the second pixel matrix. When performing a set partitioning operation on the second pixel matrix, the pixel point a11 can be taken as an example. When the pixel point a11 is used as the target pixel point, the pixel point a11 can be firstly partitioned into the pixel set B1, and then Figure 3 It can be concluded that the pixels adjacent to the a11 pixel include: a12 pixel, a21 pixel, and a22 pixel, wherein the pixel value of a11 pixel is 1, the pixel value of a12 pixel is 1, the pixel value of a12 pixel is 3, and the pixel value of a22 pixel is 2. It can be concluded that the pixel differences between the a11 pixel and the adjacent pixels are (a12 pixel: 0), (a21 pixel: 2), and (a12 pixel: 1), respectively. Therefore, it can be determined that the a12 pixel satisfies the boundary difference condition, and the a12 pixel can be used as the candidate pixel that satisfies the boundary difference condition. When it is determined that the a12 pixel point satisfies the boundary difference condition, the a12 pixel point is used as a new target pixel point, and then the above steps are repeated to determine a new target pixel point among the pixels adjacent to the a12 pixel point, such as: a22 pixel point, and the above pixel division operation steps are repeated until the target pixel point determined for the last time does not include the pixel points of the undivided set, or the pixel difference between the pixel points adjacent to the target pixel point and the target pixel point is greater than or equal to the preset difference threshold, and finally all the determined target pixel points can be used as multiple pixel points corresponding to the B1 pixel set.

[0086] By adopting the above technical solution, the second pixel matrix can be divided into a plurality of pixel sets according to the boundary recognition result of the image to be stored, wherein each pixel set can correspond to a connected domain of the image to be stored.

[0087] In another possible implementation, when performing a pixel division operation, if all pixel points adjacent to the target pixel point have the same pixel difference value as the adjacent pixel points of the target pixel point, it can be considered that the boundary strength of all pixel points around the target pixel point is consistent. In this case, the preset spatial determination order can be followed and the preset spatial priority principle can be followed. First, the adjacent pixel points in the direction of (0, i+1; j+1) are taken as candidate pixel points. When the pixel points of the undivided set are not included in the direction of (0, i+1; j+1), or the pixel differences are all greater than or equal to the preset difference threshold, the adjacent pixel points in the direction of (0, i+1) are taken as candidate pixel points. When the pixel points of the undivided set are not included in the direction of (0, i+1), or the pixel differences are all greater than or equal to the preset difference threshold, the adjacent pixel points in the direction of (0, j+1) are taken as candidate pixel points. When the pixel points of the undivided set are not included in the direction of (0, j+1), or the pixel differences are all greater than or equal to the preset difference threshold, the adjacent pixel points in the direction of (0, j+1) are taken as candidate pixel points. When the pixel points of the undivided set are not included in the direction of (0, j+1), or the pixel differences are all greater than or equal to the preset difference threshold, it can be determined that all pixel points included in the pixel set have been obtained.

[0088] In step S103, according to the pixel mapping relationship, a corresponding target pixel set mapped by each pixel set in the first pixel matrix is ​​obtained.

[0089] The pixel mapping relationship includes a corresponding relationship between pixel points of the first pixel matrix and pixel points of the second pixel matrix.

[0090] In this step, the pixel mapping relationship may be firstly established according to the pixel points in the first pixel matrix and the pixel points in the second pixel matrix.

[0091] Then, when the pixel mapping relationship is obtained, for each pixel point in the pixel set, the mapping pixel point corresponding to the pixel point can be determined in the first pixel matrix according to the pixel mapping relationship, and the set of the determined multiple mapping pixel points can be used as the target pixel set corresponding to the pixel set.

[0092] In a possible implementation, the first pixel matrix of the image to be stored may be subjected to mean filtering to obtain the third pixel matrix, and then the boundary of the third pixel matrix may be identified to obtain the second pixel matrix.

[0093] In this case, the first pixel mapping relationship can be established based on the pixel points in the second pixel matrix and the pixel points in the third pixel matrix; and the second pixel mapping relationship can be established based on the pixel points in the first pixel matrix and the pixel points in the third pixel matrix.

[0094] Optionally, for each pixel point in the pixel set, based on the first pixel mapping relationship, a candidate mapping pixel point corresponding to the pixel point can be determined in the third pixel matrix; based on the second pixel mapping relationship, the mapping pixel point corresponding to the candidate mapping pixel point can be determined in the first pixel matrix; and the set of the determined multiple mapping pixel points is used as the target pixel set corresponding to the pixel set.

[0095] For example, the first pixel matrix may be represented as X, the third pixel matrix may be represented as Y, and the second pixel matrix may be represented as z.

[0096] First, a pixel mapping relationship can be established for XYZ.

[0097] The second pixel mapping relationship may be established between XY, and the first pixel mapping relationship may be established between YZ.

[0098] Specifically, suppose the eigenvalue of the i-th row and j-th column of Z is Z i,j , then there are 9 eigenvalues ​​corresponding to Y (3×3 filter). Further assuming that the coordinates of the center point of the local area formed by these 9 eigenvalues ​​on Y are also (i, j), then the mapping relationship is:

[0099] Similarly, the mean filter size is also 3×3, and the mapping from Y to X is: The local mapping relationship between the three can be expressed as Figure 4 shown.

[0100] In step S104, the image to be stored is divided into blocks according to the plurality of target pixel sets.

[0101] The above technical solution is adopted, by obtaining a first pixel matrix of an image to be stored, and obtaining a second pixel matrix, wherein the second pixel matrix is ​​a pixel matrix obtained after boundary recognition of the first pixel matrix, and the pixel value at each pixel point in the second pixel matrix represents the edge strength at the point; according to the pixel difference between the target pixel point and the adjacent pixel point, each pixel point in the second pixel matrix is ​​divided into a corresponding pixel set; wherein each of the pixel sets corresponds to a connected domain of the image to be stored; the target pixel point includes any pixel point in the second pixel matrix; according to the pixel mapping relationship, the corresponding target pixel set mapped by each pixel set in the first pixel matrix is ​​obtained, and the pixel mapping relationship includes the correspondence between the pixel points of the first pixel matrix and the pixel points of the second pixel matrix; according to multiple target pixel sets, the image to be stored is divided into image blocks. In this way, the boundaries of the image to be stored can be identified to obtain the identified pixel matrix, and the pixel points of the identified pixel matrix can be divided into corresponding pixel sets. The pixel difference between the pixel point and the adjacent pixel points can determine different connected domains. Different connected domains correspond to different pixel sets. Then, the corresponding set of each pixel set in the original pixel matrix of the image to be stored is obtained according to the pixel mapping relationship. The original pixel matrix of the image to be stored can be divided into blocks according to the boundaries of the image connected domain. In this way, images in the same connected domain can be divided into the same data block, the redundant semantic information of the image can be retained, and the accuracy of determining data duplication is improved.

[0102] Figure 5 is a flowchart of another image segmentation method provided in an embodiment of the present application, the method is applied to electronic devices such as Figure 5 As shown, the method may include the following steps.

[0103] In step S201, a first pixel matrix of an image to be stored is obtained.

[0104] In step S202, noise is removed from the first pixel matrix to obtain a third pixel matrix.

[0105] In step S203, a second pixel matrix is ​​obtained by performing boundary recognition on the third pixel matrix.

[0106] In step S204, a first pixel mapping relationship is established based on the pixel points in the second pixel matrix and the pixel points in the third pixel matrix, and a second pixel mapping relationship is established based on the pixel points in the first pixel matrix and the pixel points in the third pixel matrix.

[0107] In step S205, a pixel division operation and a set division operation are performed on the target pixel point in the second pixel matrix, and each pixel point in the second pixel matrix is ​​divided into a corresponding pixel set.

[0108] In step S206, for each pixel in the pixel set, a candidate mapping pixel corresponding to the pixel is determined in the third pixel matrix according to the first pixel mapping relationship.

[0109] In step S207, according to the second pixel mapping relationship, the mapping pixel point corresponding to the candidate mapping pixel point is determined in the first pixel matrix.

[0110] In step S208, the determined set where the plurality of mapped pixel points are located is used as the target pixel set corresponding to the pixel set.

[0111] In step S209, the image to be stored is divided into blocks according to the multiple target pixel sets.

[0112] By adopting the above technical scheme, it is possible to obtain a pixel matrix after identification by performing boundary identification on the image to be stored, and divide the pixel points of the identified pixel matrix into corresponding pixel sets. The pixel difference between the pixel point and the adjacent pixel points can determine different connected domains. Different connected domains correspond to different pixel sets. Then, the corresponding set of each pixel set in the original pixel matrix of the image to be stored is obtained according to the pixel mapping relationship. The original pixel matrix of the image to be stored can be divided into blocks according to the boundaries of the image connected domain. In this way, images in the same connected domain can be divided into the same data block, the redundant semantic information of the image can be retained, and the accuracy of determining data duplication is improved.

[0113] Figure 6 is a block diagram of an image segmentation device provided in an embodiment of the present application, such as Figure 6 As shown, the image segmentation device 300 includes:

[0114] An acquisition module 301 is used to acquire a first pixel matrix of an image to be stored, and to acquire a second pixel matrix, wherein the second pixel matrix is ​​a pixel matrix obtained after boundary recognition is performed on the first pixel matrix, and the pixel value at each pixel point in the second pixel matrix represents the edge strength at the point;

[0115] A division module 302 is used to divide each pixel point in the second pixel matrix into a corresponding pixel set according to the pixel difference between the target pixel point and the adjacent pixel points; wherein each pixel set corresponds to a connected domain of the image to be stored; and the target pixel point includes any pixel point in the second pixel matrix that is not divided into a pixel set;

[0116] A mapping module 303 is used to obtain a corresponding target pixel set mapped by each pixel set in the first pixel matrix according to a pixel mapping relationship, wherein the pixel mapping relationship includes a correspondence relationship between pixel points of the first pixel matrix and pixel points of the second pixel matrix;

[0117] The blocking module 304 is used to block the image to be stored according to the multiple target pixel sets.

[0118] Optionally, the partitioning module is used to perform a set partitioning operation, the set partitioning operation comprising: partitioning the target pixel point into a corresponding pixel set, and determining a plurality of pixel points corresponding to the pixel set according to a pixel difference between the target pixel point and adjacent pixel points;

[0119] When the pixel set is obtained, any pixel point in the second pixel matrix that is not divided into the pixel set is used as a new target pixel point, and the set division operation is repeatedly performed until the second pixel matrix does not include pixel points that are not divided into the pixel set, so as to obtain multiple pixel sets, each pixel set includes multiple pixel points, and the pixel points between the pixel sets are not repeated.

[0120] Optionally, the division module is used to perform a pixel division operation, the pixel division operation comprising: determining whether a candidate pixel satisfies a boundary difference condition according to a pixel value of the target pixel; the candidate pixel is any pixel adjacent to the target pixel, the boundary difference condition comprises that the pixel difference is the minimum difference among all adjacent pixel differences, and the adjacent pixel difference is the pixel difference between a pixel adjacent to the target pixel and the target pixel;

[0121] In the case where it is determined that the candidate pixel point satisfies the boundary difference condition, the candidate pixel point is used as a new target pixel point, and the pixel division operation is re-executed until the target pixel point satisfies the boundary termination condition; the boundary termination condition includes that the pixel points adjacent to the target pixel point do not include pixel points in the undivided set, or the pixel difference between the pixel points adjacent to the target pixel point and the target pixel point is greater than or equal to a preset difference threshold;

[0122] All the determined target pixel points are used as a plurality of pixel points corresponding to the pixel set.

[0123] Optionally, the division module is further used to determine the candidate pixel point from any pixel point adjacent to the target pixel point according to a preset spatial determination order.

[0124] Optionally, the mapping module is used to determine, for each pixel point in the pixel set, a mapping pixel point corresponding to the pixel point in the first pixel matrix according to the pixel mapping relationship;

[0125] The determined set where the plurality of mapped pixel points are located is used as the target pixel set corresponding to the pixel set.

[0126] Optionally, the device further comprises:

[0127] An establishing module is used to establish the pixel mapping relationship according to the pixel points in the first pixel matrix and the pixel points in the second pixel matrix.

[0128] Optionally, the pixel mapping relationship includes a first pixel mapping relationship and a second pixel mapping relationship; the device further includes:

[0129] A denoising module, used for acquiring a third pixel matrix of the image to be stored, wherein the third pixel matrix is ​​a pixel matrix obtained by removing noise from the first pixel matrix;

[0130] The acquisition module is used to use the pixel matrix obtained after performing boundary recognition on the third pixel matrix as the second pixel matrix;

[0131] The first pixel mapping relationship includes a correspondence relationship between pixel points in the second pixel matrix and pixel points in the third pixel matrix, and the second pixel mapping relationship includes a correspondence relationship between pixel points in the first pixel matrix and pixel points in the third pixel matrix;

[0132] The mapping module is used to determine, for each pixel point in the pixel set, a candidate mapping pixel point corresponding to the pixel point in the third pixel matrix according to the first pixel mapping relationship; determine, in the first pixel matrix, the mapping pixel point corresponding to the candidate mapping pixel point according to the second pixel mapping relationship; and use the set of the determined multiple mapping pixel points as the target pixel set corresponding to the pixel set.

[0133] By adopting the above-mentioned device, it is possible to obtain a pixel matrix after identification by performing boundary identification on the image to be stored, and divide the pixel points of the pixel matrix after identification into corresponding pixel sets. The pixel difference between the pixel point and the adjacent pixel points can determine different connected domains. Different connected domains correspond to different pixel sets. Then, according to the pixel mapping relationship, the corresponding set of each pixel set in the original pixel matrix of the image to be stored is obtained. The original pixel matrix of the image to be stored can be divided into blocks according to the boundaries of the image connected domain. In this way, images in the same connected domain can be divided into the same data block, the redundant semantic information of the image can be retained, and the accuracy of determining data duplication is improved.

[0134] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0135] The present invention also provides an electronic device, see Figure 7 , including: a processor 401, a memory 402, and a computer program 4021 stored in the memory and executable on the processor, wherein the processor implements the image segmentation method of the aforementioned embodiment when executing the program.

[0136] The present invention also provides a readable storage medium. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the image segmentation method of the aforementioned embodiment.

[0137] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0138] It should be noted that the various information and data obtained in the embodiments of the present invention are all obtained with the authorization of the information / data holder.

[0139] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general purpose systems can also be used with the teachings based on this. Based on the above description, the structure required to construct such a system is obvious.

[0140] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0141] Similarly, it should be understood that in order to streamline the present invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the following intention: that the claimed invention requires more features than the features explicitly recited in each claim. More specifically, as reflected in the claims below, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present invention.

[0142] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0143] The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in the sorting device according to the present invention. The present invention may also be implemented as a device or apparatus program for executing part or all of the methods described herein. Such a program for implementing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0144] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc., does not indicate any order. These words may be interpreted as names.

[0145] The user information (including but not limited to the user's device information, user personal information, etc.) and related data involved in the present invention are all information authorized by the user or by all parties.

[0146] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0147] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

[0148] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. An image segmentation method, characterized in that: The method comprises: Acquire a first pixel matrix of an image to be stored, and acquire a second pixel matrix, wherein the second pixel matrix is ​​a pixel matrix obtained after boundary recognition is performed on the first pixel matrix, and the pixel value at each pixel point in the second pixel matrix represents the edge strength at the point; According to the pixel difference between the target pixel and the adjacent pixel, each pixel in the second pixel matrix is ​​divided into a corresponding pixel set; wherein each pixel set corresponds to a connected domain of the image to be stored; and the target pixel includes any pixel in the second pixel matrix; Obtaining a corresponding target pixel set mapped by each pixel set in the first pixel matrix according to a pixel mapping relationship, wherein the pixel mapping relationship includes a correspondence relationship between pixel points of the first pixel matrix and pixel points of the second pixel matrix; The image to be stored is divided into image blocks according to the multiple target pixel sets.

2. The method according to claim 1, characterized in that: The dividing each pixel point in the second pixel matrix into a corresponding pixel set according to the pixel difference between the target pixel point and the adjacent pixel points comprises: Performing a set partitioning operation, the set partitioning operation comprising: partitioning the target pixel point into corresponding pixel sets, and determining a plurality of pixel points corresponding to the pixel set according to a pixel difference between the target pixel point and adjacent pixel points; When the pixel set is obtained, any pixel point in the second pixel matrix that is not divided into the pixel set is used as a new target pixel point, and the set division operation is repeatedly performed until the second pixel matrix does not include pixel points that are not divided into the pixel set, so as to obtain multiple pixel sets, each pixel set includes multiple pixel points, and the pixel points between the pixel sets are not repeated.

3. The method according to claim 2, characterized in that The step of determining, based on the pixel difference between the target pixel and the adjacent pixel, a plurality of pixel points corresponding to the pixel set comprises: Executing a pixel division operation, the pixel division operation comprising: determining whether a candidate pixel satisfies a boundary difference condition according to a pixel value of the target pixel; the candidate pixel is any pixel adjacent to the target pixel, the boundary difference condition comprises that the pixel difference is the minimum difference among all adjacent pixel differences, and the adjacent pixel difference is the pixel difference between the pixel adjacent to the target pixel and the target pixel; In the case where it is determined that the candidate pixel point satisfies the boundary difference condition, the candidate pixel point is used as a new target pixel point, and the pixel division operation is re-executed until the target pixel point satisfies the boundary termination condition; the boundary termination condition includes that the pixel points adjacent to the target pixel point do not include pixel points in an undivided set, or that the pixel difference between the pixel points adjacent to the target pixel point and the target pixel point is greater than or equal to a preset difference threshold; All the determined target pixel points are used as a plurality of pixel points corresponding to the pixel set.

4. The method according to claim 3, characterized in that When all adjacent pixel differences are the same, the method further includes: The candidate pixel point is determined from any pixel point adjacent to the target pixel point according to a preset spatial determination order.

5. The method according to claim 1, characterized in that The obtaining, according to the pixel mapping relationship, a corresponding target pixel set mapped by each pixel set in the first pixel matrix comprises: For each pixel point in the pixel set, determining a mapping pixel point corresponding to the pixel point in the first pixel matrix according to the pixel mapping relationship; The determined set where the plurality of mapping pixel points are located is used as the target pixel set corresponding to the pixel set.

6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: The pixel mapping relationship is established according to the pixel points in the first pixel matrix and the pixel points in the second pixel matrix.

7. The method according to claim 1, characterized in that The pixel mapping relationship includes a first pixel mapping relationship and a second pixel mapping relationship; The method further comprises: Acquire a third pixel matrix of the image to be stored, wherein the third pixel matrix is ​​a pixel matrix obtained by removing noise from the first pixel matrix; The acquiring of the second pixel matrix comprises: Using a pixel matrix obtained by performing boundary recognition on the third pixel matrix as the second pixel matrix; The first pixel mapping relationship includes a correspondence relationship between pixel points in the second pixel matrix and pixel points in the third pixel matrix, and the second pixel mapping relationship includes a correspondence relationship between pixel points in the first pixel matrix and pixel points in the third pixel matrix; and obtaining, according to the pixel mapping relationship, a corresponding target pixel set mapped by each pixel set in the first pixel matrix includes: For each pixel point in the pixel set, determining, in the third pixel matrix, a candidate mapping pixel point corresponding to the pixel point according to the first pixel mapping relationship; According to the second pixel mapping relationship, determining the mapping pixel point corresponding to the candidate mapping pixel point in the first pixel matrix; The determined set where the plurality of mapping pixel points are located is used as the target pixel set corresponding to the pixel set.

8. An image segmentation device, characterized in that: The device comprises: an acquisition module, configured to acquire a first pixel matrix of an image to be stored, and to acquire a second pixel matrix, wherein the second pixel matrix is ​​a pixel matrix obtained after boundary recognition is performed on the first pixel matrix, and the pixel value at each pixel point in the second pixel matrix represents the edge strength at the point; A division module, used for dividing each pixel point in the second pixel matrix into a corresponding pixel set according to a pixel difference between a target pixel point and an adjacent pixel point; wherein each pixel set corresponds to a connected domain of the image to be stored; and the target pixel point includes any pixel point in the second pixel matrix that is not divided into a pixel set; a mapping module, configured to obtain a corresponding target pixel set mapped by each pixel set in the first pixel matrix according to a pixel mapping relationship, wherein the pixel mapping relationship includes a correspondence relationship between pixel points of the first pixel matrix and pixel points of the second pixel matrix; The blocking module is used to block the image to be stored according to the multiple target pixel sets.

9. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 7 when executing the program.

10. A readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any one of the methods described in claims 1-7.