CN117014557A - Compression method and device for document image, electronic equipment and storage medium - Google Patents

Compression method and device for document image, electronic equipment and storage medium Download PDF

Info

Publication number
CN117014557A
CN117014557A CN202311282371.9A CN202311282371A CN117014557A CN 117014557 A CN117014557 A CN 117014557A CN 202311282371 A CN202311282371 A CN 202311282371A CN 117014557 A CN117014557 A CN 117014557A
Authority
CN
China
Prior art keywords
chrominance component
document image
color
region
component
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202311282371.9A
Other languages
Chinese (zh)
Other versions
CN117014557B (en
Inventor
方俊
陈亚军
康凯
鞠成富
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fuxin Kunpeng Beijing Information Technology Co ltd
Original Assignee
Fuxin Kunpeng Beijing Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fuxin Kunpeng Beijing Information Technology Co ltd filed Critical Fuxin Kunpeng Beijing Information Technology Co ltd
Priority to CN202311282371.9A priority Critical patent/CN117014557B/en
Publication of CN117014557A publication Critical patent/CN117014557A/en
Application granted granted Critical
Publication of CN117014557B publication Critical patent/CN117014557B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/41Bandwidth or redundancy reduction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/46Colour picture communication systems
    • H04N1/56Processing of colour picture signals
    • H04N1/60Colour correction or control

Abstract

The application provides a compression method, a device, electronic equipment and a storage medium of a document image, and relates to the technical field of image compression, wherein the method comprises the following steps: converting the document image from an RGB color space to a YCbCr color space in which a brightness component, a blue chrominance component, and a red chrominance component of the document image are included; determining a gray area and a color area of the document image based on the blue chrominance component and the red chrominance component; compressing brightness components of the gray scale region aiming at the gray scale region; for a color region, the luminance component, the blue chrominance component, and the red chrominance component of the color region are compressed. By the method, the whole color image is divided into a plurality of color areas and gray areas, and different compression strategies are adopted for the color areas and the gray areas, so that the number of bits for representing the pixels of the image is greatly reduced, and the compression efficiency of the document image is improved.

Description

Compression method and device for document image, electronic equipment and storage medium
Technical Field
The present application relates to the field of image compression technologies, and in particular, to a method and apparatus for compressing a document image, an electronic device, and a storage medium.
Background
Image compression technology is a technology of compressing image data into a smaller memory space, aiming at reducing the storage and transmission costs of the image data. Common image compression techniques include both lossy compression and lossless compression.
However, in the related art, when a document image is compressed using an image compression technique, compression efficiency is low and user experience is poor.
Therefore, how to improve the compression efficiency of the document image is a problem to be solved at present.
Disclosure of Invention
Aiming at the problems existing in the prior art, the embodiment of the application provides a method and a device for compressing document images, electronic equipment and a storage medium.
The application provides a compression method of a document image, which comprises the following steps:
converting a document image from an RGB color space to a YCbCr color space, the YCbCr color space including a brightness component, a blue chrominance component, and a red chrominance component of the document image;
determining a gray scale region and a color region of the document image based on the blue chrominance component and the red chrominance component;
compressing the brightness component of the gray scale region for the gray scale region; the brightness component, the blue chrominance component, and the red chrominance component of the color area are compressed for the color area.
Optionally, the determining the gray scale area and the color area of the document image based on the blue chrominance component and the red chrominance component includes:
performing binarization processing and inverse processing on the blue chrominance component and the red chrominance component to obtain binarized images corresponding to the blue chrominance component and the red chrominance component;
the gray scale region and the color region are determined based on the binarized image.
Optionally, the determining the gray scale region and the color region based on the binarized image includes:
performing image corrosion processing on the binarized image to generate a processed binarized image;
and determining the gray scale region and the color region based on the processed binarized image.
Optionally, the determining the gray scale region and the color region based on the binarized image includes:
performing horizontal projection and vertical projection on the binarized image to obtain a projection result;
and determining the gray scale region and the color region based on the projection result.
Optionally, the method further comprises:
and storing the compressed information of the document image, wherein the compressed information is used for representing the position information of the gray scale region and the color region.
Optionally, the converting the document image from the RGB color space to the YCbCr color space includes:
converting the document image from the RGB color space to the YCbCr color space using equations (1) - (3);
(1)
(2)
(3)
wherein,representing the brightness component; />Representing the blue chrominance component; />Representing the red chrominance component; />Representing a red pixel value; />Representing a green pixel value; />Representing the blue pixel value.
The application also provides a compression device of the document image, comprising:
a conversion module for converting a document image from an RGB color space to a YCbCr color space including a brightness component, a blue chrominance component, and a red chrominance component of the document image;
a determining module configured to determine a gray area and a color area of the document image based on the blue chrominance component and the red chrominance component;
the compression module is used for compressing the brightness component of the gray scale region aiming at the gray scale region; the brightness component, the blue chrominance component, and the red chrominance component of the color area are compressed for the color area.
The application also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of compressing a document image as described in any one of the above when executing the program.
The present application also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method of compressing a document image as described in any one of the above.
The application also provides a computer program product comprising a computer program which, when executed by a processor, implements a method of compressing a document image as described in any one of the above.
The application provides a compression method, a device, an electronic device and a storage medium of a document image, which are characterized in that the document image is converted from an RGB color space to a YCbCr color space, wherein the YCbCr color space comprises a brightness component, a blue chrominance component and a red chrominance component of the document image; determining a gray area and a color area of the document image based on the blue chrominance component and the red chrominance component; different compression strategies are adopted for the color area and the gray area, namely, the brightness component of the gray area is compressed for the gray area; for the color region, the brightness component, the blue chrominance component and the red chrominance component of the color region are compressed, so that the dimension of a color space of the gray region is reduced, the number of bits for representing the pixels of the image of the gray region is greatly reduced, and the compression efficiency of the document image is further improved.
Drawings
In order to more clearly illustrate the application or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the application, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for compressing document images provided by the present application;
FIG. 2 is a schematic view of a document image provided by the present application;
FIG. 3 is a schematic view of the brightness components of a document image provided by the present application;
FIG. 4 is a schematic diagram of the blue chrominance components of a document image provided by the present application;
FIG. 5 is a schematic view of the red chrominance component of a document image provided by the present application;
FIG. 6 is a diagram of a binarized image after binarizing and inverting blue chrominance components according to the present application;
FIG. 7 is a diagram of a binarized image obtained by binarizing and inverting red chrominance components according to the present application;
FIG. 8 is a schematic diagram of a binarized image corresponding to a red chrominance component after being eroded;
FIG. 9 is a schematic view of one of the color areas corresponding to the red chrominance component in the document image provided by the present application;
FIG. 10 is a second schematic view of a color region corresponding to a red chrominance component in a document image provided by the present application;
FIG. 11 is a third schematic view of a color region corresponding to a red chrominance component in a document image provided by the present application;
FIG. 12 is a second flow chart of the method for compressing document images according to the present application;
FIG. 13 is a schematic view of a structure of a compression apparatus for document images provided by the present application;
fig. 14 is a schematic structural diagram of an electronic device provided by the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
In order to facilitate a clearer understanding of various embodiments of the present application, some relevant knowledge will be presented first.
1) Lossy compression: lossy compression refers to the loss of certain information when compressing image data, resulting in a reduction in the quality of the compressed image. Lossy compression is commonly used for scenes requiring high compression ratios, such as digital photography, video transmission, and the like. Common lossy compression formats include JPEG, GIF, PNG, etc.
2) Lossless compression: lossless compression means that no information is lost when image data is compressed, thereby ensuring that the quality of the compressed image is the same as the original image quality. Lossless compression is typically used for scenes that require guaranteed image quality, such as medical images, satellite images, and the like. Common lossless compression formats include BMP, TIFF, RAW, etc.
Common image compression techniques include:
1) Discrete cosine transform (Discrete Cosine Transform, DCT) compression: DCT compression is a technique of converting image data into frequency domain data, and compression can be achieved by discarding data of a high frequency portion. DCT compression is commonly used in JPEG compression.
2) Wavelet compression: wavelet compression is a technique of converting image data into wavelet coefficients, and compression can be achieved by discarding low-amplitude portions of the wavelet coefficients. Wavelet compression is commonly used in JPEG2000 compression.
3) Predictive coding: predictive coding is a technique that achieves compression by predicting pixel values, which can be achieved by predicting differences in pixel values. Predictive coding is commonly used in lossless compression.
4) Entropy coding: entropy encoding is a technique for achieving compression by counting information entropy in image data, and compression can be achieved by encoding data having a high frequency of occurrence. Entropy coding is commonly used in compression of JPEG, PNG, etc.
Document images are images containing information such as text, symbols, and charts, and are usually scanned or captured on paper documents. The document image main colors are usually black and white, because the document is usually black-printed on white paper. In addition to black and white, other colors, such as red, blue, green, etc., may be included in the document image. These colors are typically used to mark or emphasize certain content in a document.
When the document image is compressed by using the image compression technology, the compression efficiency is low, and the experience of a user is poor. Therefore, in order to solve the above problems, the present application provides a method, an apparatus, an electronic device, and a storage medium for compressing a document image, which make full use of color characteristics of the document image, that is, most of the document image is monochrome or gray, and a small amount or part of the document image is color; processing the image in a color mode for a small amount or partial color area, and processing the image in a monochrome or gray mode for the rest; thereby improving the compression efficiency of the document image.
The method of compressing a document image provided by the present application will be described in detail with reference to fig. 1 to 12. Fig. 1 is a schematic flow chart of a method for compressing a document image according to the present application, and referring to fig. 1, the method includes steps 101 to 103, in which:
step 101, converting a document image from an RGB color space to a YCbCr color space, wherein the YCbCr color space comprises a brightness component, a blue chrominance component and a red chrominance component of the document image.
It should be noted that the execution body of the present application may be any electronic device capable of implementing document image compression, for example, any one of a smart phone, a smart watch, a desktop computer, a portable computer, and the like.
In the YCbCr color space (also called YUV color space), Y represents luminance (Luminance, luma), accounting for 8 bits (1 byte); cb. Cr represents chromaticity (Chrominance, chroma), where Cb represents a blue chromaticity component, b represents blue, cr represents a red chromaticity component, and r represents red.
In the embodiment of the application, the document image is shown in fig. 2, and fig. 2 is a schematic diagram of the document image provided by the application. In fig. 2, color areas of the document image are marked, and portions not marked with color areas are achromatic areas in the document image.
Optionally, the converting the document image from the RGB color space to the YCbCr color space may be specifically implemented by the following steps:
converting the document image from the RGB color space to the YCbCr color space using equations (1) - (3);
(1)
(2)
(3)
wherein,representing the brightness component; />Representing the blue chrominance component; />Representing the red chrominance component; />Representing a red pixel value; />Representing a green pixel value; />Representing the blue pixel value.
Fig. 3 is a schematic view of brightness components of a document image provided by the present application. Referring to FIG. 3, the brightness component, i.e., the document imageAnd the components are gray images.
Fig. 4 is a schematic diagram of a blue chrominance component of a document image provided by the present application. In the case where there is no blue chrominance component in fig. 2, fig. 4 shows that the blue chrominance component corresponding to the document image is empty.
Step 102, determining a gray scale area and a color area of the document image based on the blue chrominance component and the red chrominance component.
In the embodiment of the application, after the document image is converted from RGB to YCbCr in the color space, N color areas and gray areas in the document image can be determined based on the blue chrominance component and the red chrominance component.
Step 103, compressing the brightness component of the gray scale region for the gray scale region; the brightness component, the blue chrominance component, and the red chrominance component of the color area are compressed for the color area.
In the embodiment of the present application, if n=0, that is, if no color area is determined in the document image, it means that the document image is a gray image, it may be discardedComponent sum->Component, pair->The components are compressed. For example pair->The components are compressed by adopting JPEG or PNG methods and the like.
If N>0 indicates that the document image has N regions colored, and the other regions are gray regions. Then for the color region, forComponent, & gt>Component sum->Compressing the components; for gray area, pair->The components are compressed.
For example, for color regions, forComponent, & gt>Component sum->Compressing the components by adopting JPEG or PNG and other methods; for gray area, pair->The components are compressed by adopting JPEG or PNG methods and the like.
The application provides a compression method of a document image, which is characterized in that the document image is converted from an RGB color space to a YCbCr color space, wherein the YCbCr color space comprises a brightness component, a blue chrominance component and a red chrominance component of the document image; determining a gray area and a color area of the document image based on the blue chrominance component and the red chrominance component; different compression strategies are adopted for the color area and the gray area, namely, the brightness component of the gray area is compressed for the gray area; for the color region, the brightness component, the blue chrominance component and the red chrominance component of the color region are compressed, so that the dimension of a color space of the gray region is reduced, the number of bits for representing the pixels of the image of the gray region is greatly reduced, and the compression efficiency of the document image is further improved.
Optionally, the determining the gray scale area and the color area of the document image based on the blue chrominance component and the red chrominance component may be specifically implemented by:
step 1), binarizing and inverting the blue chrominance component and the red chrominance component to obtain binarized images corresponding to the blue chrominance component and the red chrominance component;
step 2), determining the gray scale area and the color area based on the binarized image.
Fig. 6 is a schematic diagram of a binarized image after binarizing and inverting a blue chrominance component according to the present application. In fig. 6, the binary image obtained by performing the binarization and the inversion of the blue chrominance component is a blank image, and therefore, the binary image corresponding to the blue chrominance component may be discarded, and only the binary image corresponding to the red chrominance component may be processed later.
Fig. 7 is a schematic diagram of a binarized image obtained by binarizing and inverting red chrominance components according to the present application.
In the above embodiment, by the pair ofComponent sum->The components are subjected to binarization and inverse processing, so that gray areas and color areas in the document image can be determined, and further different compression strategies are adopted for different areas, so that the effect of improving the compression efficiency of the document image is achieved.
Optionally, the determining the gray scale area and the color area based on the binarized image may be specifically implemented by:
step 1), performing image corrosion treatment on the binarized image to generate a treated binarized image;
and 2) determining the gray scale area and the color area based on the processed binarized image.
In the embodiment of the application, the color area and the gray area may overlap in the process of binarizing the blue chrominance component and the red chrominance component and reversing the blue chrominance component, so that the generated binarized image is unclear. For example, in fig. 2, the "test-dedicated chapter" overlaps with a text portion in the document image.
Therefore, in order to make the binarized image clearer, it is necessary to perform image erosion processing on the binarized image to generate a processed binarized image; then, a gray scale region and the color region are determined based on the processed binarized image.
Fig. 8 is a schematic diagram of a binarized image corresponding to a red chrominance component after performing an etching process.
Optionally, the determining the gray scale region and the color region based on the binarized image includes:
step 1), carrying out horizontal projection and vertical projection on the binarized image to obtain a projection result;
and 2) determining the gray scale region and the color region based on the projection result.
In the embodiment of the application, horizontal projection and vertical projection are carried out on the binarized image after corrosion treatment, and the position of the color area is calculated. The sub-graphs corresponding to these positions are then split in fig. 5, resulting in fig. 9, 10 and 11. FIG. 9 is a schematic view of a color region corresponding to a red chrominance component in a document image provided by the present application. FIG. 10 is a second schematic view of a color region corresponding to a red chrominance component in a document image according to the present application. FIG. 11 is a third schematic view of a color region corresponding to a red chrominance component in a document image provided by the present application.
Optionally, after compressing for the gray area and the color area in the document image, the following steps are also required:
and storing the compressed information of the document image, wherein the compressed information is used for representing the position information of the gray scale region and the color region.
In the embodiment of the application, the compressed information needs to be recorded and stored so that the original document image can be reconstructed based on the compressed information later. Wherein the compressed information includes at least one of:
a) Whether or not there isComponent (s)/->A component;
b)component (s)/->The location of each color region in the component.
Fig. 12 is a second flowchart of the method for compressing a document image according to the present application, and referring to fig. 12, the method includes steps 1201-1207, in which:
step 1201, converting the document image from the RGB color space to the YCbCr color space, wherein the brightness component, the blue chrominance component, and the red chrominance component of the document image are included in the YCbCr color space.
Specifically, the document image is converted from the RGB color space to the YCbCr color space using the following formula (1) -formula (3):
(1)
(2)
(3)
wherein,representing a brightness component; />Representing a blue chrominance component; />Representing a red chrominance component; />Representing a red pixel value; />Representing a green pixel value; />Representing the blue pixel value.
Step 1202, performing binarization and inversion processing on the blue chrominance component and the red chrominance component to obtain binarized images corresponding to the blue chrominance component and the red chrominance component.
Step 1203, performing image erosion processing on the binarized image to generate a processed binarized image;
and 1204, performing horizontal projection and vertical projection on the binarized image to obtain a projection result.
Step 1205, determining a gray area and a color area of the document image based on the projection result.
Step 1206, compressing brightness components of the gray scale region for the gray scale region; for a color region, the luminance component, the blue chrominance component, and the red chrominance component of the color region are compressed.
Step 1207, storing compressed information of the document image, wherein the compressed information is used for representing position information of the gray scale region and the color region.
The application provides a compression method of a document image, which is characterized in that the document image is converted from an RGB color space to a YCbCr color space, wherein the YCbCr color space comprises a brightness component, a blue chrominance component and a red chrominance component of the document image; determining a gray area and a color area of the document image based on the blue chrominance component and the red chrominance component; different compression strategies are adopted for the color area and the gray area, namely, the brightness component of the gray area is compressed for the gray area; for the color region, the brightness component, the blue chrominance component and the red chrominance component of the color region are compressed, so that the dimension of a color space of the gray region is reduced, the number of bits for representing the pixels of the image of the gray region is greatly reduced, and the compression efficiency of the document image is further improved.
The compression apparatus for document images provided by the present application will be described below, and the compression apparatus for document images described below and the compression method for document images described above may be referred to correspondingly to each other. Fig. 13 is a schematic structural view of a document image compression apparatus according to the present application, and as shown in fig. 13, the document image compression apparatus 1300 includes: a conversion module 1301, a determination module 1302, a compression module 1303, wherein:
a conversion module 1301 configured to convert a document image from an RGB color space to a YCbCr color space, where the YCbCr color space includes a brightness component, a blue chromaticity component, and a red chromaticity component of the document image;
a determining module 1302 for determining a gray area and a color area of the document image based on the blue chrominance component and the red chrominance component;
a compressing module 1303, configured to compress, for the gray scale region, the brightness component of the gray scale region; the brightness component, the blue chrominance component, and the red chrominance component of the color area are compressed for the color area.
The application provides a compression device of a document image, which converts the document image from an RGB color space to a YCbCr color space, wherein the YCbCr color space comprises a brightness component, a blue chrominance component and a red chrominance component of the document image; determining a gray area and a color area of the document image based on the blue chrominance component and the red chrominance component; different compression strategies are adopted for the color area and the gray area, namely, the brightness component of the gray area is compressed for the gray area; for the color region, the brightness component, the blue chrominance component and the red chrominance component of the color region are compressed, so that the dimension of a color space of the gray region is reduced, the number of bits for representing the pixels of the image of the gray region is greatly reduced, and the compression efficiency of the document image is further improved.
Optionally, the determining module 1302 is further configured to:
performing binarization processing and inverse processing on the blue chrominance component and the red chrominance component to obtain binarized images corresponding to the blue chrominance component and the red chrominance component;
the gray scale region and the color region are determined based on the binarized image.
Optionally, the determining module 1302 is further configured to:
performing image corrosion processing on the binarized image to generate a processed binarized image;
and determining the gray scale region and the color region based on the processed binarized image.
Optionally, the determining module 1302 is further configured to:
performing horizontal projection and vertical projection on the binarized image to obtain a projection result;
and determining the gray scale region and the color region based on the projection result.
Optionally, the apparatus further comprises:
and the storage module is used for storing the compressed information of the document image, and the compressed information is used for representing the position information of the gray area and the color area.
Optionally, the conversion module is further configured to:
converting the document image from the RGB color space to the YCbCr color space using equations (1) - (3);
(1)
(2)
(3)
wherein,representing the brightness component; />Representing the blue chrominance component; />Representing the red chrominance component; />Representing a red pixel value; />Representing a green pixel value; />Representing the blue pixel value.
Fig. 14 is a schematic structural diagram of an electronic device according to the present application, and as shown in fig. 14, the electronic device may include: processor 1410, communication interface (Communications Interface) 1420, memory 1430 and communication bus 1440, wherein processor 1410, communication interface 1420 and memory 1430 communicate with each other via communication bus 1440. Processor 1410 may invoke logic instructions in memory 1430 to perform a method of compressing a document image, the method comprising: converting a document image from an RGB color space to a YCbCr color space, the YCbCr color space including a brightness component, a blue chrominance component, and a red chrominance component of the document image; determining a gray scale region and a color region of the document image based on the blue chrominance component and the red chrominance component; compressing the brightness component of the gray scale region for the gray scale region; the brightness component, the blue chrominance component, and the red chrominance component of the color area are compressed for the color area.
In addition, the logic instructions in the memory 1430 described above may be implemented in the form of software functional units and may be stored in a computer readable storage medium when sold or used as a stand alone product. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present application also provides a computer program product, the computer program product comprising a computer program, the computer program being storable on a non-transitory computer readable storage medium, the computer program, when executed by a processor, being capable of performing a method of compressing a document image provided by the methods described above, the method comprising: converting a document image from an RGB color space to a YCbCr color space, the YCbCr color space including a brightness component, a blue chrominance component, and a red chrominance component of the document image; determining a gray scale region and a color region of the document image based on the blue chrominance component and the red chrominance component; compressing the brightness component of the gray scale region for the gray scale region; the brightness component, the blue chrominance component, and the red chrominance component of the color area are compressed for the color area.
In yet another aspect, the present application also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform a method of compressing a document image provided by the above methods, the method comprising: converting a document image from an RGB color space to a YCbCr color space, the YCbCr color space including a brightness component, a blue chrominance component, and a red chrominance component of the document image; determining a gray scale region and a color region of the document image based on the blue chrominance component and the red chrominance component; compressing the brightness component of the gray scale region for the gray scale region; the brightness component, the blue chrominance component, and the red chrominance component of the color area are compressed for the color area.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present application without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and are not limiting; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A method of compressing a document image, comprising:
converting a document image from an RGB color space to a YCbCr color space, the YCbCr color space including a brightness component, a blue chrominance component, and a red chrominance component of the document image;
determining a gray scale region and a color region of the document image based on the blue chrominance component and the red chrominance component;
compressing the brightness component of the gray scale region for the gray scale region; the brightness component, the blue chrominance component, and the red chrominance component of the color area are compressed for the color area.
2. The method of compressing a document image according to claim 1, wherein the determining a grayscale region and a color region of the document image based on the blue chrominance component and the red chrominance component comprises:
performing binarization processing and inverse processing on the blue chrominance component and the red chrominance component to obtain binarized images corresponding to the blue chrominance component and the red chrominance component;
the gray scale region and the color region are determined based on the binarized image.
3. The method of compressing a document image according to claim 2, wherein the determining the grayscale region and the color region based on the binarized image includes:
performing image corrosion processing on the binarized image to generate a processed binarized image;
and determining the gray scale region and the color region based on the processed binarized image.
4. A method of compressing a document image according to claim 2 or 3, wherein the determining the gradation region and the color region based on the binarized image comprises:
performing horizontal projection and vertical projection on the binarized image to obtain a projection result;
and determining the gray scale region and the color region based on the projection result.
5. A method of compressing a document image according to any one of claims 1 to 3, wherein the method further comprises:
and storing the compressed information of the document image, wherein the compressed information is used for representing the position information of the gray scale region and the color region.
6. A method of compressing a document image according to any one of claims 1 to 3, wherein said converting the document image from an RGB color space to a YCbCr color space comprises:
converting the document image from the RGB color space to the YCbCr color space using equations (1) - (3);
(1)
(2)
(3)
wherein,representing the brightness component; />Representing the blue chrominance component; />Representing the red chrominance component; />Representing a red pixel value; />Representing a green pixel value; />Representing the blue pixel value.
7. A compression apparatus of a document image, comprising:
a conversion module for converting a document image from an RGB color space to a YCbCr color space including a brightness component, a blue chrominance component, and a red chrominance component of the document image;
a determining module configured to determine a gray area and a color area of the document image based on the blue chrominance component and the red chrominance component;
the compression module is used for compressing the brightness component of the gray scale region aiming at the gray scale region; the brightness component, the blue chrominance component, and the red chrominance component of the color area are compressed for the color area.
8. The apparatus for compressing a document image according to claim 7, wherein the determining module is further configured to:
performing binarization processing and inverse processing on the blue chrominance component and the red chrominance component to obtain binarized images corresponding to the blue chrominance component and the red chrominance component;
the gray scale region and the color region are determined based on the binarized image.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of compressing a document image according to any one of claims 1 to 6 when the program is executed.
10. A non-transitory computer readable storage medium having stored thereon a computer program, wherein the computer program, when executed by a processor, implements the method of compressing a document image according to any one of claims 1 to 6.
CN202311282371.9A 2023-10-07 2023-10-07 Compression method and device for document image, electronic equipment and storage medium Active CN117014557B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311282371.9A CN117014557B (en) 2023-10-07 2023-10-07 Compression method and device for document image, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311282371.9A CN117014557B (en) 2023-10-07 2023-10-07 Compression method and device for document image, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN117014557A true CN117014557A (en) 2023-11-07
CN117014557B CN117014557B (en) 2024-01-23

