[go: up one dir, main page]

CN107147914A - An embedded system, a monochrome bitmap compression method, and a host computer - Google Patents

An embedded system, a monochrome bitmap compression method, and a host computer Download PDF

Info

Publication number
CN107147914A
CN107147914A CN201710422841.5A CN201710422841A CN107147914A CN 107147914 A CN107147914 A CN 107147914A CN 201710422841 A CN201710422841 A CN 201710422841A CN 107147914 A CN107147914 A CN 107147914A
Authority
CN
China
Prior art keywords
pixel
information
value
color value
pixels
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.)
Pending
Application number
CN201710422841.5A
Other languages
Chinese (zh)
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.)
Guangdong University of Technology
Original Assignee
Guangdong University of Technology
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 Guangdong University of Technology filed Critical Guangdong University of Technology
Priority to CN201710422841.5A priority Critical patent/CN107147914A/en
Publication of CN107147914A publication Critical patent/CN107147914A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

This application discloses a kind of embedded system and monochrome bitmap compression method, main frame, this method includes:The Pixel Information in monochrome bitmap is counted, multigroup Pixel Information is obtained;Wherein, color value of the every group of Pixel Information including pixel and with the color value and the quantitative value of pixel continuously arranged on location of pixels;Record is merged to every group of Pixel Information respectively, corresponding compressed data is obtained.The application realizes the compression purpose to monochrome bitmap in embedded system, so as to reduce the data volume size of monochrome bitmap, be conducive to improving storage capacity of the single-chip microcomputer to view data in embedded system, and during above-mentioned compressed data is sent into single-chip microcomputer, can spend less time just can realize the transmission to view data, improve data transmission efficiency.

Description

一种嵌入式系统及单色位图压缩方法、主机An embedded system, a monochrome bitmap compression method, and a host computer

技术领域technical field

本发明涉及图像压缩技术领域,特别涉及一种嵌入式系统及单色位图压缩方法、主机。The invention relates to the technical field of image compression, in particular to an embedded system, a monochrome bitmap compression method, and a host.

背景技术Background technique

当前,随着计算机硬件的快速发展,计算机的存储性能和计算性能已经得到了极大地提升。但是,在嵌入式系统中,其存储的量级很低,普遍在千字节级别左右。现有嵌入式系统中的单片机时常需要对单色位图等图片进行保存和处理,由于单色位图等图片的数据量相对单片机系统的存储容量来说较大,所以,如果直接将原始的单色位图传输给单片机进行保存和处理,不仅需要耗费较多的时间完成对图像数据的传输,导致较低的数据传输效率,并且需要占用单片机系统较多的存储容量,严重降低了单片机系统对图像数据的存储能力。因此,如何提高嵌入式系统中单片机对图像数据的存储能力是目前亟待解决的问题。Currently, with the rapid development of computer hardware, the storage performance and computing performance of computers have been greatly improved. However, in an embedded system, its storage level is very low, generally around the kilobyte level. The single-chip microcomputer in the existing embedded system often needs to save and process pictures such as monochrome bitmaps. Since the data volume of pictures such as monochrome bitmaps is relatively large compared with the storage capacity of the single-chip computer system, if the original The monochrome bitmap is transmitted to the single-chip microcomputer for storage and processing, which not only takes more time to complete the transmission of image data, but also leads to low data transmission efficiency, and requires more storage capacity of the single-chip system, which seriously reduces the performance of the single-chip system. Storage capacity for image data. Therefore, how to improve the storage capacity of the single-chip microcomputer in the embedded system to the image data is an urgent problem to be solved at present.

发明内容Contents of the invention

有鉴于此,本发明的目的在于提供一种嵌入式系统及单色位图压缩方法、主机,能够提高嵌入式系统中单片机对图像数据的存储能力。其具体方案如下:In view of this, the object of the present invention is to provide an embedded system, a monochrome bitmap compression method, and a host computer, which can improve the storage capacity of the single-chip microcomputer in the embedded system for image data. The specific plan is as follows:

一种应用于嵌入式系统的单色位图压缩方法,所述单色位图中任一像素的颜色值为第一颜色值或第二颜色值;所述方法包括:A monochrome bitmap compression method applied to an embedded system, the color value of any pixel in the monochrome bitmap is a first color value or a second color value; the method includes:

统计所述单色位图中的像素信息,得到多组像素信息;其中,每组像素信息均包括像素的颜色值以及具有该颜色值的并且在像素位置上连续排布的像素的数量值;Counting the pixel information in the monochromatic bitmap to obtain multiple sets of pixel information; wherein each set of pixel information includes a color value of a pixel and a quantity value of pixels having the color value and continuously arranged at the pixel position;

分别对每组像素信息进行合并记录,得到相应的压缩数据。Combine and record each group of pixel information to obtain corresponding compressed data.

可选的,所述统计所述单色位图中的像素信息,得到多组像素信息的过程,包括:Optionally, the process of counting pixel information in the monochrome bitmap to obtain multiple sets of pixel information includes:

