Image pixel bit depth compression method and system
By performing pixel value marking and RegionGrow area generation method recovery during the 10-bit image to 8-bit process, the problems of image detail loss and dynamic range reduction in the prior art are solved, efficient image pixel bit depth compression is achieved, and the original image is retained The dynamic range and details improve storage efficiency.
Patent Information
- Application Number
- CN202411145573.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-12-13
AI Technical Summary
When the prior art converts 10-bit images into 8-bit, effective bit information is usually lost, resulting in image details loss or dynamic range reduction, and the dynamic range and details of the original high-deep image cannot be effectively retained.
By receiving the CMOS sensor image data line by line, we judge whether the pixel value exceeds 255, and mark it. The RegionGrow area generation method is used to obtain the area where the pixel value is compressed into a high 8-bit data to recover the pixel value to ensure that no effective bit information is lost.
It realizes the dynamic range and details of the original high-deep image during the 10-bit to 8-bit process, maximizes the preservation of original CMOS image details, has higher storage efficiency, can record larger image or video data, and reduces the memory rate requirements.
Smart Images

Figure CN119135911A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image compression, and in particular relates to an image pixel bit depth compression method and system. Background Art
[0002] The output image of a high-speed CMOS sensor is generally 10-bit or 12-bit, but storage generally uses 8-bit. The workflow of a high-speed camera is: image acquisition -> data storage -> data export -> image post-processing.
[0003] The main reasons for converting 10-bit to 8-bit storage are as follows: First, regardless of DDR or FLASH memory, its memory architecture is based on bytes (8 bits), and converting to 8-bit storage has the highest storage efficiency, and the same storage space can record longer videos; second, after converting 10-bit to 8-bit, the total image bandwidth is also reduced by 20%, which can reduce the speed requirements for the memory and reduce costs. It can also be said that the same bandwidth can support a higher frame rate, which is beneficial to improving the performance of high-speed cameras.
[0004] There are generally three methods to convert the traditional pixel depth of 10bit to 8bit:
[0005] Method 1 is to directly take the high 8 bits of 10 bits and discard the low 2 bits of data, which means sacrificing valid bit information and losing some image details, which can be regarded as lossy compression.
[0006] Method 2 is to intercept the lower 8 bits of 10 bits. When the data is greater than 255, it is clamped to 255. This sacrifices the dynamic range of the image to achieve the purpose of retaining the lower valid bit information (image details). At this time, the dynamic range of 8 bits is only one-fourth of the original 10 bits.
[0007] Method three is to use a LUT lookup table to convert the bit width, that is, to find the corresponding 8-bit numerical output based on the input 10-bit pixel value. This method has the same problem of losing valid bit information as method 3.
[0008] In view of the shortcomings of the existing technology, there is an urgent need for an image pixel bit depth compression method and system to solve the above problems. Summary of the invention
[0009] In order to solve the above-mentioned deficiencies in the prior art, the purpose of the present invention is to overcome the existing deficiencies and provide an image pixel bit depth compression method, the method comprising the following steps:
[0010] (1) Image compression process:
[0011] Receive image data sent by the CMOS sensor line by line and store it in the FPGA;
[0012] Determine whether any pixel value of the received image data exceeds 255, if the pixel value does not exceed 255, store the lower 8-bit data; if the pixel value exceeds 255, store the higher 8-bit data, mark the pixel position where the pixel value jumps from less than 255 to more than 255 and / or the pixel position where the pixel value jumps from more than 255 to less than 255, obtain the marking point, and realize image data compression;
[0013] (2) Image decompression process
[0014] Obtain compressed image data frame by frame. For each frame of image, obtain pixel values based on the marker points and compress them into pixel areas with high 8-bit data.
[0015] For the pixel area whose pixel value is compressed to take the high 8-bit data, the pixel value recovery process is performed;
[0016] Get the decompressed image.
[0017] As a further optimization of the above solution, marking a pixel position where a pixel value jumps from no more than 255 to a pixel value exceeding 255 and / or a pixel position where a pixel value jumps from more than 255 to a pixel value not exceeding 255 includes:
[0018] For a pixel position that jumps from a pixel value not exceeding 255 to a pixel value exceeding 255, the previous pixel whose pixel value does not exceed 255 is marked.
[0019] As a further optimization of the above solution, the compressed image data is obtained frame by frame, and for each frame of the image, the pixel value is obtained based on the marker point and compressed into a pixel area with high 8 bits of data, including:
[0020] Based on the marker points, the RegionGrow region generation method is used to obtain pixel values that are compressed into pixel areas with high 8-bit data.
[0021] As a further optimization of the above solution, the pixel value recovery process for the pixel area whose pixel value is compressed to take the high 8-bit data includes:
[0022] A mask image is generated based on the region generated by the RegionGrow region generation method, wherein the mask image is consistent with the original image in width and height, and the pixels correspond one to one. The pixel values of the region generated by the RegionGrow region generation method in the mask image are l1-l2, wherein l1 is the number of bits of the real pixel value of the pixel with a pixel value exceeding 255, l2 is the number of bits of the pixel value after the pixel value exceeds 255 is compressed, and the pixel values of the remaining positions in the mask image are 1;
[0023] The mask image is multiplied pixel by pixel with the original compressed image to complete the pixel value recovery process and obtain the decompressed image.
[0024] As a further optimization of the above solution, marking a pixel position where a pixel value jumps from no more than 255 to a pixel value exceeding 255 and / or a pixel position where a pixel value jumps from more than 255 to a pixel value not exceeding 255 includes:
[0025] For a pixel position that jumps from a pixel value not exceeding 255 to a pixel value exceeding 255, the previous pixel whose pixel value does not exceed 255 is marked;
[0026] And for a pixel position that jumps from a pixel value exceeding 255 to a pixel value not exceeding 255, the next pixel whose pixel value is not exceeding 255 is marked.
[0027] As a further optimization of the above scheme, the labeling method comprises:
[0028] The pixel value of the current pixel is compared with the previous pixel to see if it exceeds 255. If the two pixel values are inconsistent, the pixel with a pixel value not exceeding 255 is used as the marking point.
[0029] As a further optimization of the above solution, the compressed image data is obtained frame by frame, and for each frame of the image, the pixel value is obtained based on the marker point and compressed into a pixel area with high 8 bits of data, including:
[0030] Based on each row of pixels, the marking points in each row are obtained. The pixels between the first marking point and the second marking point in each row are the row pixel area whose pixel values are compressed to the high 8-bit data. The pixels between the third marking point and the fourth marking point in each row are the row pixel area whose pixel values are compressed to the high 8-bit data. And so on. The pixels between each two marking points are the row pixel area whose pixel values are compressed to the high 8-bit data.
[0031] Based on the obtained pixel values, the pixel area in the original image whose pixel values are compressed to the high 8 bits of data is obtained.
[0032] As a further optimization of the above solution, the pixel value recovery process for the pixel area whose pixel value is compressed to take the high 8-bit data includes:
[0033] For the pixel area whose pixel value is compressed to take the high 8-bit data, the pixel value is multiplied by l1-l2, that is, l1-8 times, to realize the decompression process of the compressed pixel area.
[0034] As a further optimization of the above solution, the marking method of the marking point is: setting the pixel value to 0.
[0035] The present invention also discloses an image pixel bit depth compression system, comprising a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, they are used to implement the image pixel bit depth compression method as described in any of the above items.
[0036] The present invention adopts the above technical solution, which has the following beneficial effects compared with the prior art:
[0037] 1. The present invention provides an image pixel bit depth compression method, which is mainly used to solve the drawbacks of traditional pixel bit depth compression. Based on the technical solution disclosed in the present invention, through the operations of bit depth interception and image post-processing recovery, the dynamic range of the original high bit depth image is retained, and the image details are retained without losing effective bit information.
[0038] 2. The technical solution designed based on the present invention can maximize the retention of the original CMOS image details, that is, retain all valid bits. Compared with the traditional direct interception solution, the technology of the present invention completely retains the effective details of the original image and is more conducive to the recovery of the original image after compression.
[0039] 3. The 10-bit to 8-bit technical method designed by the present invention applies pixel value detection to respectively store the corresponding bit depth, and the compression is reasonable. Compared with the traditional scheme, the method designed by the present invention has higher storage efficiency. Under the same storage space, the present invention can record larger image or video data, and the required bandwidth is also effectively reduced, thereby reducing the rate requirement for the memory. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
[0041] Figure 1 It is a schematic diagram of the process of the present invention;
[0042] Figure 2 A schematic diagram of an embodiment of generating marking points of the present invention;
[0043] Figure 3 The image to be processed is generated according to the radiation generated pixel area and boundary of the present invention;
[0044] Figure 4 It is a high bit-depth image restored and generated according to low bit-depth compression in the present invention. DETAILED DESCRIPTION
[0045] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0046] like Figure 1-4 As shown, an embodiment of the present invention discloses a method for compressing image pixel bit depth, including the following:
[0047] (1) Image compression process:
[0048] Receive image data sent by the CMOS sensor line by line and store it in the FPGA;
[0049] Determine whether any pixel value of the received image data exceeds 255, if the pixel value does not exceed 255, store the lower 8-bit data; if the pixel value exceeds 255, store the higher 8-bit data, mark the pixel position where the pixel value jumps from less than 255 to more than 255 and / or the pixel position where the pixel value jumps from more than 255 to less than 255, obtain the marking point, and realize image data compression;
[0050] (2) Image decompression process
[0051] Obtain compressed image data frame by frame. For each frame of image, obtain pixel values based on the marker points and compress them into pixel areas with high 8-bit data.
[0052] For the pixel area whose pixel value is compressed to take the high 8-bit data, the pixel value recovery process is performed;
[0053] Get the decompressed image.
[0054] It can be understood that during the compression process, for pixels with values lower than 255, the lower 8-bit data is stored. This 8-bit data is the original pixel value of the pixel without data compression. When decompressing later, the original pixel value can be obtained by directly reading this 8-bit data. For pixels with values greater than 255, the higher 8-bit data is stored, which is equivalent to compressing the original pixel by 2. l1-l2 times, where l1 is the number of bits of the real pixel value of the pixel with a pixel value exceeding 255, and l2 is the number of bits of the pixel value after the pixel value exceeds 255 is compressed. In this embodiment, l2=8.
[0055] In the decompression process, the compressed pixel area is obtained based on the marking point in the present application, and the compressed pixel area is decompressed to obtain the image data sent by the original CMOS sensor. The present invention provides an image pixel bit depth compression method, which is mainly used to solve the drawbacks of traditional pixel bit depth compression. Based on the technical solution disclosed in the present invention, the dynamic range of the original high bit depth image is retained, and the image details are retained without losing effective bit information through the operations of bit depth interception and image post-processing recovery.
[0056] There are multiple implementation methods for marking and decompressing pixels, which are described below with reference to Embodiment 1 and Embodiment 2, respectively.
[0057] Embodiment 1:
[0058] Marking a pixel position that jumps from a pixel value not exceeding 255 to a pixel value exceeding 255 and / or a pixel position that jumps from a pixel value exceeding 255 to a pixel value not exceeding 255 includes:
[0059] For a pixel position that jumps from a pixel value not exceeding 255 to a pixel value exceeding 255, the previous pixel whose pixel value does not exceed 255 is marked.
[0060] See also Figure 2 , the point pointed by the arrow is the marking point. It should be noted that, for example, pixel A and pixel B are adjacent to each other, the pixel value of the previous pixel A does not exceed 255, and the pixel value of the next pixel B exceeds 255, for this jump, pixel A is marked as a marking point.
[0061] Specifically, the compressed image data is obtained frame by frame. For each frame of the image, the pixel values are obtained based on the marker points and compressed into a pixel area with high 8 bits of data, including:
[0062] Based on the marker points, the RegionGrow region generation method is used to obtain pixel values that are compressed into pixel areas with high 8-bit data.
[0063] More specifically, in the embodiment of the present application, firstly, a marking point is selected on the image, and then this point is used as the starting point to radiate to the right, bottom and left to form a region. Initially, the growth region has only one seed point, the marking point, and then the surrounding points are continuously merged into the growth region, provided that the difference between the value of the point and the value of the boundary point of the growth region is less than a specified threshold; when the growth region can no longer expand, the algorithm stops.
[0064] Specifically, for a pixel area whose pixel value is compressed to take high 8-bit data, a pixel value recovery process is performed, including:
[0065] A mask image is generated based on the region generation method of RegionGrow, wherein the mask image is consistent with the original image in width and height, and the pixels correspond one to one. The pixel value of the region generated by the RegionGrow region generation method in the mask image is l1-l2, wherein l1 is the number of bits of the real pixel value of the pixel with a pixel value exceeding 255, l2 is the number of bits of the pixel value after the pixel value exceeds 255 is compressed, and the pixel value of the remaining positions in the mask image is 1; in this embodiment, l2=8;
[0066] The mask image is multiplied pixel by pixel with the original compressed image to complete the pixel value recovery process and obtain the decompressed image.
[0067] like Figure 3 As shown, specifically, the mask image is consistent with the original image in width and height, and the pixels correspond one to one. For the region generated by the RegionGrow region generation method, the pixel values of the corresponding region in the mask image are set to l1-l2 (i.e. l1-8, i.e. the multiple of the pixel being compressed), and the pixel values of the remaining regions in the mask image are set to 1. When the mask image is multiplied pixel by pixel with the original compressed image, the pixels in the compressed region are reversely amplified by the same compression multiple, and the compressed pixels are decompressed. See the figure below, for the original pixel bit number l1 of 10, the compression process is compressed to 8 bits, and the pixel value of the compressed region in the generated mask image is 2 10-8 =4, and the pixel value of the remaining area is 1.
[0068] Embodiment 2:
[0069] Marking a pixel position that jumps from a pixel value not exceeding 255 to a pixel value exceeding 255 and / or a pixel position that jumps from a pixel value exceeding 255 to a pixel value not exceeding 255 includes:
[0070] For a pixel position that jumps from a pixel value not exceeding 255 to a pixel value exceeding 255, the previous pixel whose pixel value does not exceed 255 is marked;
[0071] And for a pixel position that jumps from a pixel value exceeding 255 to a pixel value not exceeding 255, the next pixel whose pixel value is not exceeding 255 is marked.
[0072] Specifically, the above-mentioned marking method includes:
[0073] The pixel value of the current pixel is compared with the previous pixel to see if it exceeds 255. If the two pixel values are inconsistent, the pixel with a pixel value not exceeding 255 is used as the marking point.
[0074] Specifically, if there are four pixels A, B, C, and D in a row, if the pixel value of A does not exceed 255, the pixel values of B and C exceed 255, and the pixel value of D does not exceed 255, then the result of the pixel value of A exceeding 255 is inconsistent with the result of the pixel value of B exceeding 255, and the pixel of A is used as the marking point. If the result of the pixel value of C exceeding 255 is inconsistent with the result of the pixel value of D exceeding 255, the pixel of D is used as the marking point. The marking method in this embodiment refers to Figure 4 The pixels at both ends of each row of the compressed area are used as marking points. The marking method in this embodiment is applicable to the case where there is one or more compressed areas in an image.
[0075] The present invention provides a method for generating marking points from image data. Specifically, based on the order in which FPGA receives CMOS image data and stores them from left to right in rows, in each row of data, the left and right endpoints of each segment of pixels exceeding the 255 threshold are set as marking points: in the pixel segment constructed by the pixel points whose pixel values exceed 255, the current pixel is compared with the previous pixel to see whether it exceeds the 255 threshold. If the two pixels exceed 255 in different situations, the current point is set as the marking point. The technical solution designed based on the present invention can maximize the retention of the original CMOS image details, that is, retain all valid bits. Compared with the traditional direct interception solution, the technology of the present invention completely retains the effective details of the original image, which is more conducive to the recovery of the original image after compression.
[0076] Specifically, the compressed image data is obtained frame by frame. For each frame of the image, the pixel values are obtained based on the marker points and compressed into a pixel area with high 8 bits of data, including:
[0077] Based on each row of pixels, the marking points in each row are obtained. The pixels between the first marking point and the second marking point in each row are the row pixel area whose pixel values are compressed to the high 8-bit data. The pixels between the third marking point and the fourth marking point in each row are the row pixel area whose pixel values are compressed to the high 8-bit data. And so on. The pixels between each two marking points are the row pixel area whose pixel values are compressed to the high 8-bit data.
[0078] Based on the obtained pixel values, the pixel area in the original image whose pixel values are compressed to the high 8 bits of data is obtained.
[0079] More specifically, in this embodiment, during the compression process, both ends of each row of the compressed area where the pixel values are compressed to 8-bit data are marked. During decompression, the pixel area in the original image where the pixel values are compressed to high 8-bit data is obtained based on the marked points at both ends of each row.
[0080] Specifically, for a pixel area whose pixel value is compressed to take high 8-bit data, a pixel value recovery process is performed, including:
[0081] For the pixel area whose pixel value is compressed to take the high 8-bit data, the pixel value is multiplied by l1-l2, that is, l1-8 times, to realize the decompression process of the compressed pixel area.
[0082] For example, the image data sent by the original CMOS sensor has l1=10, which is compressed to 8 bits. In this decompression process, the pixel value is multiplied by 2. 10-8 =4 times to restore the compressed pixels.
[0083] The image pixel bit depth compression method designed in the embodiment of the present invention can be applied to various compression methods for compressing the original pixel bit depth l1 to l2 bit depth (l1>l2), such as 10-bit to 8-bit compression and 12-bit to 8-bit compression. The compression is reasonable. Compared with the traditional scheme, the method designed in the present invention has higher storage efficiency. Under the same storage space, the present invention can record larger image or video data, and the required bandwidth is also effectively reduced, thereby reducing the rate requirement for the memory.
[0084] It should be noted that, in the above embodiment, the marking method of the marking point is: setting the pixel value to 0.
[0085] It should be noted that the technical means for implementing an image pixel bit depth compression system in another embodiment of the present invention is the same as that of an image pixel bit depth compression method, and thus will not be described in detail herein.
[0086] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with the technical features with similar functions disclosed in this application (but not limited to) by each other.
Claims
1. A method for compressing image pixel bit depth, characterized in that: The method comprises the following: (1) Image compression process: Receive image data sent by the CMOS sensor line by line and store it in the FPGA; Determine whether any pixel value of the received image data exceeds 255, if the pixel value does not exceed 255, store the lower 8-bit data; if the pixel value exceeds 255, store the higher 8-bit data, mark the pixel position where the pixel value jumps from less than 255 to more than 255 and / or the pixel position where the pixel value jumps from more than 255 to less than 255, obtain the marking point, and realize image data compression; (2) Image decompression process: Obtain compressed image data frame by frame. For each frame of image, obtain pixel values based on the marker points and compress them into pixel areas with high 8-bit data. For the pixel area whose pixel value is compressed to take the high 8-bit data, the pixel value recovery process is performed; Get the decompressed image.
2. The method for compressing image pixel bit depth according to claim 1, characterized in that: The marking of a pixel position where a pixel value jumps from no more than 255 to a pixel value exceeding 255 and / or a pixel position where a pixel value jumps from more than 255 to a pixel value no more than 255 includes: For a pixel position that jumps from a pixel value not exceeding 255 to a pixel value exceeding 255, the previous pixel whose pixel value does not exceed 255 is marked.
3. The method for compressing image pixel bit depth according to claim 2, characterized in that: The compressed image data is obtained frame by frame, and for each frame of the image, a pixel area whose pixel value is compressed into high 8-bit data is obtained based on the marking point, including: Based on the marker points, the RegionGrow region generation method is used to obtain pixel values that are compressed into pixel areas with high 8-bit data.
4. The method for compressing image pixel bit depth according to claim 3, characterized in that: The pixel value recovery process for the pixel area whose pixel value is compressed to take the high 8-bit data includes: A mask image is generated based on the region generated by the RegionGrow region generation method, wherein the mask image is consistent with the original image in width and height, and the pixels correspond one to one. The pixel values of the region generated by the RegionGrow region generation method in the mask image are l1-l2, wherein l1 is the number of bits of the real pixel value of the pixel with a pixel value exceeding 255, l2 is the number of bits of the pixel value after the pixel value exceeds 255 is compressed, and the pixel values of the remaining positions in the mask image are 1; The mask image is multiplied pixel by pixel with the original compressed image to complete the pixel value recovery process and obtain the decompressed image.
5. The method for compressing image pixel bit depth according to claim 1, characterized in that: The marking of a pixel position where a pixel value jumps from no more than 255 to a pixel value exceeding 255 and / or a pixel position where a pixel value jumps from more than 255 to a pixel value no more than 255 includes: For a pixel position that jumps from a pixel value not exceeding 255 to a pixel value exceeding 255, the previous pixel whose pixel value does not exceed 255 is marked; And for a pixel position that jumps from a pixel value exceeding 255 to a pixel value not exceeding 255, the next pixel whose pixel value is not exceeding 255 is marked.
6. The method for compressing image pixel bit depth according to claim 5, characterized in that: The marking method comprises: The pixel value of the current pixel is compared with the previous pixel to see if it exceeds 255. If the two pixel values are inconsistent, the pixel with a pixel value not exceeding 255 is used as the marking point.
7. The method for compressing image pixel bit depth according to claim 5, characterized in that: The compressed image data is obtained frame by frame, and for each frame of the image, a pixel area whose pixel value is compressed into high 8-bit data is obtained based on the marking point, including: Based on each row of pixels, the marking points in each row are obtained. The pixels between the first marking point and the second marking point in each row are the row pixel area whose pixel values are compressed to the high 8-bit data. The pixels between the third marking point and the fourth marking point in each row are the row pixel area whose pixel values are compressed to the high 8-bit data. And so on. The pixels between each two marking points are the row pixel area whose pixel values are compressed to the high 8-bit data. Based on the obtained pixel values, the pixel area in the original image whose pixel values are compressed to the high 8 bits of data is obtained.
8. The method for compressing image pixel bit depth according to claim 7, characterized in that: The pixel value recovery process for the pixel area whose pixel value is compressed to take the high 8-bit data includes: For the pixel area whose pixel value is compressed to take the high 8-bit data, the pixel value is multiplied by l1-l2, that is, l1-8 times, to realize the decompression process of the compressed pixel area.
9. The image pixel bit depth compression method according to any one of claims 1 to 8, characterized in that: The marking method of the marking point is: setting the pixel value to 0.
10. An image pixel bit depth compression system, characterized in that: The invention comprises a memory and one or more processors, wherein the memory stores executable codes, and when the one or more processors execute the executable codes, the method for compressing the image pixel bit depth described in any one of claims 1 to 9 is implemented.