Family

ID=88567615

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311282371.9A Active CN117014557B (en) 2023-10-07 2023-10-07 Compression method and device for document image, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117014557B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004229261A (en) * 2002-11-27 2004-08-12 Canon Inc Image-compressing method, image-compressing device, program, and recording media
US20070025627A1 (en) * 2005-07-27 2007-02-01 Fumihiro Hasegawa Image processing device, image compression method, image compression program, and recording medium
CN107645662A (en) * 2017-10-19 2018-01-30 电子科技大学 A kind of colour image compression method
CN108564633A (en) * 2018-01-05 2018-09-21 珠海市杰理科技股份有限公司 Gray-scale Image Compression method, apparatus and computer equipment
CN111953977A (en) * 2020-07-09 2020-11-17 西安万像电子科技有限公司 Image transmission method, system and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004229261A (en) * 2002-11-27 2004-08-12 Canon Inc Image-compressing method, image-compressing device, program, and recording media
US20070025627A1 (en) * 2005-07-27 2007-02-01 Fumihiro Hasegawa Image processing device, image compression method, image compression program, and recording medium
CN107645662A (en) * 2017-10-19 2018-01-30 电子科技大学 A kind of colour image compression method
CN108564633A (en) * 2018-01-05 2018-09-21 珠海市杰理科技股份有限公司 Gray-scale Image Compression method, apparatus and computer equipment
CN111953977A (en) * 2020-07-09 2020-11-17 西安万像电子科技有限公司 Image transmission method, system and device