对所述单色位图展开逐像素扫描,以确定每一像素的颜色值,并将在像素位置上连续排布的具有相同颜色值的像素的信息确定为同一组像素信息,得到所述多组像素信息;其中,所述在像素位置上连续排布的具有相同颜色值的像素的信息包括像素的颜色值以及像素的数量值。Scan the monochrome bitmap pixel by pixel to determine the color value of each pixel, and determine the information of pixels with the same color value that are continuously arranged at the pixel position as the same group of pixel information, and obtain the multiple A group of pixel information; wherein, the information of the pixels with the same color value arranged continuously at the pixel position includes the color value of the pixel and the number value of the pixel.

可选的,同一组像素信息中的像素的数量值小于或等于预设数量阈值。Optionally, the number of pixels in the same group of pixel information is less than or equal to a preset number threshold.

可选的,所述将在像素位置上连续排布的具有相同颜色值的像素的信息确定为同一组像素信息的过程,包括:Optionally, the process of determining the information of pixels with the same color value arranged continuously at the pixel position as the same group of pixel information includes:

利用N位X进制数,对当前在像素位置上连续排布的具有相同颜色值的像素的颜色值进行指示,得到像素颜色指示符;Using an N-bit X-ary number to indicate the color values of pixels with the same color value that are currently continuously arranged at the pixel position, to obtain a pixel color indicator;

利用M位X进制数,对当前在像素位置上连续排布的具有相同颜色值的像素的数量值进行指示,得到像素数量指示符;Using an M-bit X-ary number to indicate the number of pixels with the same color value that are currently arranged continuously at the pixel position, to obtain a pixel number indicator;

其中,N值、M值以及X值均为正整数,所述预设数量阈值为XM-1。Wherein, the N value, the M value and the X value are all positive integers, and the preset number threshold is X M −1.

可选的,所述分别对每组像素信息进行合并记录,得到相应的压缩数据的过程,包括:Optionally, the process of combining and recording each group of pixel information to obtain corresponding compressed data includes:

分别对每组像素信息中像素颜色指示符以及像素数量指示符进行合并记录,得到与每组像素信息对应的压缩数据。Combining and recording the pixel color indicator and the pixel quantity indicator in each group of pixel information to obtain compressed data corresponding to each group of pixel information.

本发明还相应公开了一种应用于嵌入式系统的单色位图压缩主机,所述单色位图中任一像素的颜色值为第一颜色值或第二颜色值;所述主机包括:The present invention also correspondingly discloses a monochrome bitmap compression host applied to an embedded system, the color value of any pixel in the monochrome bitmap is the first color value or the second color value; the host includes:

统计所述单色位图中的多组像素信息的处理器;其中,每组像素信息均包括像素的颜色值以及具有该颜色值的并且在像素位置上连续排布的像素的数量值;A processor for counting multiple sets of pixel information in the monochrome bitmap; wherein each set of pixel information includes a color value of a pixel and a quantity value of pixels having the color value and continuously arranged at the pixel position;

分别对每组像素信息进行合并记录得到相应的压缩数据的存储装置。A storage device for combining and recording each group of pixel information to obtain corresponding compressed data.

可选的,所述处理器,包括:Optionally, the processor includes:

像素扫描模块,用于对所述单色位图展开逐像素扫描,以确定每一像素的颜色值;A pixel scanning module, configured to scan the monochrome bitmap pixel by pixel to determine the color value of each pixel;

信息确定模块,用于根据所述像素扫描模块的扫描结果,将在像素位置上连续排布的具有相同颜色值的像素的信息确定为同一组像素信息,得到所述多组像素信息;其中,所述在像素位置上连续排布的具有相同颜色值的像素的信息包括像素的颜色值以及像素的数量值。An information determination module, configured to determine the information of pixels with the same color value continuously arranged at the pixel position as the same group of pixel information according to the scanning result of the pixel scanning module, so as to obtain the multiple groups of pixel information; wherein, The information of the pixels with the same color value arranged continuously at the pixel position includes the color value of the pixel and the quantity value of the pixel.

可选的,同一组像素信息中的像素的数量值小于或等于预设数量阈值,并且,所述信息确定模块,包括:Optionally, the number of pixels in the same group of pixel information is less than or equal to a preset number threshold, and the information determination module includes:

第一指示单元,用于利用N位X进制数,对当前在像素位置上连续排布的具有相同颜色值的像素的颜色值进行指示,得到像素颜色指示符;The first indicating unit is used to indicate the color values of pixels with the same color value that are currently arranged continuously at the pixel position by using an N-bit X-ary number, so as to obtain a pixel color indicator;

第二指示单元,用于利用M位X进制数,对当前在像素位置上连续排布的具有相同颜色值的像素的数量值进行指示,得到像素数量指示符;The second indicating unit is used to use the M-bit X-ary number to indicate the quantity value of the pixels with the same color value that are currently arranged continuously at the pixel position, so as to obtain a pixel quantity indicator;

其中,N值、M值以及X值均为正整数,所述预设数量阈值为XM-1。Wherein, the N value, the M value and the X value are all positive integers, and the preset number threshold is X M −1.

可选的,所述存储装置,具体用于分别对每组像素信息中像素颜色指示符以及像素数量指示符进行合并记录,得到与每组像素信息对应的压缩数据。Optionally, the storage device is specifically configured to respectively combine and record the pixel color indicator and the pixel quantity indicator in each set of pixel information to obtain compressed data corresponding to each set of pixel information.

