Image processing method and device, electronic equipment and storage medium
By chunking and inserting and chunking the image to be processed in image processing and replacing the corresponding sub-region images, the mosaic problem during image stitching is solved, and more efficient image processing and quality improvement is achieved.
Patent Information
- Application Number
- CN202411093900.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-11-22
AI Technical Summary
During the image processing, although image chunking processing can reduce memory usage and accelerate reasoning, it is easy to cause mosaic phenomena caused by excessive contrast, brightness, and color difference when splicing sub-blocks.
By dividing the image to be processed into multiple block areas and inserting and chunking on the pixel level, the boundaries of adjacent block areas are smoothed, and the mosaic phenomenon is eliminated by replacing the corresponding sub-region images.
It effectively eliminates the mosaic phenomenon during image stitching, improves the quality and efficiency of image processing, and reduces the use of computing resources.
Smart Images

Figure CN119006486A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of image processing, and in particular to an image processing method, device, electronic device and storage medium. Background Art
[0002] In scenarios where the model is enhancing or processing images, such as dark light enhancement, contrast enhancement, image denoising, image super-resolution, etc., a picture with 4000*2000 pixels is about 24MB in size. When the model is batch trained and inferred, each layer of the model will store intermediate variables when processing photos. The memory usage of the intermediate variables is strongly positively correlated with the pixel size of the photo. In more complex model structures, the required running memory will increase while the image size remains unchanged.
[0003] Therefore, currently, the image is processed in blocks, and then the model inference is performed on each sub-block to greatly reduce the proportion of running memory and speed up the inference process. The image can be divided into several parts by region, and then the sub-blocks are processed one by one. This greatly reduces the memory usage of the model during training and inference, and the sum of the inference running time of all sub-blocks is much less than the running time of inference on the original image. However, this image segmentation method will cause mosaic phenomenon at the edges of adjacent sub-blocks due to excessive contrast, brightness, and color difference when the image is spliced after the sub-blocks are processed. Summary of the invention
[0004] The embodiments of the present application provide an image processing method, device, electronic device and storage medium. Based on dividing the image to be processed into blocks to obtain block areas, each block area is interpolated and divided again at the pixel level to smooth the boundaries between adjacent block areas and eliminate the mosaic phenomenon.
[0005] In a first aspect, an embodiment of the present application provides an image processing method, comprising:
[0006] Dividing the image to be processed into at least two block areas;
[0007] Divide each of the block regions into at least two sub-regions, wherein the at least two block regions include a plurality of region sets, each region set includes at least two block regions, and the sub-regions divided from each block region in the same region set have the same size and shape;
[0008] Replacing an image of at least one sub-region of a first block region among the at least two block regions with an image of a sub-region of a second block region to obtain a block image corresponding to the first block region, wherein the first block region and the second block region belong to the same region set;
[0009] Performing image processing on the block images corresponding to the first block areas respectively to obtain target images corresponding to the first block areas;
[0010] The target image corresponding to the image to be processed is obtained according to the target image corresponding to each of the first block areas.
[0011] In some embodiments, each of the at least two block regions has the same size and shape, and each of the sub-regions in the block region has the same size and shape.
[0012] In some embodiments, replacing the image of at least one sub-region of the first block region among the at least two block regions with the image of the sub-region of the second block region to obtain the block image corresponding to the first block region includes:
[0013] retaining a first image of a sub-region in the first block region;
[0014] Selecting a second image of a sub-region from each of the second block regions;
[0015] A block image corresponding to the first block area is obtained according to the first image and each of the second images.
[0016] In some embodiments, the relative position of the first image in the first block area is the same as the relative position of the second image in the second block area.
[0017] In some embodiments, in replacing the image of at least one sub-region of a first block region among the at least two block regions with the image of a sub-region of a second block region, at least one sub-region of the first block region is a sub-region adjacent to another block region.
[0018] In some embodiments, replacing the image of at least one sub-region of the first block region among the at least two block regions with the image of the sub-region of the second block region includes:
[0019] Replacing the image of at least one sub-region of the first sub-region of the at least two sub-regions with images of one or more sub-regions of the second sub-region; and / or,
[0020] The image of at least one sub-region of the first block region among the at least two block regions is replaced with the images of one or more sub-regions of the second block region.
[0021] In some embodiments, the block images corresponding to the first block areas are obtained by splitting and reassembling the image to be processed.
[0022] In a second aspect, an embodiment of the present application provides an image processing device, including:
[0023] An image division module is used to divide the image to be processed into at least two block areas; each of the block areas is divided into at least two sub-areas, wherein the at least two block areas include a plurality of area sets, each area set includes at least two block areas, and each block area in the same area set is divided into sub-areas in the same manner;
[0024] an image recombining module, which is in communication with the image dividing module and is used to replace an image of at least one sub-region of a first block region of the at least two block regions with an image of a sub-region of a second block region, to obtain a block image corresponding to the first block region, wherein the first block region and the second block region are the same region set;
[0025] The image processing module is communicatively connected with the image reorganization module, and is used for performing image processing on the block images corresponding to each of the first block areas to obtain the target images corresponding to each of the first block areas; and obtaining the target image corresponding to the image to be processed based on the target images corresponding to each of the first block areas.
[0026] In an embodiment, each block area in the at least two block areas has the same size and shape, and each sub-area in the block area has the same size and shape.
[0027] In one embodiment, the image reconstruction module is also used to retain a first image of a sub-area in the first block area; select a second image of a sub-area from each of the second block areas; and obtain a block image corresponding to the first block area based on the first image and each of the second images.
[0028] In one embodiment, the relative position of the first image in the first block area is the same as the relative position of the second image in the second block area.
[0029] In one embodiment, in replacing the image of at least one sub-region of a first block region among the at least two block regions with the image of a sub-region of a second block region, at least one sub-region of the first block region is a sub-region adjacent to another block region.
[0030] In one embodiment, the image reconstruction module is also used to replace the image of at least one sub-region of the first block area among the at least two block areas with the images of one or more sub-regions of the second block area; and / or, to replace the image of at least one sub-region of the first block area among the at least two block areas with the images of one or more sub-regions of the second block area.
[0031] In one embodiment, the block images corresponding to the first block areas are obtained by splitting and reassembling the image to be processed.
[0032] In a third aspect, an embodiment of the present application further 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 executes the computer program to implement the steps in any one of the above-described image processing methods.
[0033] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein a plurality of instructions are stored in the computer-readable storage medium, wherein the instructions are used for execution by a controller to implement an image processing method as described in any one of the above items.
[0034] The scheme of the application embodiment is adopted. On the basis of dividing the image to be processed into block areas, each block area is interpolated and divided again at the pixel level, and the image to be processed is divided into several sub-areas. After replacing the images of the sub-areas of different block areas, the image of each block area is processed. Finally, the target image of each block area after processing is reconstructed to obtain the target image of the image to be processed. In the process of splicing the sub-areas, the boundaries are smoothed to eliminate the mosaic phenomenon. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0036] Figure 1 is a schematic diagram of a scene of an image detection method in an embodiment of the present application;
[0037] Figure 2 is a flowchart of an image processing method provided in an embodiment of the present application;
[0038] Figure 3 is a schematic diagram of a block area in an embodiment of the present application;
[0039] Figure 4 is a schematic diagram of a block area in an embodiment of the present application;
[0040] Figure 5 is a schematic diagram of a block area in an embodiment of the present application;
[0041] Figure 6 is a schematic diagram of a block area in an embodiment of the present application;
[0042] Figure 7 is a schematic diagram of a block area in an embodiment of the present application;
[0043] Figure 8 is a structural schematic diagram of an image processing device in an embodiment of the present application;
[0044] Fig. 9 It is a structural schematic diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0045] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application. At the same time, in the description of the embodiments of the present application, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0046] In the embodiments of the present application, it should be noted that since the image processing method provided by the present application is executed in a computer device, the processing objects of each computer device exist in the form of data or information. For example, time is actually time information. It can be understood that if size, quantity, position, etc. are mentioned in subsequent embodiments, the corresponding data exist so that the computer device can process them. The details will not be repeated here.
[0047] In the embodiment of the present application, it should be noted that the image processing method provided in the embodiment of the present application can be applied to Figure 1In the picture detection system shown. Wherein, the image processing system includes a terminal 100 and a server 200, and the terminal 100 can be a device including both receiving and transmitting hardware, that is, a device having receiving and transmitting hardware capable of performing two-way communication on a two-way communication link. Such a device may include: a cellular or other communication device having a single-line display or a multi-line display or a cellular or other communication device without a multi-line display. The terminal 100 can specifically be a desktop terminal or a mobile terminal, and the terminal 100 can specifically be one of a mobile phone, a tablet computer, a laptop computer, etc., or a camera installed at a monitoring site for information collection, storage, and transmission. The server 200 can be an independent server, or a server network or server cluster composed of servers, which includes but is not limited to a computer, a network host, a single network server, a plurality of network server sets, or a cloud server composed of a plurality of servers. Wherein, the cloud server is composed of a large number of computers or network servers based on cloud computing (Cloud Computing).
[0048] Those skilled in the art will understand that Figure 1 The application environment shown in the figure is only one application scenario of the present application solution and does not constitute a limitation on the application scenario of the present application solution. Other application environments may also include Figure 1 More or less computer equipment as shown in Figure 1 Only one server 200 is shown in the figure. It is understandable that the image processing system may also include one or more other servers, which are not specifically limited here. Figure 1 As shown, the image processing system may further include a memory for storing data, such as storing image information to be processed.
[0049] It should also be noted that Figure 1 The scene diagram of the image processing system shown is only an example. The image processing system and scene described in the embodiment of the present invention are intended to more clearly illustrate the technical solution of the embodiment of the present invention, and do not constitute a limitation on the technical solution provided by the embodiment of the present invention. Ordinary technicians in this field can know that with the evolution of the image processing system and the emergence of new business scenarios, the technical solution provided by the embodiment of the present invention is also applicable to similar technical problems.
[0050] Embodiments of the present application provide an image processing method, apparatus, electronic device, and computer-readable storage medium.
[0051] Specifically, this embodiment will be described from the perspective of an image processing device, which can be integrated into an electronic device, that is, the image processing method of the embodiment of the present application can be executed by an electronic device, and optionally, the electronic device can include: a terminal device. The terminal device can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop computer, a game console, or a personal computer (PC) and other devices.
[0052] The image processing method provided in the embodiment of the present application can be applied to, for example, an image processing system. The image processing system may include a terminal device and a server, and the terminal may be a device including both receiving and transmitting hardware, that is, a device having receiving and transmitting hardware capable of performing two-way communication on a two-way communication link. The terminal device and the server may perform two-way communication via a network.
[0053] Optionally, the server may be an independent server, or a server network or server cluster composed of servers, including but not limited to a computer, a network host, a single network server, a plurality of network server sets or a cloud server composed of multiple servers. The cloud server is composed of a large number of computers or network servers based on cloud computing.
[0054] The image processing method in one embodiment of the present disclosure can be run on a local terminal device or a server. When the image processing method is run on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0055] The following is a detailed description in conjunction with the accompanying drawings. In this embodiment, the execution subject is a terminal device as an example. It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments. Although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order different from that shown in the accompanying drawings.
[0056] Please refer to Figure 2 The specific process of the image processing method may be as follows S100 to S500, and the method includes:
[0057] S100: Divide the image to be processed into at least two block areas.
[0058] Specifically, the image to be processed is an image that needs dark light enhancement, contrast enhancement, image denoising or other image processing methods. The image to be processed is divided into blocks to obtain at least two block areas, and then the block images corresponding to each block area are processed respectively, so as to reduce the memory usage of the model during training and reasoning, and reduce the running time of reasoning.
[0059] The division method of the block area can be freely set as needed, and this embodiment does not make any specific limitation. Figure 3 As shown, the image to be processed is divided into five block areas Ⅰ, Ⅱ, Ⅲ, Ⅳ, and Ⅴ, wherein the block areas Ⅰ and Ⅱ have the same size and shape, the block areas Ⅲ, Ⅳ, and Ⅴ have the same size and shape, but the block areas Ⅰ and Ⅲ have different sizes.
[0060] like Figure 4 and Figure 5 As shown, the image to be processed is divided into four block areas Ⅰ, Ⅱ, Ⅲ, and Ⅳ, wherein the block areas Ⅰ and Ⅱ have the same size and shape, the block areas Ⅲ and Ⅳ have the same size and shape, but the block areas Ⅰ and Ⅲ have different sizes.
[0061] That is to say, the sizes of the various block regions can be the same or different, and the number of block regions of each size is not limited. Figure 6 and Figure 7 As shown, the image to be processed is divided into four block areas Ⅰ, Ⅱ, Ⅲ, and Ⅳ of the same size and shape.
[0062] S200, dividing each of the block regions into at least two sub-regions, wherein the at least two block regions include a plurality of region sets, each region set includes at least two block regions, and the sub-regions divided from each block region in the same region set are of the same size and shape.
[0063] Specifically, each block area is divided into at least two sub-areas, and the sizes and shapes of different sub-areas in the same block area may be the same or different, such as Figure 4 , Figure 5 as well as Figure 6 As shown, different sub-regions in the same block area have different sizes, such as Figure 7 As shown, different sub-regions in the same block area have the same size and shape.
[0064] However, all the block areas obtained by dividing the image to be processed include several area sets, each area set includes at least two block areas, and the sub-areas divided by each block area in the same area set are of the same size and shape, that is, each block area can determine another block area with the same sub-area division method, so that the sub-area images of the two can be replaced.
[0065] like Figure 4 As shown in , block areas Ⅰ and Ⅱ are the same area set, and block areas Ⅲ, Ⅳ and Ⅴ are the same area set. Figure 5 As shown in , block areas Ⅰ and Ⅱ are the same area set, and block areas Ⅲ and Ⅳ are the same area set. Figure 6 and Figure 7As shown in FIG. 1 , the block areas Ⅰ, Ⅱ, Ⅲ, and Ⅳ are the same area set. Preferably, as Figure 6 and Figure 7 As shown, all the block areas obtained by dividing the image to be processed have the same size and shape, and the size and shape of each sub-area in the same block area are the same, so that the images to be processed have the same size, reducing the difficulty of model derivation.
[0066] S300: Replace the image of at least one sub-region of a first block region among the at least two block regions with the image of a sub-region of a second block region to obtain a block image corresponding to the first block region, wherein the first block region and the second block region belong to the same region set.
[0067] Specifically, all the block regions obtained by dividing the image to be processed include the first block region and the second block region, which belong to the same region set, that is, the first block region and the second block region have sub-regions of the same size and shape.
[0068] The image of at least one sub-region of the first block area is replaced with the image of the sub-region of the second block area. It should be noted that the number of replaced sub-regions in the first block area is not limited. Among them, at least the image of one sub-region in the first block area is replaced with the image of a sub-region of the same size and shape in the second block area. At most, only the image of one sub-region of the first block area is retained, and the images of other sub-regions in the first block area are replaced with the images of the sub-regions of the second block area. In addition, the position of the sub-region to be replaced is not limited, that is, a sub-region at any position in the first block area can be selected for image replacement.
[0069] It should be noted that each of all the block regions obtained by dividing the image to be processed can be regarded as the first block region, and then the image of the sub-region of the first block region is replaced according to the above process to obtain the block image corresponding to the first block region, such as Figure 5 , Figure 6 as well as Figure 7 shown.
[0070] Alternatively, only some of the block areas among all the block areas obtained by dividing the image to be processed are regarded as the first block area, and then the image of the sub-area of the first block area is replaced according to the above process to obtain the block image corresponding to the first block area, and the image of each sub-area of another part of the block areas among all the block areas obtained by dividing the image to be processed is not processed, such as Figure 4 As shown, the images of the sub-regions in the block regions III and IV are not replaced.
[0071] Since the replaced image needs to be restored later, the first position information of the sub-area of the replaced first block area and the second position information of the sub-area of the replaced second block area are determined, and the image is restored later based on the first position information and the second position information.
[0072] S400 , performing image processing on the block images corresponding to the first block areas respectively to obtain target images corresponding to the first block areas.
[0073] Specifically, all block areas obtained by dividing the image to be processed are processed in accordance with the above-mentioned processing method of the first block areas to obtain corresponding block images, and then image processing is performed on the block images corresponding to each first block area to obtain the target image corresponding to each first block area. The image processing includes but is not limited to dark light enhancement, contrast enhancement, image denoising, etc.
[0074] S500: Obtain a target image corresponding to the image to be processed according to the target images corresponding to the first block regions.
[0075] Specifically, the sub-target images corresponding to each sub-region in the first block region are determined according to the target image of the first block region. Then, based on the first position information of the sub-region of the first block region replaced during the previous image replacement and the second position information of the sub-region of the second block region used for replacement, the sub-target images of the sub-regions of each first block region are replaced again to obtain images corresponding to the image to be processed in each first block region, and finally they are spliced to obtain the target image corresponding to the image to be processed.
[0076] In this embodiment, on the basis of dividing the image to be processed into block areas, each block area is interpolated and divided again at the pixel level, and the image to be processed is divided into several sub-areas. After replacing the images of the sub-areas of different block areas, the image of each block area is processed. Finally, the target image of each block area after processing is reconstructed to obtain the target image of the image to be processed. In the process of splicing the sub-areas, the boundaries are smoothed to eliminate the mosaic phenomenon.
[0077] In one embodiment, since the present embodiment is used to eliminate the mosaic phenomenon caused by factors such as excessive contrast, brightness, and color difference between the block areas, when replacing the image of at least one sub-area of the first block area among the at least two block areas with the image of the sub-area of the second block area, at least one sub-area of the first block area is a sub-area adjacent to another block area. That is, preferably, the image of the sub-area adjacent to the other block areas in the first block area is replaced to eliminate the mosaic between the adjacent block areas.
[0078] In one embodiment, the replacing of the image of at least one sub-region of the first block area among the at least two block areas with the image of a sub-region of the second block area includes: S310, replacing the image of at least one sub-region of the first block area among the at least two block areas with the image of one or more sub-regions of the second block area; and / or, S320, replacing the image of at least one sub-region of the first block area among the at least two block areas with the image of one or more sub-regions of the second block area.
[0079] Specifically, the same region set includes at least two block regions, and the first block region and the second block region belong to the same region set. Therefore, for each first block region, there is at least one second block region.
[0080] When the images of two or more sub-regions in the first block region are replaced, if there is only one second block region, a corresponding number of sub-region images are selected from the second block region to replace the images of the sub-regions in the first block region.
[0081] If there are two or more second block areas, you can choose to select a corresponding number of sub-area images from one second block area to replace the sub-area images in the first block area. You can also select a corresponding number of sub-area images from multiple second block areas to replace the sub-area images in the first block area, where the number of sub-area images selected from different second block areas is not limited.
[0082] In one embodiment, the block images corresponding to the first block areas are obtained by splitting and reassembling the image to be processed, that is, the block images corresponding to all the first block areas are merged to form the image to be processed, and the process of splitting and replacing the image to be processed does not cause a reduction or increase in image features.
[0083] In one embodiment, the method of replacing the image of at least one sub-region of the first block area among the at least two block areas with the image of the sub-region of the second block area to obtain the block image corresponding to the first block area includes: S330, retaining the first image of a sub-region in the first block area; S340, selecting a second image of a sub-region from each of the second block areas; S350, obtaining the block image corresponding to the first block area based on the first image and each of the second images.
[0084] Specifically, when the sizes and shapes of the block regions obtained by dividing the image to be processed are the same, and the sizes and shapes of the sub-regions in each block region are the same, for the image corresponding to the first block region, the first image corresponding to any sub-region in the first block region is retained, and then the second image of a sub-region is selected from each second block region, and each second block region is the other block regions except the first block region in the block regions obtained by dividing the image to be processed. In other words, Figure 4 As shown in FIG4 , the images of each sub-region in each block region come from different block regions.
[0085] The block images corresponding to the first block area are obtained according to the first image and each second image. Figure 4 As shown, the relative positions of the first image and each second image can be set arbitrarily as needed, and it is only necessary to ensure that the block images finally obtained by stitching are the same in size and shape as the images previously corresponding to the first block areas.
[0086] In addition, during the position transformation process of the image corresponding to each sub-region, the position information of each transformation is determined for subsequent restoration.
[0087] In one embodiment, the relative position of the first image in the first block area is the same as the relative position of the second image in the second block area. At the same time, the relative positions of the first image and the second image in the block images corresponding to the first block area are the same as the relative positions of the first image and the second image in the image to be processed.
[0088] like Figure 7 As shown, the block regions Ⅰ, Ⅱ, Ⅲ, and Ⅳ are the same region set, the block regions Ⅰ, Ⅱ, Ⅲ, and Ⅳ are of the same size and shape, and the block regions Ⅰ, Ⅱ, Ⅲ, and Ⅳ contain only one sub-region of size and shape. In the image to be processed, the sub-regions contained in the block region Ⅰ correspond to images A1, B1, C1, and D1, the sub-regions contained in the block region Ⅱ correspond to images A2, B2, C2, and D2, the sub-regions contained in the block region Ⅲ correspond to images A3, B3, C3, and D3, and the sub-regions contained in the block region Ⅳ correspond to images A4, B4, C4, and D4.
[0089] The image replacement rules of block areas Ⅰ, Ⅱ, Ⅲ, and Ⅳ are the same, and block area Ⅰ is used as an example for explanation below. After image replacement, block area Ⅰ contains images A1, A2, A3, and A4 corresponding to a sub-area in block areas Ⅰ, Ⅱ, Ⅲ, and Ⅳ before image replacement, wherein the relative position of image A1 in block area Ⅰ, the relative position of image A2 in block area Ⅱ, the relative position of image A3 in block area Ⅲ, and the relative position of image A4 in block area Ⅳ are the same. At the same time, the relative positions of images A1, A2, A3, and A4 in block area Ⅰ are the same as their relative positions in the image to be processed.
[0090] Therefore, after replacement, the block images of each block area Ⅰ, Ⅱ, Ⅲ, Ⅳ contain the same image vision as the image to be processed, which is similar to downsampling, and only the resolution of the image is reduced compared to the image to be processed. Image processing based on such block images can be closer to the effect of directly processing the image to be processed, avoiding image distortion, and also making it more effective to improve the mosaic phenomenon problem of adjacent block areas.
[0091] This embodiment accelerates the model training and reasoning process, reduces the memory usage, reduces certain computing resources, improves the mosaic phenomenon of the image segmentation method, and makes the reconstructed image smoother.
[0092] This embodiment also provides an image processing device, which can be integrated into a terminal device. Figure 8 As shown, the image processing device 1000 may include:
[0093] The image division module 1100 is used to divide the image to be processed into at least two block areas; each of the block areas is divided into at least two sub-areas, wherein the at least two block areas include a plurality of area sets, each area set includes at least two block areas, and each block area in the same area set is divided into sub-areas in the same manner;
[0094] An image recombining module 1200 is communicatively connected with the image dividing module 1100, and is used to replace an image of at least one sub-region of a first block region among the at least two block regions with an image of a sub-region of a second block region, so as to obtain a block image corresponding to the first block region, wherein the first block region and the second block region are the same region set;
[0095] The image processing module 1300 is communicatively connected with the image reconstruction module 1200, and is used to perform image processing on the block images corresponding to each of the first block areas to obtain the target images corresponding to each of the first block areas; and obtain the target image corresponding to the image to be processed based on the target images corresponding to each of the first block areas.
[0096] In an embodiment, each block area in the at least two block areas has the same size and shape, and each sub-area in the block area has the same size and shape.
[0097] In one embodiment, the image reconstruction module 1200 is also used to retain a first image of a sub-area in the first block area; select a second image of a sub-area from each of the second block areas; and obtain a block image corresponding to the first block area based on the first image and each of the second images.
[0098] In one embodiment, the relative position of the first image in the first block area is the same as the relative position of the second image in the second block area.
[0099] In one embodiment, in replacing the image of at least one sub-region of a first block region among the at least two block regions with the image of a sub-region of a second block region, at least one sub-region of the first block region is a sub-region adjacent to another block region.
[0100] In one embodiment, the image reconstruction module 1200 is also used to replace the image of at least one sub-region of the first block area among the at least two block areas with the images of one or more sub-regions of the second block area; and / or, to replace the image of at least one sub-region of the first block area among the at least two block areas with the images of one or more sub-regions of the second block area.
[0101] In one embodiment, the block images corresponding to the first block areas are obtained by splitting and reassembling the image to be processed.
[0102] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0103] In some embodiments of the present application, the image processing apparatus 1000 may be implemented in the form of a computer program. The computer program may be implemented in a computer program such as: Fig. 9 The computer device shown in the figure is run on the computer device. The memory of the computer device can store various program modules constituting the image processing device 1000, for example, Figure 8 The image segmentation module 1100, the image reorganization module 1200 and the image processing module 1300 are shown. The computer program composed of various program modules enables the processor to execute the steps of the picture detection method of each embodiment of the present application described in this specification.
[0104] For example, Fig. 9 The computer device shown can be Figure 8The image segmentation module 1100 in the image processing device 1000 shown in the figure performs step S100 and step S200. The computer device can perform step S200 through the image reorganization module 1200. The computer device can perform step S400 and step S500 through the image processing module 1300. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external computer device through a network connection. When the computer program is executed by the processor, a picture detection method is implemented.
[0105] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0106] Accordingly, the embodiment of the present application also provides an electronic device, which may be a terminal, and the terminal may be a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC, Personal Computer), a personal digital assistant (Personal Digital Assistant, PDA) and other terminal devices. Alternatively, the electronic device may be a server.
[0107] The electronic device includes one or more processors; a memory; and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor in the steps of the above-mentioned image processing method. The steps of the image processing method here may be the steps of the image processing method in the above-mentioned various embodiments.
[0108] In some embodiments of the present application, a computer-readable storage medium is provided, which stores a computer program, and the computer program is loaded by a processor, so that the processor executes the steps of the above-mentioned image processing method. The steps of the image processing method here can be the steps in the image processing method of each of the above-mentioned embodiments.
[0109] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Any reference to memory, storage, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0110] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0111] The above is a detailed introduction to an image processing method, device, electronic device and computer-readable storage medium provided in the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. An image processing method, characterized in that: The method comprises: Dividing the image to be processed into at least two block areas; Divide each of the block regions into at least two sub-regions, wherein the at least two block regions include a plurality of region sets, each region set includes at least two block regions, and the sub-regions divided from each block region in the same region set have the same size and shape; Replacing an image of at least one sub-region of a first block region among the at least two block regions with an image of a sub-region of a second block region to obtain a block image corresponding to the first block region, wherein the first block region and the second block region belong to the same region set; Performing image processing on the block images corresponding to the first block areas respectively to obtain target images corresponding to the first block areas; The target image corresponding to the image to be processed is obtained according to the target image corresponding to each of the first block areas.
2. The image processing method according to claim 1, characterized in that: The size and shape of each block area in the at least two block areas are the same, and the size and shape of each sub-area in the block area are the same.
3. The image processing method according to claim 2, characterized in that: The step of replacing the image of at least one sub-region of the first block region among the at least two block regions with the image of the sub-region of the second block region to obtain the block image corresponding to the first block region includes: retaining a first image of a sub-region in the first block region; Selecting a second image of a sub-region from each of the second block regions; A block image corresponding to the first block area is obtained according to the first image and each of the second images.
4. The image processing method according to claim 3, characterized in that: The relative position of the first image in the first block area is the same as the relative position of the second image in the second block area.
5. The image processing method according to claim 1, characterized in that: In the step of replacing the image of at least one sub-region of a first block region among the at least two block regions with the image of a sub-region of a second block region, at least one sub-region of the first block region is a sub-region adjacent to another block region.
6. The image processing method according to claim 1 or 5, characterized in that: The step of replacing the image of at least one sub-region of the first block region among the at least two block regions with the image of the sub-region of the second block region comprises: Replacing the image of at least one sub-region of the first sub-region of the at least two sub-regions with images of one or more sub-regions of the second sub-region; and / or, The image of at least one sub-region of the first block region among the at least two block regions is replaced with the images of one or more sub-regions of the second block region.
7. The image processing method according to claim 1, characterized in that: The block images corresponding to the first block areas are obtained by splitting and reassembling the image to be processed.
8. An image processing device, characterized in that: include: An image division module, used for dividing the image to be processed into at least two block areas; Divide each of the block areas into at least two sub-areas, wherein the at least two block areas include a plurality of area sets, each area set includes at least two block areas, and each block area in the same area set is divided into sub-areas in the same manner; an image recombining module, which is in communication with the image dividing module and is used to replace an image of at least one sub-region of a first block region of the at least two block regions with an image of a sub-region of a second block region, to obtain a block image corresponding to the first block region, wherein the first block region and the second block region are the same region set; An image processing module, which is in communication with the image recombining module and is used to perform image processing on the block images corresponding to the first block areas to obtain target images corresponding to the first block areas; The target image corresponding to the image to be processed is obtained according to the target image corresponding to each of the first block areas.
9. An electronic device, characterized in that: The electronic device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the steps in the image processing method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a plurality of instructions, characterized in that: The instructions are used for execution by a controller to implement the image processing method according to any one of claims 1 to 7.
