(a) Field of the Invention
The invention relates to an image procession method and device, and particularly to an image compression/decompression method and device.
(b) Description of the Related Art
A conventional image display system, such as a digital capture system or a capture with sticker system, usually overlaps several images before displaying them, and the overlapped images may be compressed as JPEG (Joint Photographic Experts Group) format files.
The conventional image display system adopts a transparent decoding mechanism, in which certain feature such as a kind of color is defined as a transparent code. Namely, pixels with identical transparent codes are treated as transparent code pixels. Next, the image display system reads images of each frame from a memory unit and recognizes whether the pixels of the images are transparent code pixels. The transparent code pixels are not displayed, and their original display areas are replenished by pixels of other frames likewise placed in the same areas. For example, referring to
Referring to
However, since the improvement of frame-rate in data reading often restricted by the size of a memory unit, a real-time image display system, such as a viewfinder system, a capture with sticker system or a digital camera capture system, fails to simultaneously process and display the overlapped image D that carries considerable data amount. Also, the huge data amount of the overlapped image D may result in a reduced number of images that can be stored in the memory unit.
Hence, an object of the invention is to provide an image compression/decompression method to reduce occupied memory space of an image and the number of access times during image display.
The subject invention provides an image compression method for compressing raw image data. First, each pixel of the raw image data is received. Then, each pixel of the raw image data is compared with a default transparent code to recognize whether the pixel in the raw image data is a transparent code pixel. Finally, a single transparent code pixel or one transparent code pixel of a sequence of transparent code pixels is stored, and total length information of the single transparent code pixel or the series of the sequential transparent code pixels is acquired.
Further, the subject invention also provides an image decompression method for decompressing compressed image data, wherein the compressed image data include multiple pixels, at least one transparent code pixel and at least one total length information for recording the length of transparent code pixels. First, the compressed image data are received. Then, each pixel of the compressed image data is compared with a default transparent code to judge whether the received compressed image data are a transparent code pixel. Finally, a specific number determined according to the total length information of the transparent code pixels is outputted.
Through the design of the invention, a plenty of transparent code pixels in the overlapped images are replaced by at least one transparent code pixel together with its appended total length information, so that the occupied memory space of the overlapped images are reduced. Thus, the frame-rate in data reading of a real-time image display system can be improved.
Thereby, under the treatment of overlapping the images A, B, and C and compressing them into the image D, the occupied space of the image D equal to 70 k(=128 k−58 k) bytes is reduced to about half of its original occupied space (128 k bytes). Hence, through the design of the invention, the occupied memory space is considerably decreased and the access speed of the image display system is improved to easily achieve a real-time display.
Note that the representation of the total length information m includes, but is not limited to, the number, bytes, or occupied areas of pixels. Alternatively, it can be a user-defined parameter. Besides, the format of pixels is not limited and may be a RGB format, a YUV format, or a user-defined format.
According to the decompression method of the invention, the transparent code pixel is read out from the memory unit through the indication of the transparent code field T, and the total length information m is read out from the memory unit through the indication of the length field L. For example, assume that a transparent code field T contains a transparent code pixel T50 and an appended length field L, the image display system outputs the transparent code pixel T50 according to the total length information m. Also, assume that another transparent code field T contains a transparent code pixel T100, and the appended total length information m of a length field L equals to 5 pixels. Then it indicates the original image data includes a sequence of 5 transparent code pixels in which the transparent code pixel T100 is also included. As a result, when the image data in a memory unit are read, only the ordinary pixels P1-Pn, the transparent code field T, and the length field L are required to be read out, but not all the transparent code pixels T1-Tn as described in the conventional method. Therefore, the occupied memory and the number of access times are all reduced to result in a fine real-time image display.
Hence, the image compression/decompression method according to the invention is suitable for a real-time display system such as a viewfinder system, capture with sticker system, digital camera capture system, digital video camera capture system etc. However, this is not limited and the image compression/decompression method also suitable for other image display or data storage systems. Further, since the occupied memory and the number of access times are all reduced through the invention, the power consumption, the memory access bandwidth, and the complexity in decompression circuit design are all decreased as a result.
The read unit 621 fetches the raw image data from the memory unit 61 or the real-time image capture system (not shown). The transparent-code detecting unit 622 receives the raw image data and compares each pixel with a default transparent code. If ordinary pixels are detected, the transparent code detecting unit 622 outputs these pixels to the write unit 624, and then they are stored into the memory unit 61. On the contrary, if a single transparent code pixel or a sequence of transparent code pixels are detected, the transparent-code detecting unit 622 also outputs them to the write unit 624. Next, the write-in unit 624 saves the single transparent code pixel into the memory unit 61 as a transparent code field T, or saves one of the sequence of the transparent code pixels into the memory unit 61 as another transparent code field T. Meanwhile, the calculator 623 computes the total length of the single pixel or the sequence of the transparent code pixels and outputs it to the write unit 624. Finally, the write unit 624 saves this total length information m into the memory unit 61 as a length field L.
Note that in this embodiment, the calculator 623 may be a counter, adder, or other devices capable of performing calculation and data recording. The total length information m is appended to the transparent code pixels and stored into the memory unit 61. Also, the representation of the total length information m includes, but is not limited to, the number, bytes or occupied areas of pixels. Alternatively, it can be a user-defined parameter. Besides, the format of pixels is not limited and may be a RGB format, a YUV format, or a user-defined format.
The read unit 721 fetches the compressed image data from the memory unit 61. The transparent-code detecting unit 722 receives the compressed image data and compares each pixel with a default transparent code. In that case, the transparent code field T, i.e. the transparent code pixel, is detected and delivered to the output unit 723. When the ordinary pixels are detected, the output unit 723 outputs these pixels to a post-procession unit 73 for subsequent image processing treatments. When the transparent code field T, i.e. the transparent code pixel, is detected, the output unit 723outputs the number of the transparent code pixels to the post-procession unit 73 for subsequent image processing treatments, where the number of the transparent code pixels is determined according to the total length information m of the length field L appended to the transparent code field L.
Note that the post-procession unit 73 may be an ordinary display unit, a compression unit, or another type of image procession unit.
While the invention has been described by way of examples and in terms of the preferred embodiments, it is to be understood that the invention is not limited to the disclosed embodiments. On the contrary, it is intended to cover various modifications and similar arrangements as would be apparent to those skilled in the art.
Number | Date | Country | Kind |
---|---|---|---|
094125048 | Jul 2005 | TW | national |