本发明进一步公开了一种嵌入式系统,包括前述公开的单色位图压缩主机,还包括用于对所述单色位图压缩主机输出的压缩数据进行处理的单片机。The present invention further discloses an embedded system, which includes the above-mentioned monochrome bitmap compression host, and also includes a single-chip microcomputer for processing the compressed data output by the monochrome bitmap compression host.

本发明中,单色位图压缩方法,包括:统计单色位图中的像素信息,得到多组像素信息;其中,每组像素信息均包括像素的颜色值以及具有该颜色值的并且在像素位置上连续排布的像素的数量值;分别对每组像素信息进行合并记录,得到相应的压缩数据。In the present invention, the monochrome bitmap compression method includes: counting the pixel information in the monochrome bitmap to obtain multiple sets of pixel information; wherein, each set of pixel information includes the color value of the pixel and the information with the color value and in the pixel The quantity value of the pixels arranged continuously on the position; each group of pixel information is merged and recorded separately to obtain the corresponding compressed data.

可见,本发明先统计单色位图的像素信息,从而得到多组像素信息,其中,每组像素信息中均包含单色位图上像素的颜色值以及具有该颜色值的并且在像素位置上连续排布的像素的数量值,这样相当于将单色位图上每个像素的颜色以及位置信息进行了统计,最后通过将上述统计信息进行合并记录,便可得到相应的压缩数据,由此实现了对嵌入式系统中单色位图的压缩目的,从而降低了单色位图的数据量大小,有利于提高嵌入式系统中单片机对图像数据的存储能力,并且在将上述压缩数据传送至单片机的过程中,可以花费更少的时间便可实现对图像数据的传输,提升了数据传输效率。It can be seen that the present invention first counts the pixel information of the monochrome bitmap, thereby obtaining multiple sets of pixel information, wherein each set of pixel information includes the color value of the pixel on the monochrome bitmap and the pixel with the color value and at the pixel position. The number of consecutively arranged pixels is equivalent to counting the color and position information of each pixel on the monochrome bitmap. Finally, the corresponding compressed data can be obtained by combining and recording the above statistical information. Realize the purpose of compressing the monochrome bitmap in the embedded system, thereby reducing the data size of the monochrome bitmap, which is conducive to improving the storage capacity of the single-chip microcomputer in the embedded system for image data, and the above-mentioned compressed data is transmitted to In the process of single-chip microcomputer, it can spend less time to realize the transmission of image data, which improves the efficiency of data transmission.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only It is an embodiment of the present invention, and those skilled in the art can also obtain other drawings according to the provided drawings without creative work.

图1为本发明实施例公开的一种应用于嵌入式系统的单色位图压缩方法流程图;Fig. 1 is a flow chart of a monochrome bitmap compression method applied to an embedded system disclosed by an embodiment of the present invention;

图2为本发明实施例公开的一种单色位图数据压缩示意图;Fig. 2 is a schematic diagram of monochrome bitmap data compression disclosed by an embodiment of the present invention;

图3为本发明实施例公开的另一种单色位图数据压缩示意图;Fig. 3 is another schematic diagram of monochrome bitmap data compression disclosed by the embodiment of the present invention;

图4为本发明实施例公开的一种具体的单色位图压缩流程图;Fig. 4 is a specific monochrome bitmap compression flow chart disclosed by the embodiment of the present invention;

图5为本发明实施例公开的一种应用于嵌入式系统的单色位图压缩主机结构示意图;Fig. 5 is a schematic structural diagram of a monochrome bitmap compression host applied to an embedded system disclosed by an embodiment of the present invention;

图6为本发明实施例公开的一种嵌入式系统结构示意图。FIG. 6 is a schematic structural diagram of an embedded system disclosed by an embodiment of the present invention.

具体实施方式detailed description

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

本发明实施例公开了一种应用于嵌入式系统的单色位图压缩方法,其中,单色位图中任一像素的颜色值为第一颜色值或第二颜色值;通常,上述第一颜色值和第二颜色值分别为1和0,也即,本实施例中单色位图是由颜色值为1和0的像素构成的位图。参见图1所示,上述方法包括:The embodiment of the present invention discloses a monochrome bitmap compression method applied to an embedded system, wherein the color value of any pixel in the monochrome bitmap is the first color value or the second color value; usually, the above-mentioned first The color value and the second color value are 1 and 0 respectively, that is, the monochrome bitmap in this embodiment is a bitmap composed of pixels with color values 1 and 0. Referring to shown in Figure 1, the above-mentioned method comprises:

步骤S11:统计单色位图中的像素信息,得到多组像素信息;其中,每组像素信息均包括像素的颜色值以及具有该颜色值的并且在像素位置上连续排布的像素的数量值。Step S11: Count the pixel information in the monochrome bitmap to obtain multiple sets of pixel information; wherein, each set of pixel information includes the color value of the pixel and the number of pixels with the color value and continuously arranged at the pixel position .

