Image processing method and device, electronic equipment, storage medium and program product
By performing color channel rearrangement and frequency domain conversion of JPEG compression algorithm on RAW images, the problems of low lossy compression quality and large lossless compression space are solved, and efficient storage and transmission of high-quality images are achieved.
Patent Information
- Application Number
- CN202510528354.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-08-01
AI Technical Summary
When the prior art performs lossy compression of RAW images, the image quality is low, and the storage space after lossless compression occupies a large amount, making it difficult to reduce the storage space while ensuring image quality.
After the color channel rearrangement of the RAW image, the JPEG compression algorithm is used to convert the image from the spatial domain to the frequency domain, reducing the quantization operation of high-frequency signals, realizing lossy compression, and restoring the initial position information during the decompression process.
It improves the quality of compressed images, reduces storage space usage, improves image recognition and display effects, and is suitable for scenarios such as environmental perception and object detection.
Smart Images

Figure CN120416488A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technologies, and in particular, to an image processing method, apparatus, electronic device, storage medium, and program product. Background Art
[0002] Currently, when an image is stored inside an electronic device, the electronic device usually performs a compression operation on the image to reduce the size of the storage space occupied by the image during storage. Compression algorithms generally include two categories: lossless compression algorithms and lossy compression algorithms (such as the joint photographic experts group (JPEG) compression algorithm). Among them, the compression ratio of the lossless compression algorithm (that is, the ratio of the storage space of the compressed image to the storage space of the original image before compression) is limited, and the storage space occupied by the compressed image is still relatively large. Therefore, the requirements for storage resources are relatively high. The lossy compression algorithm has a high compression efficiency, but it will cause the loss of information (such as color information, etc.) in the compressed image, thereby resulting in a relatively low image quality.
[0003] Classified by type, images can be divided into raw (RAW) images, red, green, blue (RGB) images, and luminance chrominance (YUV) images. Taking the image as a RAW image as an example, if an electronic device wants to perform lossy compression on the RAW image (for example, using the JPEG compression algorithm), it usually needs to convert the RAW image into a YUV image, and then perform a compression operation on the YUV image based on the JPEG compression algorithm. Since some image information is lost during the process of converting the RAW image into a YUV image, and image information is also lost during the process of using the JPEG compression algorithm for the YUV image, this method will further reduce the quality of the compressed image. In addition, if the electronic device directly performs lossy compression on the RAW image based on the JPEG algorithm, the compressed image will be severely distorted and the image quality will also be relatively low.
[0004] Therefore, how to directly perform a compression operation on a RAW image based on a lossy compression algorithm and ensure the quality of the compressed image is a technical problem that urgently needs to be solved. Summary of the Invention
[0005] Embodiments of this application provide an image processing method, apparatus, electronic device, storage medium, and program product.
[0006] In a first aspect, the present application provides an image processing method, which is applied to an electronic device. The method includes: obtaining an initial image, where the initial image includes a first preset number of pixel combinations, each pixel combination includes a second preset number of pixel points, and each pixel point in the pixel combination corresponds to a color channel; performing a first rearrangement operation on the pixel points in each pixel combination according to the color channel corresponding to each pixel point respectively, to obtain a first image, where the first image includes a third preset number of pixel regions, and the pixel points in each pixel region correspond to a color channel; performing a compression operation on the first image based on a preset compression algorithm to obtain a target image.
[0007] In this method, each pixel region corresponds to a color channel. When the electronic device successively converts each 8*8 pixel combination of the first image from the spatial domain to the frequency domain based on a lossy compression algorithm (such as the JPEG compression algorithm), the transition between the pixel points in each 8*8 pixel combination is relatively smooth (for example, all pixel points in the 8*8 pixel combination correspond to the red channel, so that the difference in pixel values between the pixel points is small). Therefore, compared with the method of directly compressing the initial image based on the JPEG compression algorithm, there are fewer high-frequency signals in the frequency domain in this method, so that fewer high-frequency signals are deleted in the quantization operation, and the image quality of the target image obtained after compression is higher.
[0008] In a possible implementation of the first aspect, each pixel combination corresponds to a fourth preset number of color channels, and the fourth preset number of color channels includes: a red channel, a first green channel, a second green channel, and a blue channel; and, for any one pixel combination, the first pixel point and the second pixel point in any one pixel combination are located in different rows and different columns, where the first pixel point corresponds to the first green channel and the second pixel point corresponds to the second green channel.
[0009] It can be understood that if the initial image is stored in the Bayer array format, and the Bayer array format uses 2*2 pixel combinations and the color channel distribution is RGGB, then the color channels corresponding to each pixel combination include the above-mentioned red channel (R), first green channel (G), second green channel (G), and blue channel (B). It can be understood that the fourth preset number is 4 at this time.
[0010] In a possible implementation of the first aspect, the preset compression algorithm includes the JPEG compression algorithm, and the JPEG compression algorithm is applied to the electronic device.
[0011] In a possible implementation of the first aspect, performing a compression operation on the first image based on a preset compression algorithm to obtain a target image includes: based on the JPEG compression algorithm, taking the pixel value of each pixel point in the first image as the luminance component in the YUV image, and performing a compression operation on the first image to obtain a target image.
[0012] During the process of performing a compression operation on the first image based on the JPEG compression algorithm, the first image can be compressed as an image in the YUV400 format to obtain a target image. Since an image in the YUV400 format means that the image only includes the luminance component (i.e., the Y component) and does not include the chrominance components (i.e., the U component and the V component), therefore, the above process of compressing the first image as an image in the YUV400 format means that the pixel value of each pixel point in the first image is used as the luminance component in the YUV image, and a compression operation is performed on the first image.
[0013] It can be understood that during the process of performing lossy compression on the first image based on the JPEG compression algorithm, the relationship between the quality of the target image and the occupied storage space (or the file size of the target image) can be balanced by changing the quantization coefficient. Compared with the method of performing lossless compression on the original image, this method can dynamically adjust the quality of the target image and the file size of the target image, and the compression method is more flexible and controllable.
[0014] In a possible implementation of the first aspect, the original image further includes the original position information corresponding to each pixel point, and the method further includes: performing a decompression operation on the target image to obtain a second image including a fifth preset number of pixel regions, where the pixel values of each pixel point in the second image are different from those in the first image; for each pixel point in the second image, performing a second rearrangement operation according to the original position information to obtain a third image, where the current position information of each pixel point in the third image is the same as the original position information.
[0015] It can be understood that based on the foregoing, the image processing method provided in this application can reduce the storage space occupied by the target image while ensuring that the quality of the obtained target image is relatively high. When the quality of the target image in this application is relatively high, the quality of the third image obtained after performing the decompression operation and the second rearrangement operation on the target image is also relatively high. In this way, when the third image is used to perform related tasks in scenarios such as environmental perception, target detection, image restoration, image recognition, sensor calibration, and map generation, the execution accuracy of the task can be improved. For example, if the third image is a decompressed traffic light image, then when the third image is used to determine whether it is possible to pass through the current intersection in the image recognition scenario of assisted driving, the third image with relatively high quality can improve the accuracy of the determination.
[0016] In addition, if the third image is displayed on the display screen of an electronic device, then the user's visual experience of the third image will also be improved.
[0017] In a possible implementation of the first aspect, the initial image is acquired by an image sensor of a vehicle, and the initial image is used to perform one or more of the following tasks: environmental perception, target detection, image restoration, image recognition, sensor calibration, map generation.
[0018] In a second aspect, the present application provides an image processing apparatus, which includes: an acquisition unit for acquiring an initial image, the initial image including a first preset number of pixel combinations, each pixel combination including a second preset number of pixel points, and each pixel point in the pixel combination corresponding to a color channel; a rearrangement unit for performing a first rearrangement operation on the pixel points in each pixel combination according to the color channel corresponding to each pixel point respectively to obtain a first image, the first image including a third preset number of pixel regions, and the pixel points within each pixel region corresponding to a color channel; a compression unit for performing a compression operation on the first image based on a preset compression algorithm to obtain a target image.
[0019] In a possible implementation of the second aspect, the preset compression algorithm includes a JPEG compression algorithm, and the compression unit includes a JPEG compression unit.
[0020] Among them, the JPEG compression unit can also be referred to as a JPEG processing unit, a JPEG encoder, or a JPEG processor. The JPEG compression unit can be used to perform a compression operation on the first image based on the JPEG compression algorithm to obtain a target image. It can be understood that the process of the JPEG compression unit performing a compression operation on the first image can also be understood as the process of the JPEG compression unit encoding the first image.
[0021] In a third aspect, the present application provides an electronic device, which includes: one or more processors; one or more memories; one or more programs are stored in one or more memories, and when the one or more programs are executed by the one or more processors, the electronic device is caused to execute the image processing method of the first aspect and any possible implementation of the first aspect.
[0022] In a fourth aspect, the present application provides a readable storage medium, on which instructions are stored, and when the instructions are executed on an electronic device, the electronic device is caused to execute the image processing method of the first aspect and any possible implementation of the first aspect.
[0023] In a fifth aspect, the present application provides a computer program product, which includes: instructions, and when the instructions run on an electronic device, the electronic device is caused to execute the image processing method of the first aspect and any possible implementation of the first aspect.
[0024] Among them, the beneficial effects of the second aspect to the fifth aspect can be referred to the beneficial effects of the first aspect and any possible implementation of the first aspect, and will not be elaborated here. Description of the Drawings
[0025] Figure 1 According to some embodiments of the present application, a schematic structural diagram of at least a part of a RAW image is shown;
[0026] Figure 2 According to some embodiments of the present application, a schematic flowchart of an image processing method is shown;
[0027] Figure 3 According to some embodiments of the present application, a schematic structural diagram of a part of a first image obtained after a first rearrangement operation on an initial image is shown;
[0028] Figure 4 According to some embodiments of the present application, a schematic flowchart of decompressing and restoring a target image is shown;
[0029] Figure 5 According to some embodiments of the present application, a schematic structural diagram of an image processing apparatus 500 is shown;
[0030] Figure 6 According to some embodiments of the present application, a schematic hardware structure diagram of an electronic device 100 is shown. Detailed Description of the Embodiments
[0031] Illustrative embodiments of the present application include, but are not limited to, image processing methods, apparatuses, electronic devices, storage media, and program products.
[0032] It can be understood that the electronic devices to which the image processing method provided by the embodiments of the present application is applicable may include, but are not limited to, mobile phones, smart TVs, wearable devices, tablets (Pads), computers with wireless transceiver functions, virtual reality (VR) devices, augmented reality (AR) devices, wireless devices in industrial control, wireless devices in assisted driving, wireless devices in remote medical surgery, wireless devices in smart grids, wireless devices in transportation safety, wireless devices in smart cities, wireless devices in smart homes, etc. The embodiments of the present application do not limit the types of electronic devices.
[0033] First, the proprietary terms involved in the embodiments of the present application will be explained below.
[0034] RAW Image: An image of raw data directly obtained by an image sensor of an electronic device, without any compression or color processing. A RAW image usually has the format of a Bayer filter array (Bayer array). In a RAW image with this format, each pixel corresponds to only one color channel among red (R), green (G), and blue (B), that is, each pixel has (or records) a pixel value of only one color among red, green, and blue. It can be understood that a color channel is a channel for recording image color information. Taking the red channel as an example, this channel is used to record the red information (such as the pixel value) of the corresponding pixel (for example, the pixel corresponding to the red channel is called a red pixel).
[0035] Among them, the Bayer array is an array with a periodic arrangement of red, green, and blue filters. The red, green, and blue filters cover the photosensitive pixels on the image sensor of the electronic device, and only one color filter covers each photosensitive pixel. A photosensitive pixel is a physical unit on the image sensor, used to capture light of one color (such as red, green, or blue) and convert the optical signal into an electrical signal to obtain a pixel value. It can be understood that if a red filter covers a photosensitive pixel of the image sensor, then in the obtained RAW image, the pixel corresponding to this photosensitive pixel has a pixel value representing the red channel.
[0036] It can be understood that a common pattern of the Bayer array is red, green, green, blue (RGGB), that is, in a 2*2 pixel combination, it includes: one red filter, two green filters, and one blue filter. Among them, the green filters are located at the intersection of each row and each column, and the red filter and the blue filter are respectively located at the other two positions of the 2*2 pixel combination. In this way, the pixels at the intersection of each row and each column in the 2*2 pixel combination have green pixel values, and the pixels at the other two positions of the 2*2 pixel combination have red and blue pixel values respectively.
[0037] Figure 1 Shows a partial structural schematic diagram of a RAW image. As Figure 1 shown, taking the format of the RAW image as the RGGB format as an example, the RAW image includes but is not limited to Figure 1 the 16*16 pixels shown. As Figure 1 shown, in each 2*2 pixel combination, the pixels at the lower left corner and the upper right corner correspond to the green channels (for example, the pixel at the upper right corner corresponds to the first green channel, and the pixel at the lower left corner corresponds to the second green channel), the pixel at the upper left corner corresponds to the red channel, and the pixel at the lower right corner corresponds to the blue channel.
[0038] It can be understood that since the RAW image includes the original data of all pixel points, it occupies a large storage space. In addition, RAW images are usually not directly used for display, but need to be converted into a standard image format such as a Red-Green-Blue (RGB) image through a demosaicing algorithm for display.
[0039] Red-Green-Blue (RGB) image: Obtained by performing a demosaicing algorithm on a RAW image, each pixel point corresponds to three color channels of red, green, and blue, that is, each pixel point has pixel values of red, green, and blue. The RGB image can be directly displayed on the display screen of an electronic device, and the RGB image can be converted into a Luminance-Chrominance (YUV) image.
[0040] Luminance-Chrominance (YUV) image: A color space image that separates and represents the luminance information (Y) and chrominance information (U, V) of an image. The YUV image includes three components of Y, U, and V. Among them, the Y component is used to represent the brightness information of the image. The U component is used to represent the difference between the blue component and the Y component (i.e., U = B - Y). The V component is used to represent the difference between the red component and the Y component (i.e., V = R - Y). Among them, the resolution of the human eye for luminance information is much higher than that for chrominance information. Therefore, the human eye is more sensitive to the Y component and relatively less sensitive to the U and V components. This characteristic of the YUV image allows an electronic device to perform a lossy compression algorithm based on the YUV image. In addition, the YUV image can be converted into an RGB image.
[0041] Lossless compression algorithm: Used for lossless compression of images (usually RAW images). The lossless compression algorithm achieves the compression purpose by reducing redundant data in the image, so that all the original data information in the image can be retained. However, the compression ratio of this compression algorithm is limited, resulting in the compressed image still occupying a large storage space, which is not conducive to storage space management. Common lossless compression algorithms include: Portable Network Graphics (PNG) compression algorithm, Tagged Image File Format (TIFF) compression algorithm, Digital Negative (DNG) compression algorithm, and so on.
[0042] Lossy compression algorithm: Achieves higher compression efficiency by deleting some details and redundant information in the image data, and the deleted data cannot be restored during the lossy compression process. The common lossy compression algorithm is the Joint Photographic Experts Group (JPEG) compression algorithm. This algorithm is used for lossy compression of images (usually YUV images), reduces the storage space occupied by the image by sacrificing information that the human eye is not sensitive to, and at the same time ensures relatively high image quality.
[0043] When performing lossy compression on a YUV image based on the JPEG compression algorithm, an electronic device can transform the pixel values of the pixel points in each 8×8 pixel combination in the YUV image from the spatial domain to the frequency domain, and separate the low-frequency signal and the high-frequency signal. Since the human eye is less sensitive to high-frequency signals and more sensitive to low-frequency signals, after separating the low-frequency signal and the high-frequency signal, the electronic device can perform quantization operations on the low-frequency signal and the high-frequency signal to retain more low-frequency signals and delete more high-frequency signals. Therefore, the JPEG compression algorithm can make the compressed YUV image not only not affect the user's visual experience but also occupy less storage space.
[0044] It can be understood that if an electronic device performs lossy compression on a RAW image based on a lossy compression algorithm (such as the JPEG compression algorithm), it usually needs to convert the RAW image into a YUV image and then perform lossy compression on the YUV image based on the JPEG compression algorithm. However, some image information will be lost during the process of converting the RAW image into a YUV image, and image information will also be lost when performing lossy compression on the YUV image based on the JPEG compression algorithm. Therefore, the quality of the compressed image obtained in this way is relatively low.
[0045] In addition, if directly performing lossy compression on a RAW image based on the JPEG compression algorithm, Figure 1 for example, when the electronic device successively transforms each 8×8 pixel combination from the spatial domain to the frequency domain, since the pixel points corresponding to the red channel (such as Figure 1 the pixel point in the first row and the first column in Figure 1 ), the pixel points corresponding to the green channel (such as Figure 1 the pixel point in the first row and the second column in
[0046] Figure 1 ), and the pixel points corresponding to the blue channel (such as Figure 1 the pixel point in the second row and the second column in
[0046] are arranged at intervals, and the transition between each pixel point is not smooth (for example, the pixel value difference between the pixel point corresponding to the red channel and the pixel point corresponding to the green channel is relatively large), there will be more high-frequency signals in the frequency domain of each 8×8 pixel combination. During the subsequent quantization operation process, these high-frequency signals will be deleted, resulting in serious information loss in the compressed image, that is, serious distortion, affecting the quality of the compressed image.Based on this, the present application provides an image compression method. In this method, an electronic device can obtain an initial image (i.e., a RAW image) including a first preset number of pixel combinations, each pixel combination includes a second preset number of pixel points, and each pixel point corresponds to a color channel. For the pixel points in each pixel combination, a first rearrangement operation is performed according to the color channel corresponding to each pixel point respectively, to obtain a first image including a third preset number of pixel regions, and the pixel points in each pixel region correspond to a color channel. Then, a compression operation is performed on the first image based on a preset compression algorithm (such as the JPEG compression algorithm) to obtain a target image.
[0047] In this method, each pixel region corresponds to a color channel. When the electronic device sequentially converts each 8×8 pixel combination (or called a pixel block) of the first image from the spatial domain to the frequency domain based on the JPEG compression algorithm, the transition between the pixel points in each 8×8 pixel combination is relatively smooth (for example, all the pixel points in the 8×8 pixel combination correspond to the red channel, so that the difference in pixel values between the pixel points is small). Therefore, compared with the method of directly compressing the initial image based on the JPEG compression algorithm, there are fewer high-frequency signals in the frequency domain in this method, so that fewer high-frequency signals are deleted in the quantization operation, and the image quality of the target image obtained after compression is higher.
[0048] In addition, it can be understood that if the YUV image is compressed based on the JPEG compression algorithm, some image information will be lost during the conversion of the RAW image to the YUV image, and image information will also be lost during the lossy compression of the YUV image based on the JPEG compression algorithm.
[0049] For example, in the field of assisted driving, when an electronic device identifies the color information of traffic lights in an image to perform an assisted driving task, the RAW image (i.e., the traffic light image) obtained by the electronic device contains more and richer image information (such as color information, etc.). Some image information will be lost during the conversion of the RAW image to the YUV image (such as through the chrominance subsampling process), and some image information will be further lost during the lossy compression of the YUV image. Therefore, the compressed traffic light image has less image information and lower image quality. In this case, if the electronic device uses a related model (such as a traffic light recognition model for identifying traffic light color information) to perform image recognition based on the compressed traffic light image, due to the low quality of the compressed traffic light image, it may lead to incorrect recognition of traffic light color information, resulting in low accuracy of traffic light color information recognition, and further reducing the execution efficiency of the assisted driving task.
[0050] In the method provided by this application, the electronic device can directly perform lossy compression on the initial image based on the JPEG compression algorithm. Therefore, compared with the method of compressing the YUV image based on the JPEG compression algorithm, the target image in the method of this application loses less image information compared to the initial image, thereby making the quality of the target image obtained by this application higher.
[0051] Continuing with the example of the assisted driving task described above, if the image processing method provided by this application is adopted, the image quality of the compressed traffic light image obtained by the electronic device is relatively high, making the recognition accuracy of the traffic light color information relatively high, and further making the execution efficiency of the assisted driving task relatively high.
[0052] In addition, if lossless compression is performed on the initial image, due to the limited compression ratio of lossless compression, the storage space occupied by the compressed image is still relatively large, which is not conducive to the storage and transmission of the compressed image. In the method provided by this application, the electronic device can directly perform lossy compression on the initial image based on the JPEG compression algorithm. Compared with the method of performing lossless compression on the initial image, in the method of this application, the storage space occupied by the compressed target image is smaller, and it is easier to store and transmit the target image.
[0053] Therefore, the image processing method provided by this application can reduce the storage space occupied by the target image while ensuring relatively high quality of the obtained target image.
[0054] The following describes in detail the image processing method provided by this application with reference to the accompanying drawings. Figure 2 A schematic flowchart of an image processing method provided by this application is shown. Figure 2 The execution subject of each step in the shown process is the electronic device. For the sake of convenience of description, the execution subject of each step will not be repeatedly described hereinafter when introducing Figure 2 each step in the shown process. As Figure 2 shown, the method includes but is not limited to the following solutions:
[0055] S201: Obtain an initial image, where the initial image includes a first preset number of pixel combinations, each pixel combination includes a second preset number of pixel points, and each pixel point in the pixel combination corresponds to a color channel.
[0056] In this application, the initial image can be the RAW image involved above. The embodiments of this application do not limit the first preset number of pixel combinations (or called pixel blocks) included in the initial image. In some embodiments, the first preset number can be determined based on the resolution of the initial image and the second preset number.
[0057] Among them, taking the initial image in this application having a Bayer array format as an example, the second preset quantity is determined based on the Bayer array format. It can be understood that different Bayer array formats correspond to repeating units (i.e., pixel combinations) of different sizes, and thus correspond to different second preset quantities. For example, the Bayer array format can adopt a 2*2 pixel combination, a 4*4 pixel combination, a 6*6 pixel combination, and so on. Taking the Bayer array format adopting a 2*2 pixel combination as an example, at this time each pixel combination includes 4 pixel points, that is, the second preset quantity is 4. Similarly, if the Bayer array format adopts a 4*4 pixel combination, the second preset quantity is 16 at this time.
[0058] It can be understood that when the second preset quantity is determined, the first preset quantity of the pixel combination can be determined based on the resolution of the initial image and the second preset quantity. Specifically, the resolution of the initial image can determine the total number of pixel points included in the initial image, and the quotient of the total number of pixel points and the second preset quantity is the first preset quantity.
[0059] Taking the resolution of the initial image as 3840*2160 as an example, at this time the total number of pixel points included in the initial image is the product of 3840 and 2160, that is, 8294400. If the second preset quantity is 4, then the number of pixel combinations included in this initial image is 2073600. That is to say, the initial image with a resolution of 3840*2160 includes 2073600 (as an example of the first preset quantity) pixel combinations, and each pixel combination includes 4 (as an example of the second preset quantity) pixel points.
[0060] In addition, each pixel combination corresponds to a fourth preset quantity of color channels. Since each pixel point in the initial image corresponds to one color channel, in this case, the fourth preset quantity and the second preset quantity are the same, that is, each pixel combination corresponds to the second preset quantity of color channels. It can be understood that taking the Bayer array format adopting a 2*2 pixel combination and the color channel distribution being RGGB as an example, the color channels in this application are divided into four types, namely the red channel, the first green channel, the second green channel, and the blue channel. Among them, both the first green channel and the second green channel belong to the green channel.
[0061] Taking Figure 1For example, the pixel at the first row and the first column, the pixel at the first row and the second column, the pixel at the second row and the first column, and the pixel at the second row and the second column form a pixel combination, that is, this pixel combination includes 4 pixels. Among them, the pixel at the first row and the first column corresponds to the red channel (R), the pixel at the first row and the second column (as an example of the first pixel) corresponds to the first green channel (G), the pixel at the second row and the first column (as an example of the second pixel) corresponds to the second green channel (G), and the pixel at the second row and the second column corresponds to the blue channel (B).
[0062] As can be seen from the above example, the first green channel and the second green channel are located in different rows and different columns in the pixel combination of the initial image.
[0063] In some examples, each pixel in the initial image corresponds to a color channel representation, and each pixel in the initial image has a pixel value corresponding to the color channel. Taking a certain pixel corresponding to the red channel as an example, then this pixel has a pixel value representing the red channel, and this pixel can also be called a red pixel.
[0064] The embodiments of the present application do not limit the acquisition method of the initial image. In some embodiments, taking the electronic device as a smart phone as an example, the initial image can be collected by the image sensor in the smart phone. Taking the electronic device as a vehicle (such as an assisted driving vehicle, etc.) as an example, the initial image can be collected by the image sensor in the vehicle. Taking the electronic device as an industrial electronic device as an example, the initial image can be collected by an industrial image sensor.
[0065] If the initial image is collected by the image sensor in the smart phone, the initial image can be applied to scenarios such as image beautification, image restoration, and image synthesis. If the initial image is collected by the image sensor in the vehicle, the initial image can be applied to scenarios such as environmental perception, target detection, image restoration, image recognition, sensor calibration, and map generation. If the initial image is collected by an industrial sensor, the initial image can be applied to scenarios such as defect detection, target tracking, and morphology reconstruction.
[0066] S202: For the pixels in each pixel combination, perform a first rearrangement operation according to the color channel corresponding to each pixel respectively, to obtain a first image. The first image includes a third preset number of pixel regions, and the pixels in each pixel region correspond to one color channel.
[0067] Adopting a 2×2 pixel combination in Bayer array format, and the color channel distribution being RGGB, that is, taking the 4 pixel points in each pixel combination corresponding to the red channel, the first green channel, the second green channel, and the blue channel as an example, the electronic device can rearrange the pixel points corresponding to the red channel in each pixel combination to a pixel area (hereinafter referred to as the first pixel area), rearrange the pixel points corresponding to the first green channel in each pixel combination to a pixel area (hereinafter referred to as the second pixel area), rearrange the pixel points corresponding to the second green channel in each pixel combination to a pixel area (hereinafter referred to as the third pixel area), and rearrange the pixel points corresponding to the blue channel in each pixel combination to a pixel area (hereinafter referred to as the fourth pixel area). In this way, the first image obtained after performing the first rearrangement operation includes 4 (as an example of the third preset quantity) pixel areas, and the pixel points in each pixel area correspond to the red channel, the first green channel, the second green channel, and the blue channel respectively. It can be understood that the third preset quantity and the second preset quantity in this application can be the same.
[0068] Taking Figure 1 at least part of the initial image shown as an example, Figure 1 performing the first rearrangement operation on at least part of the initial image shown, the at least part of the first image obtained can be as Figure 3 shown. In Figure 3 , the pixel points in the first pixel area (that is, the area composed of all pixel points from the first row and the first column to the eighth row and the eighth column) correspond to the red channel, the pixel points in the second pixel area (that is, the area composed of all pixel points from the first row and the ninth column to the eighth row and the sixteenth column) correspond to the first green channel, the pixel points in the third pixel area (that is, the area composed of all pixel points from the ninth row and the first column to the sixteenth row and the eighth column) correspond to the second green channel, and the pixel points in the fourth pixel area (that is, the area composed of all pixel points from the ninth row and the ninth column to the sixteenth row and the sixteenth column) correspond to the blue channel.
[0069] S203: Performing a compression operation on the first image based on a preset compression algorithm to obtain a target image.
[0070] The embodiments of this application do not limit the type of the preset compression algorithm. The preset compression algorithm can be any lossy compression algorithm, for example, it can be the JPEG compression algorithm. In this case, the JPEG compression algorithm can be applied to the electronic device. That is to say, the electronic device can perform a compression operation on the first image based on the JPEG compression algorithm to obtain a target image. Among them, the process of the electronic device performing a compression operation on the first image based on the JPEG compression algorithm can also be understood as the process of encoding the first image based on the JPEG compression algorithm.
[0071] During the process of performing a compression operation on the first image based on the JPEG compression algorithm, the first image can be compressed as an image in the YUV400 format to obtain the target image. It can be understood that since an image in the YUV400 format only includes the luminance component (i.e., the Y component) and does not include the chrominance components (i.e., the U component and the V component), therefore, the above process of compressing the first image as an image in the YUV400 format means that the pixel value of each pixel point in the first image is used as the luminance component in the YUV image, and a compression operation is performed on the first image.
[0072] It can be understood that whether the electronic device performs compression processing on a YUV image or on the first image (i.e., the RAW image) in this application based on the JPEG compression algorithm, the relevant processing logics are the same. The compression process of the first image will be described below.
[0073] Exemplarily, the electronic device can perform a discrete cosine transform (DCT) on each 8*8 pixel combination in the first image to convert the spatial domain signal (the pixel value corresponding to each pixel point in the 8*8 pixel combination) into a frequency domain signal, so that the high-frequency signal (or called high-frequency component) and the low-frequency signal (or called low-frequency component) can be separated. Among them, the high-frequency signal usually represents the detailed information of the pixel points in the 8*8 pixel combination, and the low-frequency signal usually represents the contour information of the pixel points in the 8*8 pixel combination.
[0074] Since the human eye is less sensitive to high-frequency signals and more sensitive to low-frequency signals, therefore, after the electronic device performs the DCT operation to separate the low-frequency signal and the high-frequency signal, a quantization operation can be performed on the low-frequency signal and the high-frequency signal. In some embodiments, the electronic device can use the quantization coefficients (or called JPEG compression parameters) in the default quantization table to divide the high-frequency signal or the low-frequency signal corresponding to each pixel point in the first image by the quantization coefficient of the corresponding pixel point in the default quantization table to obtain the first image after the quantization operation, that is, the target image. The electronic device can store and transmit the target image in the standard JPEG format, which has higher compatibility.
[0075] In this lossy compression process, the high-frequency signals are largely deleted and more low-frequency signals are retained. Since the human eye is less sensitive to high-frequency signals and more sensitive to low-frequency signals, therefore, this compression method can reduce the storage space occupied by the target object without affecting the user's visual experience of the target image. In addition, this method performs lossy compression on the first image based on the JPEG compression method, and the format of the obtained target image is also the standard JPEG format, making this method easy to implement and integrate in the current image processing system (or module) for processing images.
[0076] In addition, during the process of lossy compression of the first image based on the JPEG compression algorithm, the relationship between the quality of the target image and the storage space occupied (or the file size of the target image) can be balanced by changing the quantization coefficient. Compared with the method of performing lossless compression on the original image, this method can dynamically adjust the relationship between the quality of the target image and the file size of the target image, and the compression method is more flexible and controllable.
[0077] It can be understood that each pixel region corresponds to a color channel. When the electronic device successively converts each 8×8 pixel combination of the first image from the spatial domain to the frequency domain based on the JPEG compression algorithm, the transition between the pixel points in each 8×8 pixel combination is relatively smooth (for example, each pixel point in the 8×8 pixel combination corresponds to the red channel, so that the difference in pixel values between the pixel points is small). Therefore, compared with the method of directly compressing the original image based on the JPEG compression algorithm, there are fewer high-frequency signals in the frequency domain in this method, so that fewer high-frequency signals are deleted during the quantization operation, and the image quality of the target image obtained after compression is higher.
[0078] It can be understood that if the YUV image is compressed based on the JPEG compression algorithm, some image information will be lost during the process of converting the original image into the YUV image, and image information will also be lost when the YUV image is lossily compressed based on the JPEG compression algorithm. In the method provided in this application, the electronic device can directly perform lossy compression on the original image based on the JPEG compression algorithm. Therefore, compared with the method of compressing the YUV image based on the JPEG compression algorithm, the target image in the method of this application loses less image information compared with the original image, and thus the quality of the target image obtained in this application is higher.
[0079] It can be understood that if lossless compression is performed on the original image, due to the limited compression ratio of lossless compression, the storage space occupied by the compressed image is still relatively large, which is not conducive to the storage and transmission of the compressed image. In the method provided in this application, the electronic device can directly perform lossy compression on the original image based on the JPEG compression algorithm. Compared with the method of performing lossless compression on the original image, in the method of this application, the storage space occupied by the target image obtained after compression is smaller, and it is easier to store and transmit the target image.
[0080] Therefore, the image processing method provided in this application can reduce the storage space occupied by the target image while ensuring that the quality of the obtained target image is relatively high.
[0081] In some other embodiments, after the electronic device performs a compression operation on the first image to obtain a target image, it can also perform a decompression operation on the target image and restore the image according to the initial position corresponding to the pixel points.
[0082] Figure 4 A schematic flow diagram of decompressing and restoring a target image is shown. As Figure 4 described, the method includes the following processes.
[0083] S401: Perform a decompression operation on the target image to obtain a second image including a fifth preset number of pixel regions, where the pixel values of each pixel point in the second image are different from those in the first image.
[0084] In some embodiments, the electronic device may perform a decompression operation on the target image based on a JPEG processing unit. For example, perform an inverse quantization operation on the target image, and then perform an inverse discrete cosine transform to obtain the second image. It can be understood that since the loss of image information during the JPEG compression process is irreversible, therefore, the pixel values of each pixel point in the second image obtained after decompressing the target image are different from those in the first image. However, the fifth preset number of pixel regions included in the second image may be the same as the third preset number of pixel regions included in the first image. In addition, the color channels corresponding to the pixel regions included in the second image may also be the same as the color channels corresponding to the pixel regions included in the first image. Specifically, as Figure 3 shown.
[0085] S402: For each pixel point in the second image, perform a second rearrangement operation according to the initial position information to obtain a third image, where the current position information of each pixel point in the third image is the same as the initial position information.
[0086] In some embodiments, after the electronic device obtains the second image, it is also necessary to restore the position of each pixel point. It can be understood that the initial image may include the initial position information corresponding to each pixel point. Taking Figure 1 as an example, Figure 1 the initial position information corresponding to pixel point A in Figure 3 may be the first row and the third column. In the first image shown in Figure 3 , pixel point A undergoes a first rearrangement operation, and the position information changes from the first row and the third column to the first row and the second column. Therefore, in this step, the electronic device may perform a second rearrangement operation on the basis of the second image according to the initial position information of each pixel point to obtain a third image. Among them, the current position information of each pixel point in the third image is the same as the initial position information of each pixel point in the initial image.
[0087] Continuing with pixel point A as an example, the electronic device may make pixel point A re-locate in the first row and the third column in the third image. That is to say, the electronic device makes the current position information of pixel point A in the third image the same as the initial position information of pixel point A in the initial image.
[0088] It can be understood that since the image processing method provided in this application can reduce the storage space occupied by the target image while ensuring a relatively high quality of the obtained target image, therefore, when the quality of the target image in this application is relatively high, the quality of the third image obtained after performing the decompression operation and the second rearrangement operation on the target image is also relatively high. Thus, when the third image is used to perform related tasks in scenarios such as environmental perception, target detection, image restoration, image recognition, sensor calibration, and map generation, the execution accuracy of the tasks can be improved. For example, the third image can be a decompressed traffic light image. Then, when the third image is used to determine whether it is possible to pass through the current intersection in the image recognition scenario of assisted driving, the third image with relatively high quality can improve the accuracy of the determination.
[0089] In addition, if the third image is displayed on the display screen of the electronic device, the visual experience of the user for the third image will also be improved.
[0090] Next, the relationship between the quality and the compression ratio of the target image obtained by using the method provided in this application will be described through examples.
[0091] In some embodiments, the electronic device can input an initial image with a resolution of 3840*2160 and a bit depth of 12 bits (i.e., the pixel information corresponding to each pixel is 12 bits) as a YUV400 image into the JPEG encoder. Among them, the JPEG encoder supports the input of YUV400 images with a bit depth of 12 bits, and the JPEG encoder can be a chip for image encoding. The specific model of the JPEG encoder is not limited in the embodiments of this application.
[0092] In some embodiments, the peak signal-to-noise ratio (PSNR) and the structural similarity index measure (SSIM) can be used as the image quality evaluation indicators of the obtained target image.
[0093] Among them, PSNR is calculated based on the mean square error (MSE) and represents the ratio of the maximum possible value of the signal to the noise. PSNR considers the pixel value differences and ignores the structure and perceptual characteristics of the image. PSNR is usually in decibels (dB) as the unit, and the higher the PSNR value, the better the image quality. SSIM is based on the human visual perception effect and considers the brightness, contrast, and structural information, etc. between the initial image and the target image to determine the local contrast and structural similarity between the two images. The SSIM value is usually represented by a proportional value between 0 and 1, and the closer the SSIM value is to 1, the better the image quality.
[0094] Among them, the relationship between the image quality setting and the corresponding compression ratio can be seen in Table 1 below.
[0095] Table 1:
[0096] Coded Image Quality Setting PSNR SSIM Compression Ratio 30 41.59dB 0.7835 9.60% 50 43.39dB 0.8431 13.41% 80 48.54dB 0.9374 21.86% 100 64.71dB 0.9981 32.57%
[0097] As shown in Table 1, when the coded image quality setting is 100, the PSNR value of the obtained target image is 64.71 dB, and the SSIM value is 0.9981, indicating that the quality of the actually obtained target image is relatively high, and the quality of the target image is very close to that of the initial image, and the human eye can hardly perceive the distortion. At this time, the compression ratio is 32.57%, and the size of the storage space occupied by the target image is close to 1 / 3 of the size of the storage space occupied by the initial image, and the compression effect is good.
[0098] Continuing as shown in Table 1, as the coded image quality setting decreases, the quality of the obtained target image also decreases. For example, both the PSNR value and the SSIM value decrease, but the compression ratio gradually decreases, indicating that the storage space occupied by the target image is reduced. Therefore, in practical applications, the quality and compression ratio of the target image can be balanced according to actual needs.
[0099] In some embodiments, as Figure 5 shown, the embodiment of the present application further provides an image processing apparatus 500, and the image processing apparatus 500 includes an acquisition unit 501, a rearrangement unit 502, and a compression unit 503.
[0100] Among them, the acquisition unit 501 is used to acquire an initial image, and the initial image includes a first preset number of pixel combinations, each pixel combination includes a second preset number of pixel points, and each pixel point in the pixel combination corresponds to a color channel.
[0101] Among them, the initial image is acquired by an image sensor of a vehicle, and the initial image is used to perform one or more of the following tasks: environmental perception, target detection, image restoration, image recognition, sensor calibration, map generation.
[0102] In addition, each pixel combination corresponds to a fourth preset number of color channels, and the fourth preset number of color channels includes: a red channel, a first green channel, a second green channel, and a blue channel; and for any one pixel combination, the first pixel point and the second pixel point in any one pixel combination are located in different rows and different columns, where the first pixel point corresponds to the first green channel and the second pixel point corresponds to the second green channel.
[0103] The rearrangement unit 502 is used to perform a first rearrangement operation on the pixel points in each pixel combination according to the color channels respectively corresponding to each pixel point, so as to obtain a first image. The first image includes a third preset number of pixel regions, and the pixel points in each pixel region correspond to one color channel.
[0104] The compression unit 503 is used to perform a compression operation on the first image based on a preset compression algorithm to obtain a target image.
[0105] In some embodiments, the preset compression algorithm includes the JPEG compression algorithm. In this case, the compression unit 503 can be a JPEG compression unit.
[0106] When the compression unit 503 is a JPEG compression unit, the compression unit 503 is used to use the pixel value of each pixel point in the first image as the luminance component in the YUV image, and perform a compression operation on the first image to obtain a target image based on the JPEG compression algorithm.
[0107] It can be understood that since the JPEG compression unit defaults to perform lossy compression on the YUV image, in the embodiments of the present application, the electronic device can send an instruction to the JPEG compression unit, instructing the JPEG compression unit to compress the first image as an image in the YUV400 format. Since the image in the YUV400 format indicates that the image only includes the luminance component (i.e., the Y component) and does not include the chrominance components (i.e., the U component and the V component), this instruction instructs the JPEG compression unit to use the pixel value of each pixel point in the first image as the luminance component in the YUV image and perform a compression operation on the first image.
[0108] Among them, the JPEG compression unit can also be called a JPEG processing unit, a JPEG encoder or a JPEG processor. The process of the JPEG compression unit performing a compression operation on the first image based on the JPEG compression algorithm can also be understood as the process of encoding the first image based on the JPEG compression unit.
[0109] In some embodiments, the initial image further includes the initial position information respectively corresponding to each pixel point, and the compression unit 503 is further used to perform a decompression operation on the target image to obtain a second image including a fifth preset number of pixel regions. The pixel values of each pixel point in the second image and the first image are different.
[0110] The rearrangement unit 502 is further used to perform a second rearrangement operation on each pixel point in the second image according to the initial position information to obtain a third image, and the current position information of each pixel point in the third image is the same as the initial position information.
[0111] In some embodiments, the embodiments of the present application further provide a readable storage medium, on which instructions are stored, and when the instructions are executed on an electronic device, the electronic device executes the image processing method described in the above embodiments.
[0112] In some embodiments, the embodiments of the present application further provide a computer program product, including: instructions, when the instructions run on an electronic device, the electronic device implements the image processing method described in the above embodiments.
[0113] In some embodiments, the embodiments of the present application further provide an electronic device, which includes: one or more processors; one or more memories; one or more programs are stored in one or more memories, and when the one or more programs are executed by the one or more processors, the electronic device executes the image processing method described in the above embodiments.
[0114] Figure 6 According to some embodiments of the present application, a schematic structural diagram of an electronic device 100 is shown. As Figure 6 shown, the electronic device 100 includes one or more processors 101, a system memory 102, a non-volatile memory (NVM) 103, a communication interface 104, an input / output (I / O) device 105, and a system control logic unit 106.
[0115] Among them: The processor 101 may include one or more processing units. For example, a JPEG processor (JPU), a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processor (DSP), a microprocessor (MCU), an artificial intelligence (AI) processor, or a processing module or processing circuit of a field programmable gate array (FPGA).
[0116] The system memory 102 is a volatile memory, such as a random-access memory (RAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), etc. The system memory 102 is used to temporarily store data and / or instructions. For example, in some embodiments, the system memory 102 can be used to store the relevant instructions for the above image processing method, etc.
[0117] The non-volatile memory 103 can include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. In some embodiments, the non-volatile memory 103 can include any suitable non-volatile memory such as flash memory and / or any suitable non-volatile storage device, such as a hard disk drive (HDD), a compact disc (CD), a digital versatile disc (DVD), a solid-state drive (SSD), etc. In some embodiments, the non-volatile memory 103 can also be a removable storage medium, such as a secure digital (SD) memory card, etc.
[0118] Specifically, the system memory 102 and the non-volatile memory 103 can respectively include: a temporary copy and a permanent copy of the instruction 107. The instruction 107 can include: instructions that cause the electronic device 100 to implement the method as Figure 2 and Figure 4 shown when executed by at least one of the processors 101.
[0119] The communication interface 104 can include a transceiver for providing a wired or wireless communication interface for the electronic device 100, and then communicating with any other suitable device through one or more networks. In some embodiments, the communication interface 104 can be integrated into other components of the electronic device 100. For example, the communication interface 104 can be integrated into the processor 101. In some embodiments, the electronic device 100 can communicate with other devices through the communication interface 104.
[0120] The input / output (I / O) device 105 can include input devices such as a keyboard, a mouse, etc., and output devices such as a display, etc. The user can interact with the electronic device 100 through the input / output (I / O) device 105.
[0121] The system control logic unit 106 may include any suitable interface controller to provide any suitable interface to other modules of the electronic device 100. For example, in some embodiments, the system control logic unit 106 may include one or more memory controllers to provide an interface to the system memory 102 and the non-volatile memory 103.
[0122] In some embodiments, at least one of the processors 101 may be logically encapsulated with one or more controllers for the system control logic unit 106 to form a system in package (SiP). In some other embodiments, at least one of the processors 101 may also be integrated with the logic of one or more controllers for the system control logic unit 106 on the same chip to form a system-on-chip (SoC).
[0123] It can be understood that Figure 6 The structure of the illustrated electronic device 100 is only an example. In some other embodiments, the electronic device 100 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0124] It can be understood that, as used herein, the term "module" may refer to or include an application-specific integrated circuit (ASIC), an electronic circuit, a processor (shared, dedicated, or grouped) that executes one or more software or firmware programs, and / or a memory, combinational logic circuits, and / or other suitable hardware components that provide the described functionality, or may be a part of these hardware components.
[0125] It can be understood that in various embodiments of the present application, the processor may be a microprocessor, a digital signal processor, a microcontroller, etc., and / or any combination thereof. According to another aspect, the processor may be a single-core processor, a multi-core processor, etc., and / or any combination thereof.
[0126] The various embodiments disclosed in the present application may be implemented in hardware, software, firmware, or a combination of these implementation methods. The embodiments of the present application may be implemented as a computer program or program code executed on a programmable system, which includes at least one processor, a storage system (including volatile and non-volatile memories and / or storage elements), at least one input device, and at least one output device.
[0127] Program code can be applied to the input instructions to perform the various functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.
[0128] The program code can be implemented in a high-level procedural language or an object-oriented programming language in order to communicate with the processing system. When necessary, the program code can also be implemented in assembly language or machine language. In fact, the mechanisms described in this application are not limited to the scope of any particular programming language. In any case, the language can be a compiled language or an interpreted language.
[0129] In some cases, the disclosed embodiments can be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments can also be implemented as instructions carried or stored on one or more transient or non-transient machine-readable (e.g., computer-readable) storage media, which can be read and executed by one or more processors. For example, the instructions can be distributed via a network or via other computer-readable media. Thus, a machine-readable medium can include any mechanism for storing or transmitting information in a machine (e.g., computer) readable form, including but not limited to, a floppy disk, a compact disc, a CD-ROM, a magneto-optical disc, a ROM, a RAM, an EPROM, an EEPROM, a magnetic or optical card, a flash memory, or a tangible machine-readable memory for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) in electrical, optical, acoustic, or other forms via the Internet. Thus, a machine-readable medium includes any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine (e.g., computer) readable form.
[0130] In the accompanying drawings, some structural or method features may be shown in a particular arrangement and / or order. However, it should be understood that such a particular arrangement and / or ordering may not be required. Instead, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. Additionally, the inclusion of a structural or method feature in a particular figure does not imply that such a feature is required in all embodiments, and in some embodiments, these features may not be included or may be combined with other features.
[0131] It should be noted that each unit / module mentioned in the device embodiments of the present application is a logical unit / module. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or can be implemented as a combination of multiple physical units / module. The physical implementation manner of these logical units / modules themselves is not the most important. The combination of the functions implemented by these logical units / modules is the key to solving the technical problems proposed in the present application. In addition, to highlight the innovative part of the present application, the above device embodiments of the present application do not introduce units / modules that are not closely related to solving the technical problems proposed in the present application. This does not mean that there are no other units / modules in the above device embodiments.
[0132] It should be noted that in the examples and descriptions of the present application, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one" does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.
[0133] Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, those of ordinary skill in the art should understand that various changes can be made in form and detail without departing from the scope of the present application.
Claims
1. An image processing method, characterized in that, Applied to an electronic device, the method includes: Obtain an initial image, the initial image including a first preset number of pixel combinations, each of the pixel combinations including a second preset number of pixel points, and each pixel point in the pixel combination corresponding to a color channel; For the pixel points in each of the pixel combinations, perform a first rearrangement operation according to the color channel corresponding to each pixel point respectively, to obtain a first image, the first image including a third preset number of pixel regions, and the pixel points in each pixel region corresponding to one of the color channels; Perform a compression operation on the first image based on a preset compression algorithm to obtain a target image.
2. The method according to claim 1, characterized in that, Each of the pixel combinations corresponds to a fourth preset number of color channels, the fourth preset number of color channels including: a red channel, a first green channel, a second green channel, and a blue channel; and, For any one of the pixel combinations, the first pixel point and the second pixel point in any one of the pixel combinations are located in different rows and different columns, wherein the first pixel point corresponds to the first green channel and the second pixel point corresponds to the second green channel.
3. The method according to claim 1, wherein The preset compression algorithm includes the JPEG compression algorithm, and the JPEG compression algorithm is applied to the electronic device.
4. The method according to claim 3, wherein The performing a compression operation on the first image based on a preset compression algorithm to obtain a target image includes: Based on the JPEG compression algorithm, use the pixel value of each pixel point in the first image as the luminance component in a YUV image, and perform a compression operation on the first image to obtain the target image.
5. The method according to any one of claims 1 to 4, characterized in that The initial image further includes the initial position information corresponding to each pixel point respectively, and the method further includes: Perform a decompression operation on the target image to obtain a second image including a fifth preset number of pixel regions, and the pixel values of each pixel point in the second image and the first image are different; For each pixel point in the second image, perform a second rearrangement operation according to the initial position information to obtain a third image, and the current position information of each pixel point in the third image is the same as the initial position information.
6. An image processing apparatus, characterized in that, The image processing device includes: An obtaining unit, configured to obtain an initial image, the initial image including a first preset number of pixel combinations, each of the pixel combinations including a second preset number of pixel points, and each pixel point in the pixel combination corresponding to a color channel; A rearrangement unit, configured to perform a first rearrangement operation on the pixel points in each of the pixel combinations according to the color channel corresponding to each pixel point respectively, to obtain a first image, the first image including a third preset number of pixel regions, and the pixel points in each pixel region corresponding to one of the color channels; A compression unit, configured to perform a compression operation on the first image based on a preset compression algorithm to obtain a target image.
7. The device according to claim 6, characterized in that, The preset compression algorithm includes the JPEG compression algorithm, and the compression unit includes a JPEG compression unit.
8. An electronic device, characterized in that, Including: One or more processors; One or more memories; the one or more memories store one or more programs, which when executed by the one or more processors, cause the electronic device to perform the image processing method according to any one of claims 1 to 5.
9. A readable storage medium, characterized in that, Instructions are stored on the readable storage medium, which when executed on an electronic device cause the electronic device to perform the image processing method according to any one of claims 1 to 5.
10. A computer program product, characterized in that, Comprising: Instructions, which when running on an electronic device, cause the electronic device to perform the image processing method according to any one of claims 1 to 5.