The present invention relates to a compression method, especially to a compression method related with image data.
Along with fast development of computer technology and multimedia technology, a lot of digital information such as image, audio, video and text data is transmitted through the Internet. And these data are saved in computer storage devices in the form of Digital Multimedia for more stable, effective and long-term data storage. Owing to huge amount of the data, such multimedia data needs to be compressed for shorting of transmission time.
Conventionally, compression technology has two categories—Lossy Compression and Lossless Compression. Although compression effect of lossless compression is far inferior to that of the lossy compression, the lossless compression still plays an important role, meeting requirements of a lot of applications such as medical imaging, satellite remote sensing images, images of antiquities in digital museum, and biomedical image processing and analysis. The above applications have following common features: high requirements of image quality, high cost of image acquisition, complete and precise image compression and storage, and image analysis being used as judging criteria.
Furthermore, in medical systems nowadays, conventional medical equipment is replaced by digital medical devices such as capsule endoscopy that sends out the shot images from human bodies and the images are received by receivers outside. Because the receiver needs to work as long as 6-8 hours on patients, it must be compact, light weight and energy-saving. Thus a lot of challenges raised while designing the receivers. For example, as to digital cameras, decades of photos take huge memory space. In capsule endoscopy, more than fifty thousand photos may be shot inside the patient and the receiver needs to get them all available to the medical staff for providing diagnosis. Moreover, the image must be displayed in details so that medical staff can provide diagnosis and treatment according to the images accurately. Once lossy compression is applied, although the compression ratio is high, the image may distort while decompressing the images. Thus doctors may have errors in diagnosis due to distortion of the images.
There is a need to provide a novel image data compression method that not only overcomes distortion of the image while decompressing the image but also improves compression ratio.
Therefore it is a primary object of the present invention to provide an image data compression method that compresses image data with higher compression ratio by exploiting the characteristic of original image arrangements.
It is a further object of the present invention to provide an image data compression method that compresses data by lossless compression method for avoiding image distortion.
In order to achieve above objects, the image data compression method according to the present invention is composed of the following steps: check a variance between a first image data and a second image data and compare the variance with a threshold value. When the variance is smaller than a threshold value, compare the first image data and the second image data to estimate and generate a motion vector and compress the motion vector. Then calculate the first image data and the second image data according to the motion vector so as to get an offset value of the motion vector. Next, encode the offset value of the motion vector, compress the offset value of the motion vector, and encode as well as compress the first image data.
The structure and the technical means adopted by the present invention to achieve the above and other objects can be best understood by referring to the following detailed description of the preferred embodiments and the accompanying drawings, wherein
An image data compression method according to the present invention compresses image data with higher compression ratio by exploiting the characteristic of original image arrangements. And an encoding method JPEG-LS is used so as to prevent image distortion. Moreover, the present invention is applied to capsule endoscopy so that medical staff can make a diagnosis according to images shot by the technique.
Refer to
When the variance is over the threshold value, this represents large differences between the first image data and the second image data. For example, when an image showing forest changes to an image showing canyon, the variance between the two images is quite large. While a man is riding a bike, there is only a bit difference between the two adjacent images. The variance is smaller than the threshold value and this means the difference between the first image data and the second image data is quite small. The threshold value is preferred to be set in 180. The variance is calculated by the following equations:
wherein D(x) is the third image data, E[D] is average value of the third image data and VAR[D] is variance.
After checking whether the variance between the first image data and the second image data is no more than the threshold value or not, once the variance is smaller or equal to the threshold value, run step S16-record the bit as “0” for convenience of data identification while being decompressed. Next refer to step SI 8, compare the first image data and the second image data to estimate and generate a motion vector and compress the motion vector. Refer to
Refer to step S20, according to motion vector, calculate the first image data and the second image data to produce an offset of the motion vector. According to the plurality of motion vector, the first image data is used to reconstruct the second image data so as to generate a fourth image data. Then the fourth image data and the second image data are subtracted from each other so as to get an offset value of motion vector. Next run step S22 and step S24, encode the offset value of the motion vector, compress the motion vector as well as the offset value of the motion vector, and encode as well as compress the first image data.
It is noted that in the step of compressing the motion vector, bit size of the motion vector being encoded is determined by distance p while searching relative positions in all directions. p=2n-1−1 When distance p=7, the bit size is 4, n=4. Furthermore, the image data in the embodiment is two dimensional so that the motion vector includes two components being compressed respectively. That means the vector includes two numbers-X component and Y component, being calculated respectively. The compression methods of components of the motion vector are as followings:
firstly, record sign of the component of the motion vector by bit “1” or “0”.
Then compress the absolute value of each component of the motion vector by JPEG-LS. The second method is adding each component of the plurality of motion vector with the distance p and JPEG-LS compression of n bit is performed. The third compression method is by using one more bit to represent whether the component of the motion vector is zero or not. When the component is zero, the bit “0” is transmitted. On the other hand, when the component of the motion vector is not zero, transmit the bit “1”. And encode the component of the motion vector. The above methods are some embodiments of compression of the motion vector.
In addition, after the step of generating the offset value of the motion vector, the sign of the offset value of the motion vector needs to be recorded separately and the absolute value of the offset value of the motion vector is calculated. Or add the calculated offset value of the motion vector with value of 255 so as to make the offset value of the motion vector become a positive value.
Refer to
In summary, an image data compression method according to the present invention include the steps of: firstly compare a variance between a first image data and a second image data with a threshold value. When the variance is smaller than a threshold value, compare the first image data and the second image data to estimate and generate a motion vector and compress the motion vector. Then according to the motion vector, calculate the first image data and the second image data so as to get an offset value of the motion vector. Next, encode the offset value of the motion vector, compress the offset value of the motion vector, and encode as well as compress the first image data.
Additional advantages and modifications will readily occur to those skilled in the art. Therefore, the invention in its broader aspects is not limited to the specific details, and representative devices shown and described herein. Accordingly, various modifications may be made without departing from the spirit or scope of the general inventive concept as defined by the appended claims and their equivalents.