也即,本实施例先对单色位图上的像素信息进行统计,相应地得到多组像素信息,并且,每组像素信息中均包括如下信息:像素的颜色值以及具有该颜色值的并且在像素位置上连续排序的像素的数量值。例如,假设在一个单色位图上的某一行像素中,依次排布了5个连续的颜色值为0的像素、100个连续的颜色值为1的像素、120个连续的颜色值为0的像素以及25个连续的颜色值为1的像素,则在经过上述步骤S11的处理之后,至少可以确定出两组像素信息,其中一组像素信息包括颜色值1以及像素数量值100,另一组像素信息包括颜色值0以及像素数量值120。That is to say, in this embodiment, the pixel information on the monochrome bitmap is firstly counted, and multiple sets of pixel information are obtained correspondingly, and each set of pixel information includes the following information: the color value of the pixel and the pixel with the color value and The value of the number of pixels sequentially ordered at the pixel position. For example, suppose that in a row of pixels on a monochrome bitmap, 5 consecutive pixels with a color value of 0, 100 consecutive pixels with a color value of 1, and 120 consecutive pixels with a color value of 0 are arranged in sequence. pixels and 25 consecutive pixels with a color value of 1, after the processing of the above step S11, at least two sets of pixel information can be determined, wherein one set of pixel information includes a color value of 1 and a pixel quantity value of 100, and the other The group pixel information includes a color value of 0 and a pixel count value of 120.

由上可见,通过上述对单色位图中的像素信息进行统计的过程,本实施例达到了只需利用两个数值便可反映出在位置上连续排布的具有相同颜色值的像素的信息,从而大幅减少了数据量。It can be seen from the above that through the above-mentioned process of counting the pixel information in the monochrome bitmap, this embodiment can reflect the information of pixels with the same color value that are continuously arranged in position by only using two values. , thereby greatly reducing the amount of data.

步骤S12:分别对每组像素信息进行合并记录,得到相应的压缩数据。Step S12: Combining and recording each group of pixel information to obtain corresponding compressed data.

可见,本发明实施例先统计单色位图的像素信息,从而得到多组像素信息,其中,每组像素信息中均包含单色位图上像素的颜色值以及具有该颜色值的并且在像素位置上连续排布的像素的数量值,这样相当于将单色位图上每个像素的颜色以及位置信息进行了统计,最后通过将上述统计信息进行合并记录,便可得到相应的压缩数据,由此实现了对嵌入式系统中单色位图的压缩目的,从而降低了单色位图的数据量大小,有利于提高嵌入式系统中单片机对图像数据的存储能力,并且在将上述压缩数据传送至单片机的过程中,可以花费更少的时间便可实现对图像数据的传输,提升了数据传输效率。It can be seen that in the embodiment of the present invention, the pixel information of the monochrome bitmap is counted first, so as to obtain multiple sets of pixel information, wherein each set of pixel information includes the color value of the pixel on the monochrome bitmap and the color value of the pixel with the color value and in the pixel The number of pixels arranged continuously on the position, which is equivalent to counting the color and position information of each pixel on the monochrome bitmap, and finally by merging and recording the above statistical information, the corresponding compressed data can be obtained. Thus, the purpose of compressing the monochrome bitmap in the embedded system is realized, thereby reducing the data size of the monochrome bitmap, which is conducive to improving the storage capacity of the single-chip microcomputer in the embedded system for image data, and the above-mentioned compressed data In the process of transmitting to the single-chip microcomputer, the transmission of image data can be realized in less time, and the efficiency of data transmission is improved.

本发明实施例公开了一种具体的应用于嵌入式系统的单色位图压缩方法,相对于上一实施例,本实施例对技术方案作了进一步的说明和优化。具体的:The embodiment of the present invention discloses a specific monochrome bitmap compression method applied to an embedded system. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. specific:

上一实施例步骤S11中,统计单色位图中的像素信息,得到多组像素信息的过程,具体可以包括:对单色位图展开逐像素扫描,以确定每一像素的颜色值,并将在像素位置上连续排布的具有相同颜色值的像素的信息确定为同一组像素信息,得到多组像素信息;其中,在像素位置上连续排布的具有相同颜色值的像素的信息包括像素的颜色值以及像素的数量值。In step S11 of the previous embodiment, the process of counting the pixel information in the monochrome bitmap to obtain multiple sets of pixel information may specifically include: scanning the monochrome bitmap pixel by pixel to determine the color value of each pixel, and Determine the information of pixels with the same color value continuously arranged at the pixel position as the same group of pixel information to obtain multiple sets of pixel information; wherein, the information of pixels with the same color value continuously arranged at the pixel position includes pixel The color value and the number value of the pixel.

进一步的,上述同一组像素信息中的像素的数量值小于或等于预设数量阈值。Further, the number of pixels in the same group of pixel information is less than or equal to a preset number threshold.

另外,上述将在像素位置上连续排布的具有相同颜色值的像素的信息确定为同一组像素信息的过程,具体可以包括:In addition, the above-mentioned process of determining the information of pixels with the same color value arranged continuously at the pixel position as the same group of pixel information may specifically include:

利用N位X进制数,对当前在像素位置上连续排布的具有相同颜色值的像素的颜色值进行指示,得到像素颜色指示符;利用M位X进制数,对当前在像素位置上连续排布的具有相同颜色值的像素的数量值进行指示,得到像素数量指示符;Use the N-bit X-ary number to indicate the color values of the pixels with the same color value that are continuously arranged at the pixel position to obtain the pixel color indicator; use the M-bit X-ary number to indicate the current pixel position Indicate the number of pixels with the same color value that are arranged consecutively to obtain a pixel number indicator;