Also Published As

Publication number Publication date
CN117014557B (en) 2024-01-23

Similar Documents

Publication Publication Date Title
US8660347B2 (en) Image processing apparatus and processing method therefor
US5432870A (en) Method and apparatus for compressing and decompressing images of documents
US8849021B2 (en) Image processing apparatus, method, and storage medium for high speed compression processing
JP4176114B2 (en) Image compression apparatus, image reading apparatus including the same, image processing apparatus including the image compression apparatus, image forming apparatus including the same, and image compression processing method
JP2009153128A (en) Selective chrominance decimation for digital images
CN111429357B (en) Training data determining method, video processing method, device, equipment and medium
JP2001143066A (en) Image processor, image-processing system and storage medium, image-processing method and recording medium
US7991235B2 (en) Light compression for color images using error diffusion
CN112929624A (en) Encoding method, encoding device, electronic equipment and computer readable storage medium
CN117014557B (en) Compression method and device for document image, electronic equipment and storage medium
JP3108133B2 (en) Adaptive coding of color document images
JP4053460B2 (en) Image processing apparatus, image forming apparatus, image processing method, image processing program, and recording medium
KR20170046136A (en) Method for choosing a compression algorithm depending on the image type
JPH1175183A (en) Image signal processing method and device and storage medium
JP3953183B2 (en) Image communication method and image communication apparatus
JP2004135254A (en) Image processing unit
JP4040528B2 (en) Image processing apparatus, image processing method, image processing program, recording medium storing image processing program, and image forming apparatus including image processing apparatus
JP3595601B2 (en) Image communication method and apparatus
JP3979020B2 (en) Image processing apparatus for sampling compressed image
JP4926128B2 (en) Image processing apparatus, image reading apparatus, image forming apparatus, computer program, recording medium, and image processing method
JP2832073B2 (en) Image coding device
JP2877448B2 (en) Image coding device
JP4116193B2 (en) Color image processing apparatus and color image processing method
JP2004274143A (en) Image processor and its method
JP3083336B2 (en) Image processing apparatus and method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant