Image compression method, device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202210303660.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-24
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2042-03-24
AI Technical Summary
[0003]但是,本申请的发明人通过对现有技术进行实践发现,现有技术对数字图像进行压缩时,在提高数字图像的压缩效率的同时,会损伤压缩后图像的质量,使得压缩后图像的质量可靠性不高
[0060]本申请实施例提供了一种图像压缩方法、装置、电子设备和存储介质,可以获取对象的待压缩图像和深度图像;对待压缩图像进行对象检测处理,得到待压缩图像中的对象区域;利用深度图像和所述对象区域,对待压缩图像进行区域划分处理,得到多个具有不同信息量的待压缩图像区域;识别每个待压缩图像区域对应的压缩等级,以及压缩等级对应的图像压缩参数,其中,压缩等级表征待压缩图像区域包含的信息量的重要程度;针对每个待压缩图像区域,采用压缩等级对应的图像压缩参数对待压缩图像区域进行压缩处理,得到多个压缩后图像区域;将多个压缩后图像区域进行整合处理,得到压缩后图像,可以提高压缩后图像的质量可靠性。
Smart Images

Figure CN116847103B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and specifically to an image compression method, apparatus, electronic device, and storage medium. Background Technology
[0002] The 21st century is an information age, and images, as the visual foundation for human perception of the world, are a crucial means for acquiring, expressing, and transmitting information. With the continuous development of information technology, digital images have also experienced rapid growth. For example, humans can use digital images for identity verification. They can also share digital images using social media, and so on. However, digital images require a large amount of data to represent, so the storage space needed for a single frame is generally quite large. Directly transmitting digital images would overload computer equipment. Therefore, digital images need to be compressed before transmission to improve efficiency.
[0003] However, the inventors of this application have discovered through practical application of the prior art that while the prior art improves the compression efficiency of digital images, it also damages the quality of the compressed image, resulting in low reliability of the compressed image quality. Summary of the Invention
[0004] This application provides an image compression method, apparatus, electronic device, and storage medium, which can improve the quality and reliability of compressed images.
[0005] This application provides an image compression method, including:
[0006] Obtain the image to be compressed and the depth image of the object;
[0007] Object detection processing is performed on the image to be compressed to obtain the object regions in the image to be compressed;
[0008] Using the depth image and the object region, the image to be compressed is divided into regions to obtain multiple image regions with different information contents.
[0009] Identify the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level. The compression level represents the importance of the amount of information contained in the image region to be compressed.
[0010] For each image region to be compressed, the image compression parameters corresponding to the compression level are used to compress the image region to be compressed, resulting in multiple compressed image regions.
[0011] The multiple compressed image regions are integrated to obtain a compressed image.
[0012] Accordingly, embodiments of this application provide an image compression apparatus, including:
[0013] The acquisition unit is used to acquire the image to be compressed and the depth image of the object.
[0014] An object detection unit is used to perform object detection processing on the image to be compressed to obtain the object region in the image to be compressed.
[0015] The region segmentation unit is used to perform region segmentation processing on the image to be compressed using the depth image and the object region, to obtain multiple image regions to be compressed with different information contents;
[0016] The identification unit is used to identify the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level, wherein the compression level characterizes the importance of the amount of information contained in the image region to be compressed;
[0017] The compression unit is used to compress each image region to be compressed using image compression parameters corresponding to the compression level, resulting in multiple compressed image regions.
[0018] An integration unit is used to integrate the multiple compressed image regions to obtain a compressed image.
[0019] In one embodiment, the region division unit may include:
[0020] A region determination subunit is used to determine the depth object region corresponding to the object in the depth image based on the object region;
[0021] The region discrimination subunit is used to perform discrimination processing on the depth object region using a preset depth threshold to obtain the discrimination result;
[0022] The region segmentation subunit is used to divide the image to be compressed into multiple image regions with different information content based on the discrimination result and using the depth object region.
[0023] In one embodiment, the region discrimination subunit may include:
[0024] The first information extraction module is used to extract information from the depth object region to obtain pixel information corresponding to the depth object region;
[0025] The calculation module is used to calculate the depth distance information of the depth object region based on the pixel information;
[0026] The comparison module is used to compare the depth distance information with the preset depth threshold to obtain the discrimination result.
[0027] In one embodiment, the region partitioning subunit may include:
[0028] The logic operation module is used to perform logic operation processing based on the discrimination result, using the pixel information of the depth object region and the pixel information of the image to be compressed, to obtain the operation result;
[0029] The segmentation module is used to divide the image to be compressed into multiple image regions based on the calculation result;
[0030] The information recognition module is used to perform information recognition processing on each image region to be compressed, resulting in multiple image regions to be compressed with different amounts of information.
[0031] In one embodiment, the partitioning module may include:
[0032] The operation recognition submodule is used to recognize the operation results and obtain a set of operation result differences;
[0033] The first partitioning submodule is used to divide the object region into a first image region and a second image region based on the difference set of the calculation results.
[0034] The second segmentation submodule is used to segment a third image region in the image to be compressed based on the first image region and the second image region, thereby obtaining multiple image regions to be compressed.
[0035] In one embodiment, the region defining sub-unit may include:
[0036] The coordinate information recognition module is used to identify the coordinate information corresponding to the object area;
[0037] The region determination module is used to determine the initial depth object region corresponding to the object in the depth image using the coordinate information;
[0038] The refinement module is used to refine the initial depth object region to obtain the depth object region.
[0039] In one embodiment, the identification unit may include:
[0040] The information comparison subunit is used to compare the amount of information in each region of the image to be compressed and obtain the comparison result.
[0041] The sorting subunit is used to sort the information content of each image region to be compressed based on the comparison result, and obtain the sorting result;
[0042] The compression level determination subunit is used to determine the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level, based on the sorting results.
[0043] In one embodiment, the compression unit may include:
[0044] The parameter update subunit is used to update the preset parameters in the preset image compression logic according to the image compression parameters, so as to obtain the target image compression logic;
[0045] The compression subunit is used to compress the image region to be compressed based on the target image compression logic to obtain multiple compressed image regions.
[0046] In one embodiment, the compression subunit may include:
[0047] The second information extraction module is used to extract information from the image region to be compressed, and obtain the initial pixel information of the image region to be compressed.
[0048] The calculation module is used to perform calculations based on the target image compression logic, using the image compression parameters corresponding to the target image compression logic and the initial pixel information, to obtain the calculated pixel information.
[0049] The replacement module is used to replace the initial pixel information of the image region to be compressed with the processed pixel information to obtain the compressed image region.
[0050] In one embodiment, the acquisition unit may include:
[0051] The sub-unit is used to obtain the initial image to be compressed and the initial depth image of the object.
[0052] The parameter determination subunit is used to determine the first attribute parameter corresponding to the initial image to be compressed and the second attribute parameter of the initial depth image;
[0053] An alignment subunit is used to perform image alignment processing on the initial image to be compressed and the initial depth image based on the first attribute parameter and the second attribute parameter to obtain the image to be compressed and the depth image.
[0054] In one embodiment, the alignment subunit may include:
[0055] The transformation relationship calculation module is used to calculate the transformation relationship between the initial image to be compressed and the initial depth image based on the first attribute parameter and the second attribute parameter;
[0056] The third information extraction module is used to extract information from the initial image to be compressed and the initial depth image to obtain the pixel information corresponding to the initial image to be compressed and the pixel information corresponding to the initial depth image.
[0057] The conversion module is used to convert the pixel information corresponding to the initial image to be compressed and the pixel information corresponding to the initial depth image according to the conversion relationship, so as to obtain the image to be compressed and the depth image.
[0058] This application also provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various alternative embodiments described above.
[0059] Accordingly, embodiments of this application also provide a computer-readable storage medium storing instructions that, when executed by a processor, implement any of the image compression methods provided in embodiments of this application.
[0060] This application provides an image compression method, apparatus, electronic device, and storage medium, which can acquire an image of an object to be compressed and a depth image; perform object detection processing on the image to be compressed to obtain object regions in the image to be compressed; use the depth image and the object regions to perform region division processing on the image to be compressed to obtain multiple image regions to be compressed with different information contents; identify the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level, wherein the compression level characterizes the importance of the information contained in the image region to be compressed; for each image region to be compressed, use the image compression parameters corresponding to the compression level to compress the image region to be compressed to obtain multiple compressed image regions; integrate the multiple compressed image regions to obtain a compressed image, which can improve the quality and reliability of the compressed image. Attached Figure Description
[0061] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0062] Figure 1a This is a schematic diagram of a scenario for the image compression method provided in an embodiment of this application;
[0063] Figure 1b This is a flowchart of the image compression method provided in the embodiments of this application;
[0064] Figure 1c This is another scenario illustration of the image compression method provided in the embodiments of this application;
[0065] Figure 1d This is a schematic diagram of a scene using a tri-lens camera provided in an embodiment of this application;
[0066] Figure 1e This is a scene diagram of the object area provided in the embodiments of this application;
[0067] Figure 1f This is yet another schematic diagram of the image compression method provided in the embodiments of this application;
[0068] Figure 1g This is yet another schematic diagram of the image compression method provided in the embodiments of this application;
[0069] Figure 1h This is yet another schematic diagram of the image compression method provided in the embodiments of this application;
[0070] Figure 1i This is yet another schematic diagram of the image compression method provided in the embodiments of this application;
[0071] Figure 2 This is another flowchart of the image compression method provided in the embodiments of this application;
[0072] Figure 3 This is a schematic diagram of the image compression device provided in the embodiments of this application;
[0073] Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0074] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0075] This application provides an image compression method, apparatus, electronic device, and storage medium. Specifically, the image compression apparatus can be integrated into an electronic device, such as a terminal or server.
[0076] It is understood that the image compression method of this embodiment can be executed on a terminal, on a server, or jointly by a terminal and a server. The above examples should not be construed as limiting this application.
[0077] like Figure 1a As shown, taking the joint execution of an image compression method by a terminal and a server as an example, the image compression system provided in this application embodiment includes a terminal 10 and a server 11, etc.; the terminal 10 and the server 11 are connected via a network, such as a wired or wireless network, etc., wherein the image compression device can be integrated into the terminal 10.
[0078] Terminal 10 can be used to: acquire the image to be compressed and the depth image of the object; perform object detection processing on the image to be compressed to obtain the object region in the image to be compressed; use the depth image and the object region to perform region segmentation processing on the image to be compressed to obtain multiple image regions to be compressed with different information contents; identify the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level, wherein the compression level represents the importance of the information contained in the image region to be compressed; for each image region to be compressed, use the image compression parameters corresponding to the compression level to compress the image region to be compressed to obtain multiple compressed image regions; and integrate the multiple compressed image regions to obtain the compressed image.
[0079] Terminal 10 may include mobile phones, smart TVs, tablets, laptops, or personal computers (PCs). A client may also be configured on terminal 10, which could be an application client or a browser client, etc.
[0080] Terminal 10 can transmit the compressed image to server 11. Then, server 11 can decompress the compressed image and perform corresponding operations on the decompressed image.
[0081] The server 11 can be a single server, a server cluster, or a cloud server. For example, it can be an interoperability server between multiple heterogeneous systems, a backend server, an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, and big data and artificial intelligence platforms. As disclosed in the image compression method or apparatus of this application, multiple servers can form a blockchain, and the server is a node on the blockchain.
[0082] Furthermore, the step of generating image compression by the server 11 can also be performed by the terminal 10.
[0083] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the preferred order of the embodiments.
[0084] This embodiment will be described from the perspective of an image compression device, which can be integrated into an electronic device, such as a server or a terminal.
[0085] like Figure 1b As shown, the specific process of this image compression method can be as follows:
[0086] 101. Obtain the image to be compressed and the depth image of the object.
[0087] Depth images, also known as distance images, are images that use the distance from the image acquisition device to various points in the scene as pixel values. They directly reflect the geometry of the scene's surface. Depth images are obtained by using an infrared sensor to capture speckle-structured infrared light, and then using depth cells to analyze the speckle to create a depth map. In 3D computer graphics and computer vision, each pixel in a depth image represents the vertical distance between the depth camera surface and the plane of the object being photographed, typically represented by 16 bits, with the unit being millimeters.
[0088] The image to be compressed may include the image that needs to be compressed.
[0089] In one embodiment, the image to be compressed may include multiple different types of images. For example, the image to be compressed may include infrared images and color images. As another example, the image to be compressed may include infrared images, color images, and depth images, and so on.
[0090] In this context, the image to be compressed and the depth image can be either parallel or contain each other. For example, when the image to be compressed includes both an infrared image and a color image, the image to be compressed and the depth image are parallel. As another example, when the image to be compressed includes an infrared image, a color image, and a depth image, the image to be compressed and the depth image are contain each other.
[0091] Infrared images can refer to images captured by infrared sensors using pan-infrared light imaging.
[0092] A color image can include images generated based on a color mode. A color mode can be a model that represents a color in digital form, or a way of recording the colors of an image. Common color space modes include the three primary colors of light (Red, Green, and Blue, RGB) color mode, the Red, Green, Blue, and Alpha (RGBA) color mode, and so on. For example, a color image can be an RGB image, and so on.
[0093] In one embodiment, the method proposed in this application can be applied to various scenarios. For example, the method proposed in this application can be applied to various application scenarios such as liveness detection, face recognition, or comparison recognition.
[0094] For example, when the image compression method proposed in this application is applied to the field of face recognition, the object can be a person being recognized. The image to be compressed and the depth image can be images that include a face.
[0095] It should be noted that the image to be compressed and the depth image are images with identical content. For example, as shown in the figure, Figure 1c In this context, 001 can be the image to be compressed, and 002 can be the depth image.
[0096] For example, when the image compression method proposed in the embodiments of this application is applied to the field of comparison recognition, the object may include the person or object being compared, etc.
[0097] In one embodiment, since the method proposed in this application can be applied to various scenarios, there are multiple ways to obtain the image to be compressed and the depth image of the object.
[0098] For example, when the method proposed in this application is applied to the fields of face recognition or liveness detection, the terminal integrating the image compression device can also integrate a camera. The terminal can then capture images of the object through the camera and transmit the images to the image compression device for image compression processing. For example, the terminal can integrate a tri-lens camera, wherein the tri-lens camera is a color camera, a depth camera, and an infrared camera. For example, as... Figure 1d The diagram shows a terminal integrating a tri-lens camera. The tri-lens camera can capture infrared, color, and depth images of an object. Then, an image compression device can be used to compress the infrared, color, and depth images to obtain compressed infrared, color, and depth images.
[0099] For example, when the method proposed in the embodiments of this application is applied to the field of comparison recognition, the image to be compressed and the depth image of the object can be uploaded to the image compression device, so that the image compression device can obtain the image to be compressed and the depth image of the object.
[0100] In one embodiment, since various types of images to be compressed can be captured by different types of cameras, there may be deviations in the shooting angles of these images, resulting in misalignment between the initially acquired images to be compressed and the depth image. Directly using the misaligned initial depth image and the initial image to be compressed to perform region segmentation will reduce the accuracy and reliability of region segmentation, thereby reducing the accuracy and reliability of image compression. Therefore, to improve the accuracy and reliability of subsequent processing, the initially acquired images to be compressed and the depth image can be aligned. Specifically, the step "acquiring the image to be compressed and the depth image of the object" may include:
[0101] Obtain the initial image to be compressed and the initial depth image of the object;
[0102] Determine the first attribute parameters corresponding to the initial image to be compressed and the second attribute parameters of the initial depth image;
[0103] Based on the first attribute parameter and the second attribute parameter, image alignment processing is performed on the initial image to be compressed and the initial depth image to obtain the image to be compressed and the depth image.
[0104] The initial compressed image and the initial depth image may include images that have not been aligned.
[0105] Since the initial compressed image and the initial depth image can be captured by a camera, and each camera has corresponding parameters, the first attribute parameter of the initial image to be compressed can be the parameter corresponding to the camera that captured the initial image to be compressed. Similarly, the second attribute parameter of the initial depth image can be the parameter corresponding to the camera that captured the initial depth image.
[0106] The attribute parameters can include camera intrinsics and camera extrinsics. Camera intrinsics describe the transformation between the 3D coordinates of a real-world object as it is imaged on the camera sensor and the resulting pixel coordinates. Camera extrinsics describe the transformation between other 3D coordinate systems and the camera coordinate system. For example, when multiple cameras are used, if the coordinates of an object point in one camera's coordinate system are transformed to another camera's coordinate system using a rotation matrix R and a translation matrix t, then matrices R and t are the extrinsics between these two cameras, describing the transformation relationship between the two camera coordinate systems. The camera coordinate system refers to a coordinate system with the camera's optical center as the origin, the optical axis as the z-axis, and the x and y axes parallel to the x and y axes of the pixel plane imaged by the camera. The 3D coordinates obtained through the transformation using the depth map and camera intrinsics are the coordinates in the camera coordinate system.
[0107] Image alignment processing achieves alignment in both time and space, meaning it ensures identical resolution, field of view, and pixel-by-pixel alignment. For example, aligning an initial infrared image, initial depth image, and initial color image yields an aligned infrared image, an aligned depth image, and an aligned color image. In this case, the infrared image, depth image, and color image share the same resolution, field of view, and pixel-by-pixel alignment.
[0108] In one embodiment, the first attribute parameter corresponding to the initial image to be compressed can be determined based on the image type of the initial image to be compressed.
[0109] For example, when the initial image to be compressed and the initial depth image are in a parallel relationship, the initial image to be compressed may include the initial infrared image, the initial color image, and the initial depth image.
[0110] Then, the extrinsic and intrinsic parameters of the infrared camera can be determined as the attribute parameters of the initial infrared image. Similarly, the intrinsic and extrinsic parameters of the color camera can be determined as the attribute parameters of the initial color image. The intrinsic and extrinsic parameters of the depth camera can be determined as the attribute parameters of the initial depth image.
[0111] Then, based on the attribute parameters of each image, the initial infrared image, initial color image, and initial depth image can be aligned to obtain the aligned infrared image, aligned color image, and aligned depth image.
[0112] In one embodiment, image alignment processing can be performed on the initial image to be compressed and the initial depth image based on the first attribute parameter and the second attribute parameter to obtain the image to be compressed and the depth image.
[0113] There are several ways to perform image alignment processing.
[0114] For example, when an initial infrared image, an initial depth image, and an initial color image are included, the initial infrared image, the initial depth image, and the initial color image can be associated before alignment calculations are performed.
[0115] For example, the initial infrared image and the initial color image can be aligned, and the initial depth image and the initial color image can be aligned, thereby achieving three-image alignment.
[0116] Specifically, the step "based on the first attribute parameter and the second attribute parameter, perform image alignment processing on the initial image to be compressed and the initial depth image to obtain the image to be compressed and the depth image" may include:
[0117] Based on the first attribute parameter and the second attribute parameter, the conversion relationship between the initial image to be compressed and the initial depth image is calculated;
[0118] Information is extracted from the initial image to be compressed and the initial depth image to obtain the pixel information corresponding to the initial image to be compressed and the pixel information corresponding to the initial depth image.
[0119] Based on the conversion relationship, the pixel information corresponding to the initial image to be compressed and the pixel information corresponding to the initial depth image are converted to obtain the image to be compressed and the depth image.
[0120] For example, since there is a certain positional offset between the infrared camera and the color camera, the coordinate transformation relationship between the initial infrared image and the initial color image can be calculated by combining the calibrated intrinsic and extrinsic parameters of the infrared and color cameras. Then, the infrared image and the color image are spatially aligned using the coordinate transformation relationship.
[0121] For example, since there is a certain positional offset between the infrared camera and the color camera, the coordinate transformation relationship between the initial infrared image and the initial color image can be calculated by combining the calibrated intrinsic and extrinsic parameters of the infrared and color cameras. Then, the infrared image and the compressed image are spatially aligned using the coordinate transformation relationship.
[0122] In this embodiment, alignment of depth images to color images and infrared images to color images can be achieved. This eliminates the need for calculations involving all three images, effectively reducing memory consumption for alignment in low-cost embedded devices and thus lowering costs.
[0123] In one embodiment, the obtained image to be compressed and the depth image can also be images that have already undergone alignment processing. In this case, it is not necessary to perform image alignment processing.
[0124] 102. Perform object detection processing on the image to be compressed to obtain the object regions in the image to be compressed.
[0125] In one embodiment, to improve the quality of the compressed image, the image to be compressed is divided into multiple regions. Then, the regions are compressed based on the amount of information corresponding to each region. Regions containing objects in the image generally have a higher information content, so object detection processing can be performed to obtain the object regions in the image.
[0126] The object region can be a region that includes objects. For example, the object region can be the smallest rectangle that includes objects. Or, for example, the object region can be the smallest square that includes objects, and so on. For instance, when the object is a person, the object region can be as follows: Figure 1e As shown in 003.
[0127] There are several ways to perform object detection processing on the image to be compressed, and obtain the object regions in the image to be compressed.
[0128] For example, algorithms such as Convolutional Neural Networks (CNN), Principal Component Analysis (PCA), Support Vector Machines (SVM), Haar Cascade, or FaceNet can be used to perform object detection processing on the image to be compressed, thereby obtaining the object regions in the image to be accepted.
[0129] In one embodiment, when no object region is detected in the image to be compressed, the process can return to step 101, that is, reacquire the image to be compressed and the depth image.
[0130] In one embodiment, when performing object detection on an image to be compressed, multiple object regions in the image can be detected. For example, when there are two objects in the image to be compressed, two object regions can be detected. As another example, when there are three objects in the image to be compressed, three object regions can be detected.
[0131] 103. Using depth images and object regions, perform region segmentation processing on the image to be compressed to obtain multiple image regions with different information content.
[0132] In one embodiment, after obtaining the object region, the depth image and the object region can be used to perform region segmentation processing on the image to be compressed, resulting in multiple image regions to be compressed with different information contents.
[0133] The information content is used to indicate the importance of information in the image region to be compressed. For example, a larger information content indicates a higher importance of the image region to be compressed. Similarly, a greater amount of information indicates a higher importance of the image region to be compressed, and so on.
[0134] In one embodiment, a depth object region can be determined in the depth image based on the object region. Then, by combining the object region and the depth object region, the image to be compressed is divided into multiple image regions with different information contents. Specifically, the step "using the depth image and the object region to perform region segmentation processing on the image to be compressed to obtain multiple image regions with different information contents" may include:
[0135] Based on the object region, determine the depth object region corresponding to the object in the depth image;
[0136] By using a preset depth threshold, the depth object region is discriminated to obtain the discrimination result;
[0137] Based on the discrimination results, the image to be compressed is divided into multiple image regions with different information content using the depth object region.
[0138] The depth object region is a region in the depth image that provides a more detailed description of an object. For example, such as... Figure 1f As shown, in the image to be compressed 005, the object region can be... Figure 1f In 007, correspondingly, in depth image 004, the depth object region can be... Figure 1f 006 in the middle. (Through) Figure 1f As can be seen, the depth object region can depict the outline of the object in a relatively detailed manner.
[0139] In one embodiment, since the depth image and the image to be compressed are obtained after image alignment processing, the depth object region corresponding to the object can be determined in the depth image based on the object region. Specifically, the step "determine the depth object region corresponding to the object in the depth image based on the object region" may include:
[0140] Identify the coordinate information corresponding to the object region;
[0141] Using coordinate information, determine the initial depth object region corresponding to the object in the depth image;
[0142] The initial depth object region is refined to obtain the depth object region.
[0143] The initial depth object region can be the region in the depth image that corresponds to the object region. For example, if the object region is a rectangle, then the initial depth object region is also a rectangle.
[0144] The coordinate information of the object region can be the coordinate information of the object region in the image to be compressed.
[0145] For example, a coordinate system can be established based on the image to be compressed, and the coordinate information corresponding to the object region can be identified according to the coordinate system. For example, a Cartesian coordinate system can be established with the lower left corner of the image to be compressed as the origin. Then, the coordinate information corresponding to the object region can be determined according to the established Cartesian coordinate system.
[0146] Then, the coordinate information can be used to determine the initial depth object region corresponding to the object in the depth image. For example, a region in the depth image that matches the coordinate information can be established as the initial depth object region.
[0147] Then, the initial depth object region can be refined to obtain the depth object region. Refining the initial depth object region refers to identifying the depth object region from the initial object region.
[0148] In one embodiment, the pixel information corresponding to the outline boundary of the object in the initial depth object region will change significantly. Therefore, the initial depth object region can be refined based on the pixel information in the initial depth object region to obtain the depth object region.
[0149] For example, a sliding window method can be used to extract pixel information from the initial depth object region. Then, the pixel information within a window of centimeters can be compared, and pixels that might represent object contour boundaries can be selected based on the comparison results. The selected pixel information can then be integrated to obtain the depth object region. For example, a 3×3 sliding window with a step size of 2 can be used to extract pixel information from the initial depth object region. Then, the pixel information within a window of centimeters can be compared, and pixels that might represent object contour boundaries can be selected based on the comparison results. The selected pixel information can then be integrated to obtain the depth object region.
[0150] In one embodiment, when the tri-lens camera generates a depth image, some pixel values whose distances are uncertain can be set to 0. The utilization rate of pixels with a value of 0 is not high, which affects the region segmentation result. Furthermore, for depth images, pixels within a preset depth threshold generally have higher reliability. Therefore, after obtaining the depth object region, the preset depth threshold is used to perform discrimination processing on the depth object region to obtain the discrimination result.
[0151] Specifically, the step "using a preset depth threshold to perform discrimination processing on the depth object region and obtain the discrimination result" may include:
[0152] Information is extracted from the depth object region to obtain the pixel information corresponding to the depth object region;
[0153] Calculate the depth distance information of the depth object region based on pixel information;
[0154] The depth distance information is compared with a preset depth threshold to obtain the discrimination result.
[0155] Depth distance information can describe the validity and reliability of pixel information in a depth object region. For example, this depth distance information could be the average value of pixel information in the depth object region. Or, it could be the standard deviation of pixel information in the depth object region, and so on.
[0156] The preset depth threshold can be an indicator of whether the pixel information in the depth object region is reliable. For example, the preset depth threshold can be 30 cm to 150 cm.
[0157] In one embodiment, information can be extracted from the depth object region to obtain the pixel information corresponding to the depth object region. There are multiple methods to extract information from the depth object region to obtain the pixel information corresponding to the depth object region.
[0158] For example, information can be extracted from depth object regions using an open-source computer vision library (OpenCV) to obtain the corresponding pixel information. OpenCV is a cross-platform computer vision and machine learning software library that can run on multiple operating systems and provides interfaces for various programming languages, implementing many general algorithms in image processing and computer vision.
[0159] For example, canvas technology can be used to extract information from the depth object region to obtain the corresponding pixel information. For instance, the depth object region can be drawn on a canvas, and its pixel information can be extracted using the canvas's interface.
[0160] In one embodiment, after extracting the pixel information corresponding to the depth object region, the depth distance information of the depth object region can be calculated based on the pixel information.
[0161] There are several ways to calculate the depth distance information of a depth object region.
[0162] For example, the average value of pixel information in a depth object region can be calculated to obtain the depth distance information of the depth object region.
[0163] For example, when extracting information from a depth object region, pixel information of key parts within the depth object region can be extracted. Then, based on the pixel information of the key parts, the depth distance information of the depth object region can be calculated. For instance, when the depth object region is a face, the key parts could be the facial features. For example, pixel information of the facial features can be extracted, and then the average value of the pixel information of the facial features can be calculated to obtain the depth distance information.
[0164] In one embodiment, the depth distance information can be compared with a preset depth threshold to obtain a judgment result. For example, the preset depth threshold is 30 cm to 150 cm. Then, the depth distance information can be compared with the preset depth threshold. When the depth distance information is within the range of 30 cm to 150 cm, it indicates that the depth distance information meets the preset depth threshold. When the depth distance information is not within the range of 30 cm to 150 cm, it indicates that the depth distance information does not meet the preset depth threshold.
[0165] Then, a discrimination result can be generated based on the comparison results.
[0166] The discrimination result can be represented in several ways. For example, it can be represented using "0" and "1". A discrimination result of "0" indicates that the depth distance information does not meet the preset depth threshold, while a discrimination result of "1" indicates that the depth distance information meets the preset depth threshold.
[0167] In one embodiment, when the depth distance information does not meet the preset depth threshold, step 101 can be returned, that is, the image to be compressed and the depth image can be reacquired.
[0168] In one embodiment, when the depth distance information meets the preset depth threshold, it indicates that the reliability and effectiveness of the pixel information in the depth object region are relatively high. Therefore, the depth object region can be used to divide the image to be compressed into multiple regions with different image regions to be compressed.
[0169] Specifically, the step "based on the discrimination result, divide the image to be compressed into multiple image regions with different information contents using the depth object region" can include:
[0170] Based on the discrimination results, logical operations are performed using the pixel information of the depth object region and the pixel information of the image to be compressed to obtain the operation results;
[0171] Based on the calculation results, the image to be compressed is divided into multiple image regions to be compressed;
[0172] Information recognition processing is performed on each image region to be compressed, resulting in multiple image regions to be compressed with different amounts of information.
[0173] In one embodiment, since the pixel information of the depth object region and the object region are in one-to-one correspondence, and the pixel information in the depth object region provides a more detailed description of the object shooting scene, the pixel information of the depth object region and the pixel information of the image to be compressed can be used to perform logical operation processing, thereby dividing the image to be compressed into multiple image regions to be compressed based on the operation results.
[0174] Logical operations can include AND, OR, NOR, and so on.
[0175] In one embodiment, when dividing the image to be compressed into multiple regions with different information content using a depth object region, a region segmentation image can be generated based on the depth object region. Then, logical operations are performed using the pixel information of the region segmentation image and the pixel information of the image to be compressed to obtain the calculation result. The size of the region segmentation image can be the same as the size of the image to be compressed.
[0176] The pixel information of the region-divided image can be set based on the pixel information of the depth object region. For example, in this region-divided image, the pixel information of the region corresponding to the depth object region can be 1, while the pixel information of the region corresponding to the non-depth object region can be 0.
[0177] Then, when performing logical operations using the pixel information of the region-divided image and the pixel information of the image to be compressed, a bitwise AND operation can be performed between the pixel information of the region-divided image and the pixel information of the image to be compressed to obtain the result. For example, since the pixel information of the region corresponding to the depth object region is not zero, after performing a bitwise AND operation between the pixel information of the region-divided image and the pixel information of the image to be compressed, the information of the corresponding region of the depth object region in the image to be compressed can be preserved. For example, as... Figure 1g As shown, Figure 1g 008 in the image is the image to be compressed. Figure 1g 009 in the image represents the region segmentation. Figure 1g The 010 in the image can represent a defined region to be compressed. (This is achieved through...) Figure 1g As can be seen, information from regions corresponding to non-depth objects is filtered out. Then, based on the calculation results, the image to be compressed can be divided into multiple image regions to be compressed.
[0178] In one embodiment, logical operations can also be performed directly using the depth object region and the object region of the image to be compressed to obtain the operation result. Then, based on the operation result, the image to be compressed is divided into multiple image regions to be compressed.
[0179] For example, a region partitioning image can be generated that fits the object region, meaning the size of the region partitioning image and the object region are the same. Then, a bitwise AND operation can be performed between the region partitioning image and the object region to obtain the result.
[0180] For example, you can directly perform a bitwise AND operation between the depth object region and the object region to obtain the result.
[0181] In one embodiment, when dividing the image to be compressed into multiple image regions based on the calculation result, the object region can also be combined to divide the image to be compressed into multiple image regions. Specifically, the step "dividing the image to be compressed into multiple image regions based on the calculation result" may include:
[0182] The results of the operation are identified to obtain a set of differences in the operation results;
[0183] Based on the difference set of the calculation results, the object region is divided into a first image region and a second image region;
[0184] Based on the first and second image regions, a third image region is divided in the image to be compressed, resulting in multiple image regions to be compressed.
[0185] In one embodiment, the pixel information of the region segmentation image can be set based on the pixel information of the depth object region. For example, in this region segmentation image, the pixel information of the region corresponding to the depth object region may be non-zero, while the pixel information of the region corresponding to the non-depth object region may be zero.
[0186] Therefore, when performing a bitwise AND operation between the pixel information of the region-divided image and the pixel information of the image to be compressed, some pixel information in the image to be compressed will be retained, while some pixel information will be filtered out. Thus, the operation result can be identified to obtain a difference set. This difference set indicates which pixel information in the image to be compressed was retained and which was filtered out.
[0187] In one embodiment, since the object region in the image to be compressed was identified in step 102, it is equivalent to having already divided one type of region in the image to be compressed in step 102. However, the object region is generally rectangular or square, which cannot completely fit the boundary contour of the object. Therefore, based on the difference set of the calculation results, the object region of the image to be compressed can be first divided into a first image region and a second image region.
[0188] The first image region can be a region that fits the boundary contour of the object. For example, such as... Figure 1h As shown, Figure 1h011 in the image can be the first image region. The second image region can be any area within the object region other than the first image region. For example, ... Figure 1h As shown, Figure 1h 012 in the image can be the second image region.
[0189] Specifically, when dividing the object region into a first image region and a second image region based on the difference set of the calculation results, the region in the object region where pixel information is preserved can be classified as the first image region. Then, the remaining region in the object region can be classified as the second image region.
[0190] Furthermore, since information related to the object is of the highest importance, when dividing the object region into a first image region and a second image region based on the difference set of the calculation results, the region in the object region where pixel information is retained can be reasonably expanded to obtain the first image region. Then, the remaining region in the object region can be divided into the second image region. By reasonably expanding the region in the object region where pixel information is retained, the first image region can retain more information, thereby improving the quality of the compressed image.
[0191] In one embodiment, after dividing the first image region and the second image region, the remaining area in the image to be compressed can be divided into a third image region. For example, as... Figure 1h As shown in the figure, 013 can be the third image region. Therefore, the multiple compressed image regions of the image to be compressed can include the first image region, the second image region, and the third image region.
[0192] In one embodiment, after obtaining multiple image regions to be compressed, information recognition processing can be performed on each image region to obtain the amount of information corresponding to each image region to be compressed, so that it can be known what image compression parameters should be set for each image region to be compressed.
[0193] In the process of information recognition for each region of the image to be compressed, the boundaries of each region can be identified to obtain the boundary contour of each region. Then, the amount of information corresponding to each region is determined based on its boundary contour.
[0194] For example, an image compression device can pre-learn various boundary contours of an object to form a preset object boundary contour. Then, the boundary contour of each image region to be compressed is matched with the preset object boundary contour. When the boundary contour of the image region to be compressed matches the preset object boundary contour, it indicates that the image region to be compressed is a region that fits the object boundary contour, and therefore the image region to be compressed has the highest information content.
[0195] For example, when the application scenario of this application embodiment is face recognition, the image compression device can learn the boundary contours of various faces in advance, thereby forming various preset face boundary contours. As another example, when the application scenario of this application embodiment is animal recognition, the image compression device can learn the boundary contours of various animals in advance, thereby forming preset boundary contours for different animals.
[0196] For the remaining image regions to be compressed, semantic recognition can be performed to obtain their semantic information. Then, based on this semantic information, the information content is determined. For example, the third image region corresponds to the background in the image to be compressed. Based on the semantic information of the third image region, the image compression device knows that it is the background and therefore determines that the third image region has the lowest information content.
[0197] In one embodiment, when there are multiple object regions, the image to be compressed can be divided into multiple image regions with different information content based on each object region.
[0198] For example, each object region can first be divided into a first image region and a second image region. Then, the portion of the image to be compressed, excluding the first and second image regions, can be divided into a third image region.
[0199] For example, such as Figure 1i As shown, object region 014 can be divided into a first image region 015 and a second image region 016. Furthermore, object region 017 can be divided into a first image region 018 and a second image region 019. Then, the portion of the image to be compressed, excluding the first image regions (015 and 019) and the second image regions (016 and 018), is divided into a third image region 020.
[0200] 104. Identify the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level. The compression level represents the importance of the amount of information contained in the image region to be compressed.
[0201] In one embodiment, in order to improve the quality of the image to be compressed, when compressing the image to be compressed, different compression parameters are used to process the image region to be compressed according to the amount of information in the image region to be compressed, thereby realizing differentiated compression of the image region to be compressed.
[0202] The compression level can characterize the importance of the amount of information contained in the image region to be compressed.
[0203] For example, when the compression level of an image region to be compressed is high, it indicates that the information is of high importance. Therefore, the compression level of the image region to be compressed can be relatively low, thus retaining more information from the image region to be compressed. Conversely, if the compression level of an image region to be compressed is low, it indicates that the information is of low importance. Therefore, the compression level of the image region to be compressed can be relatively high, thus filtering out more information from the image region to be compressed.
[0204] Image compression parameters determine the degree of compression applied to the image region. For example, larger compression parameters result in greater compression, meaning more information is filtered out. Conversely, smaller compression parameters result in less compression, retaining more information.
[0205] In one embodiment, the step of "identifying the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level, wherein the compression level characterizes the importance of the amount of information contained in the image region to be compressed" may include:
[0206] The information content of each region of the image to be compressed is compared and processed to obtain the comparison result;
[0207] Based on the comparison results, the information content of each image region to be compressed is sorted to obtain the sorting results;
[0208] Based on the sorting results, the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level are determined.
[0209] For example, the amount of information in each image to be compressed can be compared to obtain a comparison result. Then, based on the comparison result, the information content of each region in the image to be compressed can be sorted to obtain a sorting result. For example, regions with larger information content can be sorted first, and regions with smaller information content can be sorted last.
[0210] Next, based on the sorting results, the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level, can be determined.
[0211] For example, image areas listed earlier in the compression list indicate a higher compression level, while those listed later indicate a lower compression level.
[0212] After determining the compression level for each region of the image to be compressed, the image compression parameters corresponding to that compression level can be determined.
[0213] In this way, a preset mapping table can be used to map the compression level of the image region to be compressed to the corresponding image compression parameters.
[0214] The preset mapping table can be a pre-set table that establishes a relationship between compression levels and image compression parameters. By searching this table, the image compression parameters corresponding to the compression level can be determined.
[0215] For example, suppose we use a Gaussian filter operator to compress the region of an image to be compressed. The Gaussian filter operator can be defined as follows:
[0216]
[0217] Here, x represents the image region to be compressed. μ and σ represent image compression parameters. Larger σ and μ indicate a higher degree of filtering and removal of high-frequency components. Therefore, a higher compression level indicates a higher importance of information in the image region to be compressed, so σ and μ can be smaller. Conversely, a lower compression level indicates a lower importance of information in the image region to be compressed, so σ and μ can be larger.
[0218] 105. For each image region to be compressed, the image compression parameters corresponding to the compression level are used to compress the image region to obtain multiple compressed image regions.
[0219] In one embodiment, after determining the compression parameters corresponding to each image region to be compressed, the image region to be compressed can be processed using the image compression parameters corresponding to the compression level for each image region to be compressed, resulting in multiple compressed image regions.
[0220] Specifically, the step "for each image region to be compressed, compress the image region to be compressed using image compression parameters corresponding to the compression level to obtain multiple compressed image regions" may include:
[0221] Based on the image compression parameters, update the preset parameters in the preset image compression logic to obtain the target image compression logic;
[0222] Based on the target image compression logic, the image region to be compressed is compressed to obtain multiple compressed image regions.
[0223] The preset image compression logic can be the logic that needs to be followed when compressing an image region. For example, the preset image compression logic can be a function used when compressing the image region. Or, for example, the preset image compression logic can be an algorithm used when compressing the image region.
[0224] The preset parameter can be a preset compressed image parameter corresponding to the preset image compression logic. For example, the preset parameter can be 0, etc.
[0225] For example, the preset image compression logic can be a Gaussian filter operator. Before the image compression parameters corresponding to the image regions to be compressed are determined, the preset image parameters in the Gaussian filter operator corresponding to each image region to be compressed are unknown. After the image compression parameters corresponding to the image regions to be compressed are determined, the preset parameters in the Gaussian filter operator can be updated to the image compression parameters to obtain the target image compression logic.
[0226] In one embodiment, the step "based on the target image compression logic, compress the image region to be compressed to obtain multiple compressed image regions" may include:
[0227] Information is extracted from the region of the image to be compressed to obtain the initial pixel information of the region of the image to be compressed;
[0228] Based on the target image compression logic, the image compression parameters and initial pixel information corresponding to the target image compression logic are used for calculation to obtain the pixel information after calculation.
[0229] The initial pixel information of the image region to be compressed is replaced with the processed pixel information to obtain the compressed image region.
[0230] For example, suppose the target image compression logic is a Gaussian filter operator. After extracting the initial pixel information of the image region to be compressed, the initial pixel information can be input into the Gaussian filter operator to obtain the processed pixel information. Then, the processed pixel information can replace the initial pixel information of the image region to be compressed to obtain the compressed image region.
[0231] 106. Integrate multiple compressed image regions to obtain a compressed image.
[0232] After processing each compressed image, the regions of each compressed image can be combined to obtain the compressed image.
[0233] In one embodiment, an initial color image, an initial infrared image, and an initial depth image can be acquired. Then, the initial color image, initial infrared image, and initial depth image can be aligned to obtain a color image, an infrared image, and a depth image. Next, object detection processing can be performed on the infrared image to obtain object regions within the infrared image. For example, in face recognition, the object region can include the smallest rectangle of the face. Then, using the depth image and the object regions, the image to be compressed can be divided into regions, resulting in multiple image regions with different information contents. For example, the infrared image, color image, and depth image can all be divided into three image regions to be compressed.
[0234] Then, a Gaussian filter operator is used to compress each compressed image region in each image. For example, the larger σ and μ are, the higher the degree of filtering and the more high-frequency components are removed. Therefore, for the third image region, larger μ and σ can be selected. For example, a 5x5 operator or larger can be used. For the second image region, a 3x3 smoothing operator can be used. For the first image region, no filtering is required, thus preserving the maximum information of the face region.
[0235] Then, the compressed image regions corresponding to each image can be integrated to obtain a compressed image. For example, the compressed image regions corresponding to an infrared image can be integrated to obtain a compressed infrared image. Then, each compressed image can be stored according to a preset format to achieve further compression. For example, the compressed infrared image, compressed depth image, and compressed color image can be stored according to a preset format to achieve further compression.
[0236] As described above, this embodiment can acquire the image to be compressed and the depth image of the object; perform object detection processing on the image to be compressed to obtain the object region in the image to be compressed; use the depth image and the object region to perform region segmentation processing on the image to be compressed to obtain multiple image regions to be compressed with different information contents; identify the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level, wherein the compression level characterizes the importance of the information contained in the image region to be compressed; for each image region to be compressed, the image compression parameters corresponding to the compression level are used to compress the image region to be compressed to obtain multiple compressed image regions; integrate the multiple compressed image regions to obtain the compressed image. Through the method proposed in this embodiment, more information is retained in image regions with higher importance during compression, while more information is filtered out in image regions with lower importance during compression. This differentiated compression method can achieve the retention of more effective information in the image to be compressed while compressing it, thereby improving the quality of the compressed image.
[0237] Based on the method described in the preceding embodiments, the following will provide a more detailed explanation by taking the specific integration of the image compression device into a terminal as an example.
[0238] This application provides an image compression method, such as... Figure 2 As shown, the specific process of this image compression method can be as follows:
[0239] 201. The terminal obtains the image to be compressed and the depth image of the object.
[0240] For example, the embodiments of this application can be described using a facial recognition application scenario as an example.
[0241] For example, the terminal can integrate a three-lens camera. The terminal can acquire an initial image of the object to be compressed and an initial depth image of the object through the three-lens camera. For example, the terminal can acquire an initial color image of the object through a color camera; an initial infrared image of the object through an infrared camera; and an initial depth image of the object through a depth camera.
[0242] Then, the initial color image, initial infrared image, and initial depth image can be aligned to obtain the color image, infrared image, and depth image.
[0243] 202. The terminal performs object detection processing on the image to be compressed to obtain the object regions in the image to be compressed.
[0244] For example, taking facial recognition as an example, the terminal can perform object detection processing on the infrared image to obtain the object region in the infrared image, wherein the object region can be the smallest rectangle that includes the face.
[0245] 203. The terminal uses depth images and object regions to perform region division processing on the image to be compressed, resulting in multiple image regions with different information contents.
[0246] For example, the terminal can determine the coordinate information of the object region and, based on the coordinate information, determine the corresponding depth object region in the depth image.
[0247] Then, a bitwise AND operation is performed between the depth object region and the object region to obtain the precise face region. Next, a reasonable collision analysis is performed on the precise face region to obtain the first image region. Finally, the overlapping portions of the object region and the first image region are removed to obtain the second image region.
[0248] In addition, the parts that overlap with the object region can be excluded from the image to be compressed to obtain a third image region.
[0249] Then, information recognition can be performed on the first image region, the second image region, and the third image region to obtain multiple image regions to be compressed with different amounts of information.
[0250] 204. The terminal identifies the compression level corresponding to each image region to be compressed, as well as the image compression parameters corresponding to the compression level. The compression level represents the importance of the amount of information contained in the image region to be compressed.
[0251] For example, different image compression parameters can be selected based on the importance of different regions of the image to be compressed. For instance, when using a Gaussian filter operator to compress regions of the image, different smoothing factors can be selected based on the importance of different regions of the image to be compressed.
[0252] For example, no compression can be performed on the first image region. For the second image region, the minimum smoothing Gaussian filter operator can be used. And for the third image region, the maximum smoothing Gaussian filter operator can be used.
[0253] The Gaussian filter molecule can be represented as follows:
[0254]
[0255] Here, x can represent the image region to be compressed, while μ and σ can represent the image compression parameters.
[0256] Specifically, the larger σ and μ are, the higher the filtering degree and the more high-frequency components are removed. Therefore, for the third image region, larger μ and σ can be selected. For example, a 5x5 operator or larger can be used. For the second image region, a 3x3 smoothing operator can be used. For the first image region, no filtering can be performed, thus preserving the maximum information of the face region.
[0257] 205. For each image region to be compressed, the terminal uses the image compression parameters corresponding to the compression level to compress the image region to obtain multiple compressed image regions.
[0258] For example, the terminal uses Gaussian filter operators with different compressed image parameters to filter the regions corresponding to infrared images, color images, and depth images to obtain the compressed image region corresponding to each image.
[0259] 206. The terminal integrates multiple compressed image regions to obtain a compressed image.
[0260] For example, the terminal can integrate the compressed image regions corresponding to each image and save the images in their original format to obtain compressed images.
[0261] For example, the terminal can integrate the compressed image regions corresponding to the infrared image and save the infrared image in its original format to obtain a compressed infrared image.
[0262] For example, the terminal can integrate the compressed image regions corresponding to the color image and save the color image in its original format to obtain the compressed color image.
[0263] As can be seen from the above, in this embodiment, the terminal can acquire the image to be compressed and the depth image of the object; the terminal performs object detection processing on the image to be compressed to obtain the object region in the image to be compressed; the terminal uses the depth image and the object region to perform region division processing on the image to be compressed to obtain multiple image regions to be compressed with different information contents; the terminal identifies the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level, wherein the compression level characterizes the importance of the information contained in the image region to be compressed; for each image region to be compressed, the terminal uses the image compression parameters corresponding to the compression level to compress the image region to be compressed to obtain multiple compressed image regions; the terminal integrates the multiple compressed image regions to obtain the compressed image, which can improve the quality and reliability of the compressed image.
[0264] To better implement the above methods, embodiments of this application also provide an image compression device, such as... Figure 3 As shown, the image compression device may include an acquisition unit 301, an object detection unit 302, a region segmentation unit 303, a recognition unit 304, a compression unit 305, and an integration unit 306, as follows:
[0265] The acquisition unit 301 is used to acquire the image to be compressed and the depth image of the object;
[0266] The object detection unit 302 is used to perform object detection processing on the image to be compressed to obtain the object region in the image to be compressed.
[0267] The region segmentation unit 303 is used to perform region segmentation processing on the image to be compressed using the depth image and the object region to obtain multiple image regions to be compressed with different information contents;
[0268] The identification unit 304 is used to identify the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level, wherein the compression level characterizes the importance of the amount of information contained in the image region to be compressed;
[0269] Compression unit 305 is used to compress each image region to be compressed using image compression parameters corresponding to the compression level, to obtain multiple compressed image regions.
[0270] The integration unit 306 is used to integrate the multiple compressed image regions to obtain a compressed image.
[0271] In one embodiment, the region division unit 303 may include:
[0272] A region determination subunit is used to determine the depth object region corresponding to the object in the depth image based on the object region;
[0273] The region discrimination subunit is used to perform discrimination processing on the depth object region using a preset depth threshold to obtain the discrimination result;
[0274] The region segmentation subunit is used to divide the image to be compressed into multiple image regions with different information content based on the discrimination result and using the depth object region.
[0275] In one embodiment, the region discrimination subunit may include:
[0276] The first information extraction module is used to extract information from the depth object region to obtain pixel information corresponding to the depth object region;
[0277] The calculation module is used to calculate the depth distance information of the depth object region based on the pixel information;
[0278] The comparison module is used to compare the depth distance information with the preset depth threshold to obtain the discrimination result.
[0279] In one embodiment, the region partitioning subunit may include:
[0280] The logic operation module is used to perform logic operation processing based on the discrimination result, using the pixel information of the depth object region and the pixel information of the image to be compressed, to obtain the operation result;
[0281] The segmentation module is used to divide the image to be compressed into multiple image regions based on the calculation result;
[0282] The information recognition module is used to perform information recognition processing on each image region to be compressed, resulting in multiple image regions to be compressed with different amounts of information.
[0283] In one embodiment, the partitioning module may include:
[0284] The operation recognition submodule is used to recognize the operation results and obtain a set of operation result differences;
[0285] The first partitioning submodule is used to divide the object region into a first image region and a second image region based on the difference set of the calculation results.
[0286] The second segmentation submodule is used to segment a third image region in the image to be compressed based on the first image region and the second image region, thereby obtaining multiple image regions to be compressed.
[0287] In one embodiment, the region defining sub-unit may include:
[0288] The coordinate information recognition module is used to identify the coordinate information corresponding to the object area;
[0289] The region determination module is used to determine the initial depth object region corresponding to the object in the depth image using the coordinate information;
[0290] The refinement module is used to refine the initial depth object region to obtain the depth object region.
[0291] In one embodiment, the identification unit 304 may include:
[0292] The information comparison subunit is used to compare the amount of information in each region of the image to be compressed and obtain the comparison result.
[0293] The sorting subunit is used to sort the information content of each image region to be compressed based on the comparison result, and obtain the sorting result;
[0294] The compression level determination subunit is used to determine the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level, based on the sorting results.
[0295] In one embodiment, the compression unit 305 may include:
[0296] The parameter update subunit is used to update the preset parameters in the preset image compression logic according to the image compression parameters, so as to obtain the target image compression logic;
[0297] The compression subunit is used to compress the image region to be compressed based on the target image compression logic to obtain multiple compressed image regions.
[0298] In one embodiment, the compression subunit may include:
[0299] The second information extraction module is used to extract information from the image region to be compressed, and obtain the initial pixel information of the image region to be compressed.
[0300] The calculation module is used to perform calculations based on the target image compression logic, using the image compression parameters corresponding to the target image compression logic and the initial pixel information, to obtain the calculated pixel information.
[0301] The replacement module is used to replace the initial pixel information of the image region to be compressed with the processed pixel information to obtain the compressed image region.
[0302] In one embodiment, the acquisition unit 301 may include:
[0303] The sub-unit is used to obtain the initial image to be compressed and the initial depth image of the object.
[0304] The parameter determination subunit is used to determine the first attribute parameter corresponding to the initial image to be compressed and the second attribute parameter of the initial depth image;
[0305] An alignment subunit is used to perform image alignment processing on the initial image to be compressed and the initial depth image based on the first attribute parameter and the second attribute parameter to obtain the image to be compressed and the depth image.
[0306] In one embodiment, the alignment subunit may include:
[0307] The transformation relationship calculation module is used to calculate the transformation relationship between the initial image to be compressed and the initial depth image based on the first attribute parameter and the second attribute parameter;
[0308] The third information extraction module is used to extract information from the initial image to be compressed and the initial depth image to obtain the pixel information corresponding to the initial image to be compressed and the pixel information corresponding to the initial depth image.
[0309] The conversion module is used to convert the pixel information corresponding to the initial image to be compressed and the pixel information corresponding to the initial depth image according to the conversion relationship, so as to obtain the image to be compressed and the depth image.
[0310] In practice, each of the above units can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above units, please refer to the previous method embodiments, which will not be repeated here.
[0311] The image compression device described above can improve the quality and reliability of the compressed image.
[0312] This application also provides an electronic device, such as... Figure 4 The diagram shows a structural schematic of an electronic device involved in an embodiment of this application. This electronic device can be a terminal or a server, specifically:
[0313] The electronic device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will understand that... Figure 4 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:
[0314] The processor 401 is the control center of the electronic device, connecting various parts of the device via various interfaces and lines. It executes various functions and processes data by running or executing software programs and / or modules stored in the memory 402, and by calling data stored in the memory 402. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 401.
[0315] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0316] The electronic device also includes a power supply 403 that supplies power to the various components. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 403 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0317] The electronic device may also include an input unit 404, which can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to object settings and function control.
[0318] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 401 runs the applications stored in the memory 402 to realize various functions, as follows:
[0319] Obtain the image to be compressed and the depth image of the object;
[0320] Object detection processing is performed on the image to be compressed to obtain the object regions in the image to be compressed;
[0321] Using the depth image and the object region, the image to be compressed is divided into regions to obtain multiple image regions with different information contents.
[0322] Identify the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level. The compression level represents the importance of the amount of information contained in the image region to be compressed.
[0323] For each image region to be compressed, the image compression parameters corresponding to the compression level are used to compress the image region to be compressed, resulting in multiple compressed image regions.
[0324] The multiple compressed image regions are integrated to obtain a compressed image.
[0325] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0326] As can be seen from the above, this embodiment can acquire the image to be compressed and the depth image of the object; perform object detection processing on the image to be compressed to obtain the object region in the image to be compressed; use the depth image and the object region to perform region division processing on the image to be compressed to obtain multiple image regions to be compressed with different information contents; identify the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level, wherein the compression level characterizes the importance of the information contained in the image region to be compressed; for each image region to be compressed, use the image compression parameters corresponding to the compression level to compress the image region to be compressed to obtain multiple compressed image regions; integrate the multiple compressed image regions to obtain the compressed image, which is beneficial to improving the quality and reliability of the compressed image.
[0327] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0328] Therefore, embodiments of this application provide a storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the image compression methods provided in embodiments of this application. For example, the instructions can execute the following steps:
[0329] Obtain the image to be compressed and the depth image of the object;
[0330] Object detection processing is performed on the image to be compressed to obtain the object regions in the image to be compressed;
[0331] Using the depth image and the object region, the image to be compressed is divided into regions to obtain multiple image regions with different information contents.
[0332] Identify the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level. The compression level represents the importance of the amount of information contained in the image region to be compressed.
[0333] For each image region to be compressed, the image compression parameters corresponding to the compression level are used to compress the image region to be compressed, resulting in multiple compressed image regions.
[0334] The multiple compressed image regions are integrated to obtain a compressed image.
[0335] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0336] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0337] Since the instructions stored in the storage medium can execute the steps of any of the image compression methods provided in the embodiments of this application, the beneficial effects that any of the image compression methods provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.
[0338] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various alternative implementations of the image compression described above.
[0339] The foregoing has provided a detailed description of an image compression method, apparatus, electronic device, and storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. An image compression method, characterized in that, include: Obtain the image to be compressed and the depth image of the object; Object detection processing is performed on the image to be compressed to obtain the object region in the image to be compressed, and the object region is the smallest square including the object; Based on the object region, determine the depth object region corresponding to the object in the depth image; The depth object region is discriminated using a preset depth threshold to obtain a discrimination result; Based on the discrimination result, the image to be compressed is divided into multiple image regions with different information content using the depth object region; This step includes: Based on the discrimination result, logical operations are performed using the pixel information of the depth object region and the pixel information of the image to be compressed to obtain the operation result; based on the operation result, the image to be compressed is divided into multiple image regions to be compressed; information recognition processing is performed on each image region to be compressed to obtain multiple image regions to be compressed with different information amounts. The step of dividing the image to be compressed into multiple image regions based on the calculation result includes: identifying the calculation result to obtain a set of calculation result differences; dividing the object region into a first image region and a second image region according to the set of calculation result differences; and dividing a third image region in the image to be compressed based on the first image region and the second image region to obtain multiple image regions to be compressed. The first image region is the region that fits the boundary contour of the object, and the second image region is the region in the object region other than the first image region. Identify the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level. The compression level represents the importance of the amount of information contained in the image region to be compressed. For each image region to be compressed, the image compression parameters corresponding to the compression level are used to compress the image region to be compressed, resulting in multiple compressed image regions. The multiple compressed image regions are integrated to obtain a compressed image.
2. The method according to claim 1, characterized in that, The step of using a preset depth threshold to perform discrimination processing on the depth object region to obtain a discrimination result includes: Information is extracted from the depth object region to obtain the pixel information corresponding to the depth object region; Based on the pixel information, calculate the depth distance information of the depth object region; The depth distance information is compared with the preset depth threshold to obtain the discrimination result.
3. The method according to claim 1, characterized in that, The step of determining the depth object region corresponding to the object in the depth image based on the object region includes: Identify the coordinate information corresponding to the object region; Using the coordinate information, the initial depth object region corresponding to the object is determined in the depth image; The initial depth object region is refined to obtain the depth object region.
4. The method according to claim 1, characterized in that, The process involves identifying the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level. The compression level characterizes the importance of the information contained in the image region to be compressed, including: The information content of each region of the image to be compressed is compared and processed to obtain the comparison result; Based on the comparison results, the information content of each image region to be compressed is sorted to obtain the sorting results; Based on the sorting results, the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level are determined.
5. The method according to claim 1, characterized in that, For each image region to be compressed, image compression parameters corresponding to the compression level are used to compress the image region to obtain multiple compressed image regions, including: Based on the image compression parameters, update the preset parameters in the preset image compression logic to obtain the target image compression logic; Based on the target image compression logic, the image region to be compressed is compressed to obtain multiple compressed image regions.
6. The method according to claim 5, characterized in that, The compression logic based on the target image is used to compress the image region to be compressed, resulting in multiple compressed image regions, including: Information is extracted from the image region to be compressed to obtain the initial pixel information of the image region to be compressed. Based on the target image compression logic, the image compression parameters corresponding to the target image compression logic and the initial pixel information are used for calculation to obtain the calculated pixel information. The initial pixel information of the image region to be compressed is replaced with the pixel information after the operation to obtain the compressed image region.
7. The method according to claim 1, characterized in that, The acquisition of the object's image to be compressed and its depth image includes: Obtain the initial image to be compressed and the initial depth image of the object; Determine the first attribute parameter corresponding to the initial image to be compressed and the second attribute parameter of the initial depth image; Based on the first attribute parameter and the second attribute parameter, image alignment processing is performed on the initial image to be compressed and the initial depth image to obtain the image to be compressed and the depth image.
8. The method according to claim 7, characterized in that, The step of performing image alignment processing on the initial image to be compressed and the initial depth image based on the first attribute parameter and the second attribute parameter to obtain the image to be compressed and the depth image includes: Based on the first attribute parameter and the second attribute parameter, calculate the conversion relationship between the initial image to be compressed and the initial depth image; Information is extracted from the initial image to be compressed and the initial depth image to obtain the pixel information corresponding to the initial image to be compressed and the pixel information corresponding to the initial depth image; According to the conversion relationship, the pixel information corresponding to the initial image to be compressed and the pixel information corresponding to the initial depth image are converted to obtain the image to be compressed and the depth image.
9. An image compression device, characterized in that, include: The acquisition unit is used to acquire the image to be compressed and the depth image of the object. An object detection unit is used to perform object detection processing on the image to be compressed to obtain the object region in the image to be compressed, wherein the object region is the smallest square including the object; The region segmentation unit includes: a region determination subunit, a region discrimination subunit, and a region segmentation subunit, wherein the region determination subunit is used to determine the depth object region corresponding to the object in the depth image based on the object region; The region discrimination subunit is used to perform discrimination processing on the depth object region using a preset depth threshold to obtain the discrimination result; The region segmentation subunit is used to divide the image to be compressed into multiple image regions with different information content based on the discrimination result and using the depth object region. The region division subunit includes: a logic operation module, used to perform logic operation processing based on the discrimination result, using the pixel information of the depth object region and the pixel information of the image to be compressed, to obtain the operation result; a division module, used to divide the image to be compressed into multiple image regions to be compressed based on the operation result; and an information recognition module, used to perform information recognition processing on each image region to be compressed to obtain multiple image regions to be compressed with different information amounts. The segmentation module includes: a calculation and recognition submodule for recognizing the calculation result to obtain a calculation result difference set; a first segmentation submodule for dividing the object region into a first image region and a second image region based on the calculation result difference set; and a second segmentation submodule for segmenting a third image region in the image to be compressed based on the first image region and the second image region to obtain multiple image regions to be compressed; wherein the first image region is a region that fits the boundary contour of the object, and the second image region is a region in the object region other than the first image region. The identification unit is used to identify the compression level corresponding to each image region to be compressed, and the image compression parameters corresponding to the compression level, wherein the compression level characterizes the importance of the amount of information contained in the image region to be compressed; The compression unit is used to compress each image region to be compressed using image compression parameters corresponding to the compression level, resulting in multiple compressed image regions. An integration unit is used to integrate the multiple compressed image regions to obtain a compressed image.
10. A computer device, characterized in that, It includes a memory and a processor; the memory stores an application program, and the processor runs the application program within the memory to perform the operations in the image compression method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the image compression method according to any one of claims 1 to 8.
12. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the image compression method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Image compression method and device, storage medium and electronic equipment
CN112839223A
An arrangement for image segmentation
GB2537142A