其中,N值、M值以及X值均为正整数,与此对应的,上述预设数量阈值具体为XM-1。Wherein, the N value, the M value, and the X value are all positive integers, and correspondingly, the above preset quantity threshold is specifically X M -1.

上一实施例步骤S12中,分别对每组像素信息进行合并记录,得到相应的压缩数据的过程,具体可以包括:In step S12 of the previous embodiment, the process of combining and recording each group of pixel information to obtain corresponding compressed data may specifically include:

分别对每组像素信息中像素颜色指示符以及像素数量指示符进行合并记录,得到与每组像素信息对应的压缩数据。Combining and recording the pixel color indicator and the pixel quantity indicator in each group of pixel information to obtain compressed data corresponding to each group of pixel information.

本实施例可以利用单字节来记录每组像素信息,例如,每个单字节可以是8位的二进制数。其中,可以利用单字节中的第7位来记录像素颜色指示符,如果单字节中的第7位为0,则表示相应像素的颜色值为0,如果单字节中的第7位为1,则表示相应像素的颜色值为1。另外,利用单字节中的第0位至第6位来记录像素数量指示符。可以理解的是,利用单字节中的第0位至第6位,可记录的像素的数量最大为127个,也即,在这里上述预设数量阈值为127。In this embodiment, a single byte may be used to record each group of pixel information, for example, each single byte may be an 8-bit binary number. Among them, the 7th bit in the single byte can be used to record the pixel color indicator, if the 7th bit in the single byte is 0, it means that the color value of the corresponding pixel is 0, if the 7th bit in the single byte If it is 1, it means that the color value of the corresponding pixel is 1. In addition, the pixel number indicator is recorded using bits 0 to 6 in a single byte. It can be understood that, using bits 0 to 6 in a single byte, the maximum number of recordable pixels is 127, that is, the above preset number threshold is 127 here.

参见图2所示,如果在单色位图的某个位置区域上出现200个连续的颜色值为1的像素点,则在未经过压缩的情况下,以16进制表示,其结果是:As shown in Figure 2, if 200 consecutive pixels with a color value of 1 appear in a certain position area of the monochrome bitmap, the result is expressed in hexadecimal without compression, and the result is:

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF。0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF.

由上可见,在未经过压缩的情况下,如果以16进制表示上述200个连续的颜色值为1的像素点,则总共需要占用了25个字节的数据长度。而如果利用本发明实施例公开的压缩方法进行处理之后,同样以16进制表示压缩结果,则结果是:0xFF,0xC9,只需占用2个字节的数据长度。It can be seen from the above that, in the case of no compression, if the above 200 consecutive pixels with a color value of 1 are expressed in hexadecimal, a data length of 25 bytes is required in total. However, if the compression method disclosed in the embodiment of the present invention is used for processing, and the compression result is also expressed in hexadecimal, the result is: 0xFF, 0xC9, which only needs to occupy a data length of 2 bytes.

参见图3所示,如果在单色位图的某两个位置区域上分别出现80个连续的颜色值为1的像素点和75个连续的颜色值为0的像素点,在未经过压缩的情况下,以16进制形式表示,其结果是:As shown in Figure 3, if there are 80 consecutive pixels with a color value of 1 and 75 consecutive pixels with a color value of 0 in two positions of the monochrome bitmap, the uncompressed case, expressed in hexadecimal form, the result is:

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,总共占用了20个字节的数据长度。而如果利用本发明实施例中公开的压缩方法进行处理之后,同样以16进制表示压缩结果,则结果是:0xD0,0x4B,只需占用2个字节的数据长度。0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, occupying a total of 20 bytes of data length . However, if the compression method disclosed in the embodiment of the present invention is used for processing, and the compression result is also expressed in hexadecimal, the result is: 0xD0, 0x4B, which only needs to occupy a data length of 2 bytes.

在前述实施例的基础上,本发明实施例进一步公开了一种具体的单色位图压缩流程,参见图4所示,具体包括:On the basis of the foregoing embodiments, the embodiment of the present invention further discloses a specific monochrome bitmap compression process, as shown in FIG. 4 , specifically including:

步骤S1,扫描单色位图数据,记录连续的0或1的个数记为total。In step S1, the monochrome bitmap data is scanned, and the number of consecutive 0s or 1s is recorded as total.

步骤S2,若total的值小于或等于127,则将当前扫描到的数据与上一个扫描进行对比,如果两次扫描到的数据不一致(例如当前扫描到0,上一个扫描到的是1),则将像素数量指示符的值设置为当前total的值,执行步骤S4,否则执行步骤S1。Step S2, if the value of total is less than or equal to 127, compare the currently scanned data with the previous scan, if the two scanned data are inconsistent (for example, the current scan is 0, and the previous scan is 1), Then set the value of the pixel quantity indicator as the current value of total, execute step S4, otherwise execute step S1.

步骤S3,当total的值大于127时,则将像素数量指示符的值设置为127,执行步骤S4。In step S3, when the value of total is greater than 127, the value of the pixel quantity indicator is set to 127, and step S4 is executed.

步骤S4,执行压缩,用单字节数据描述扫描到的结果,如果此时数据扫描完毕,则退出扫描和压缩过程,否则继续执行步骤S1,并循环。Step S4, perform compression, describe the scanned result with single-byte data, if the data scanning is completed at this time, exit the scanning and compression process, otherwise continue to execute step S1, and loop.

通过本发明实施例公开的压缩方法对单色位图进行压缩,图像数据越简单(即出现大量的连续的0或连续的1),所产生的压缩比就越高,如图2和图3所描述的例子,其压缩比分别达到了25:2和20:2,极大降低了单色位图数据的传输时间和单色位图数据在嵌入式系统上所占的存储容量。The monochromatic bitmap is compressed by the compression method disclosed in the embodiment of the present invention. The simpler the image data (that is, there are a large number of continuous 0s or continuous 1s), the higher the resulting compression ratio, as shown in Figure 2 and Figure 3 In the described example, the compression ratio reaches 25:2 and 20:2 respectively, which greatly reduces the transmission time of the monochrome bitmap data and the storage capacity occupied by the monochrome bitmap data on the embedded system.

相应的,本发明实施例还公开了一种应用于嵌入式系统的单色位图压缩主机,其中,单色位图中任一像素的颜色值为第一颜色值或第二颜色值;参见图5所示,上述主机包括:Correspondingly, the embodiment of the present invention also discloses a monochrome bitmap compression host applied to an embedded system, wherein the color value of any pixel in the monochrome bitmap is the first color value or the second color value; see As shown in Figure 5, the above hosts include:

统计单色位图中的多组像素信息的处理器11;其中,每组像素信息均包括像素的颜色值以及具有该颜色值的并且在像素位置上连续排布的像素的数量值;A processor 11 for counting multiple groups of pixel information in a monochrome bitmap; wherein each group of pixel information includes a color value of a pixel and a quantity value of pixels having the color value and continuously arranged at the pixel position;

分别对每组像素信息进行合并记录得到相应的压缩数据的存储装置12。Combining and recording each group of pixel information respectively to obtain the corresponding compressed data storage device 12 .

其中,上述处理器,具体可以包括像素扫描模块和信息确定模块;其中,Wherein, the above-mentioned processor may specifically include a pixel scanning module and an information determination module; wherein,

像素扫描模块,用于对单色位图展开逐像素扫描,以确定每一像素的颜色值;The pixel scanning module is used to scan the monochrome bitmap pixel by pixel to determine the color value of each pixel;

信息确定模块,用于根据像素扫描模块的扫描结果,将在像素位置上连续排布的具有相同颜色值的像素的信息确定为同一组像素信息,得到多组像素信息;其中,在像素位置上连续排布的具有相同颜色值的像素的信息包括像素的颜色值以及像素的数量值。The information determining module is used to determine the information of pixels with the same color value arranged continuously at the pixel position as the same group of pixel information according to the scanning result of the pixel scanning module, and obtain multiple sets of pixel information; wherein, at the pixel position The information of consecutively arranged pixels with the same color value includes the color value of the pixel and the number value of the pixel.

其中,上述同一组像素信息中的像素的数量值小于或等于预设数量阈值,并且,信息确定模块,包括:Wherein, the number of pixels in the above-mentioned same group of pixel information is less than or equal to the preset number threshold, and the information determination module includes:

第一指示单元,用于利用N位X进制数,对当前在像素位置上连续排布的具有相同颜色值的像素的颜色值进行指示,得到像素颜色指示符;The first indicating unit is used to indicate the color values of pixels with the same color value that are currently arranged continuously at the pixel position by using an N-bit X-ary number, so as to obtain a pixel color indicator;

第二指示单元,用于利用M位X进制数,对当前在像素位置上连续排布的具有相同颜色值的像素的数量值进行指示,得到像素数量指示符;The second indicating unit is used to use the M-bit X-ary number to indicate the quantity value of the pixels with the same color value that are currently arranged continuously at the pixel position, so as to obtain a pixel quantity indicator;

其中,N值、M值以及X值均为正整数,相应的,上述预设数量阈值具体为XM-1。Wherein, the N value, the M value, and the X value are all positive integers, and correspondingly, the aforementioned preset quantity threshold is specifically X M -1.

另外,上述存储装置具体可以用于分别对每组像素信息中像素颜色指示符以及像素数量指示符进行合并记录,得到与每组像素信息对应的压缩数据。In addition, the above-mentioned storage device may specifically be used to combine and record the pixel color indicator and the pixel quantity indicator in each group of pixel information respectively, so as to obtain the compressed data corresponding to each group of pixel information.

关于上述各个器件、模块和单元的更加具体的工作过程可以参考前述实施例中公开的相应内容,在此不再进行赘述。For more specific working processes of the above-mentioned components, modules and units, reference may be made to the corresponding content disclosed in the foregoing embodiments, and details are not repeated here.

进一步的,本发明实施例还公开了一种嵌入式系统,参见图6所示,该系统包括前述实施例公开的单色位图压缩主机21,还包括用于对单色位图压缩主机21输出的压缩数据进行处理的单片机22。Further, the embodiment of the present invention also discloses an embedded system, as shown in FIG. 6 , the system includes the monochrome bitmap compression host 21 disclosed in the foregoing embodiments, and also includes a host 21 for compressing the monochrome bitmap The output compressed data is processed by the single chip microcomputer 22.

关于上述单色位图压缩主机的具体构造和功能可以参考前述实施例中公开的相应内容,在此不再进行赘述。Regarding the specific structure and functions of the above-mentioned monochrome bitmap compression host, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and details are not repeated here.

最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。Finally, it should also be noted that in this text, relational terms such as first and second etc. are only used to distinguish one entity or operation from another, and do not necessarily require or imply that these entities or operations, any such actual relationship or order exists. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.

以上对本发明所提供的一种嵌入式系统及单色位图压缩方法、主机进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。A kind of embedded system provided by the present invention and monochrome bitmap compression method, host computer have been introduced in detail above, have applied specific example in this paper and explained the principle of the present invention and implementation mode, and the explanation of above embodiment is just to use To help understand the method of the present invention and its core idea; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation and scope of application. In summary, this specification The content should not be construed as a limitation of the invention.

Claims (10)

1. A compression method of a monochromatic bitmap applied to an embedded system is characterized in that the color value of any pixel in the monochromatic bitmap is a first color value or a second color value; the method comprises the following steps:
counting pixel information in the monochromatic bitmap to obtain a plurality of groups of pixel information; wherein each set of pixel information includes a color value of a pixel and a quantity value of pixels having the color value and arranged consecutively at pixel positions;
and respectively merging and recording each group of pixel information to obtain corresponding compressed data.
2. The method as claimed in claim 1, wherein the process of counting pixel information in the monochrome bitmap to obtain multiple sets of pixel information comprises:
the monochromatic bitmap is unfolded and scanned pixel by pixel to determine the color value of each pixel, and the information of the pixels which are continuously arranged at the pixel position and have the same color value is determined as the information of the same group of pixels to obtain the information of the plurality of groups of pixels; the information of the pixels with the same color value, which are continuously arranged at the pixel position, comprises the color value of the pixel and the quantity value of the pixel.
3. The monochrome bitmap compression method of claim 2,
the quantity value of the pixels in the same group of pixel information is less than or equal to a preset quantity threshold value.
4. The monochrome bitmap compression method according to claim 3, wherein the process of determining information of pixels having the same color value consecutively arranged at pixel positions as the same set of pixel information comprises:
indicating the color values of pixels which are continuously arranged at the current pixel position and have the same color value by using an N-bit X-ary number to obtain a pixel color indicator;
indicating the quantity value of pixels which are continuously arranged at the pixel position and have the same color value by using an M-bit X-system number to obtain a pixel quantity indicator;
wherein, the N value, the M value and the X value are all positive integers, and the preset number threshold is XM-1。
5. The method of claim 4, wherein the process of merging and recording each group of pixel information to obtain the corresponding compressed data comprises:
and respectively merging and recording the pixel color indicator and the pixel quantity indicator in each group of pixel information to obtain compressed data corresponding to each group of pixel information.
6. A monochrome bitmap compression host applied to an embedded system is characterized in that the color value of any pixel in the monochrome bitmap is a first color value or a second color value; the host includes:
a processor for counting a plurality of groups of pixel information in the monochromatic bitmap; wherein each set of pixel information includes a color value of a pixel and a quantity value of pixels having the color value and arranged consecutively at pixel positions;
and the storage device is used for respectively merging and recording each group of pixel information to obtain corresponding compressed data.
7. The unicolor bitmap compression host of claim 6, wherein the processor comprises:
a pixel scanning module for performing a pixel-by-pixel scan of the monochrome bitmap to determine a color value for each pixel;
the information determining module is used for determining the information of the pixels with the same color value continuously arranged at the pixel position as the same group of pixel information according to the scanning result of the pixel scanning module to obtain the multiple groups of pixel information; the information of the pixels with the same color value, which are continuously arranged at the pixel position, comprises the color value of the pixel and the quantity value of the pixel.
8. A unicolor bitmap compression host according to claim 7,
the number value of pixels in the same group of pixel information is less than or equal to a preset number threshold, and the information determining module comprises:
the first indicating unit is used for indicating the color values of pixels which are continuously arranged at the current pixel position and have the same color value by using an N-bit X-ary number to obtain a pixel color indicator;
the second indicating unit is used for indicating the quantity value of the pixels which are continuously arranged at the pixel position and have the same color value by using an M-bit X-system number to obtain a pixel quantity indicator;
wherein, the N value, the M value and the X value are all positive integers, and the preset number threshold is XM-1。
9. A unicolor bitmap compression host according to claim 8,
the storage device is specifically configured to merge and record the pixel color indicator and the pixel quantity indicator in each group of pixel information, respectively, to obtain compressed data corresponding to each group of pixel information.
10. An embedded system, comprising the monochrome bitmap compression host according to any one of claims 6 to 9, and further comprising a single chip microcomputer for processing compressed data output by the monochrome bitmap compression host.
CN201710422841.5A 2017-06-07 2017-06-07 An embedded system, a monochrome bitmap compression method, and a host computer Pending CN107147914A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710422841.5A CN107147914A (en) 2017-06-07 2017-06-07 An embedded system, a monochrome bitmap compression method, and a host computer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710422841.5A CN107147914A (en) 2017-06-07 2017-06-07 An embedded system, a monochrome bitmap compression method, and a host computer

Publications (1)

Publication Number Publication Date
CN107147914A true CN107147914A (en) 2017-09-08

Family

ID=59780598

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710422841.5A Pending CN107147914A (en) 2017-06-07 2017-06-07 An embedded system, a monochrome bitmap compression method, and a host computer

Country Status (1)

Country Link
CN (1) CN107147914A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110740138A (en) * 2019-10-24 2020-01-31 北京百度网讯科技有限公司 Data transmission method and device
CN111614901A (en) * 2020-05-27 2020-09-01 惠州Tcl移动通信有限公司 Image shooting method and device, storage medium and terminal
CN113989095A (en) * 2021-11-08 2022-01-28 同智伟业软件股份有限公司 A kind of digital blind watermark production and extraction method
CN114119784A (en) * 2021-11-25 2022-03-01 业成科技(成都)有限公司 Electronic tag display image processing method and device and computer equipment
CN116405685A (en) * 2023-06-08 2023-07-07 安元科技股份有限公司 Image data compression method applied to test process record

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101546434A (en) * 2008-03-28 2009-09-30 深圳市同洲电子股份有限公司 Method and system for compressing and decompressing BMP picture file
US20110158525A1 (en) * 2009-12-25 2011-06-30 Canon Kabushiki Kaisha Image processing apparatus and image processing method
CN102523444A (en) * 2011-11-22 2012-06-27 惠州市德赛西威汽车电子有限公司 Compression method for monochrome bitmap and system thereof
CN103488618A (en) * 2013-09-09 2014-01-01 广东威创视讯科技股份有限公司 Text information transmission method and system, and text information display method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101546434A (en) * 2008-03-28 2009-09-30 深圳市同洲电子股份有限公司 Method and system for compressing and decompressing BMP picture file
US20110158525A1 (en) * 2009-12-25 2011-06-30 Canon Kabushiki Kaisha Image processing apparatus and image processing method
CN102523444A (en) * 2011-11-22 2012-06-27 惠州市德赛西威汽车电子有限公司 Compression method for monochrome bitmap and system thereof
CN103488618A (en) * 2013-09-09 2014-01-01 广东威创视讯科技股份有限公司 Text information transmission method and system, and text information display method and system

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110740138A (en) * 2019-10-24 2020-01-31 北京百度网讯科技有限公司 Data transmission method and device
CN110740138B (en) * 2019-10-24 2022-08-19 北京百度网讯科技有限公司 Data transmission method and device
CN111614901A (en) * 2020-05-27 2020-09-01 惠州Tcl移动通信有限公司 Image shooting method and device, storage medium and terminal
CN113989095A (en) * 2021-11-08 2022-01-28 同智伟业软件股份有限公司 A kind of digital blind watermark production and extraction method
CN113989095B (en) * 2021-11-08 2024-12-27 同智伟业软件股份有限公司 A method for producing and extracting digital blind watermark
CN114119784A (en) * 2021-11-25 2022-03-01 业成科技(成都)有限公司 Electronic tag display image processing method and device and computer equipment
CN116405685A (en) * 2023-06-08 2023-07-07 安元科技股份有限公司 Image data compression method applied to test process record
CN116405685B (en) * 2023-06-08 2023-08-22 安元科技股份有限公司 Image data compression method applied to test process record

Similar Documents

Publication Publication Date Title
CN107147914A (en) An embedded system, a monochrome bitmap compression method, and a host computer
CN103209326B (en) PNG (Portable Network Graphic) image compression method
CN115460414B (en) Video compression method and system of baseboard management control chip and related components
EP1465418A1 (en) Image data format and reading and writing methods and apparatus therefor
CN112637598B (en) Video compression and decompression method, device, equipment and readable storage medium
WO2023103336A1 (en) Video data transmission method, video data decoding method, and related apparatuses
WO2020083019A1 (en) Decoding method based on multi-core processor, terminal device and storage medium
CN112686365B (en) Methods, devices and computer equipment for running neural network models
WO2021051532A1 (en) Data compression method, apparatus and device, and computer-readable storage medium
CN108881454A (en) Document transmission method, mobile terminal and storage medium
CN102387289B (en) Restructural arithmetic unit, data compression device and restructural operation method
WO2023061177A1 (en) Multi-data sending method, apparatus and device based on columnar data scanning, and multi-data receiving method, apparatus and device based on columnar data scanning
WO2025138715A1 (en) Image processing method and related device thereof
CN106998472A (en) The compression method and system of a kind of holding target information
WO2021237513A1 (en) Data compression storage system and method, processor, and computer storage medium
CN118823008A (en) Image processing method, device, electronic device and storage medium
CN1218256C (en) Equipment and method for selecting inactive display image
JP4246531B2 (en) Processing method, computer-readable medium, and system related to ink information in image file
US20250055593A1 (en) Multi-frequency based data sending method and apparatus, and multi-frequency based data receiving method
CN113706639B (en) Image compression method and device based on rectangular NAM, storage medium and computing equipment
CN117671042A (en) Compression method and device of mapping resource, storage medium and electronic equipment
CN114550899A (en) Image data processing method, system, device, storage medium and oral scanner
CN107436848A (en) It is a kind of to realize the method and device changed between user data and compressed data
WO2021203741A1 (en) Benchmark test method and system, and terminal device
CN119767007B (en) Video compression method, device, medium and product

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20170908

RJ01 Rejection of invention patent application after publication