Image File Format Converter and Processor IFFCOP

Image File Format Converter and Processor IFFCOP PowerPoint PPT Presentation


  • 96 Views
  • Uploaded on
  • Presentation posted in: General

2. Project Goal. The purpose of the project is to develop a GUI based application that processes a digital image such as :- Transformation operation on the digital imageApplication of various filters on the digital image Saving an image file in a chosen file format.The project has been designe

Download Presentation

Image File Format Converter and Processor IFFCOP

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


1. 1 Image File Format Converter and Processor (IFFCOP) by Rozita JamiliOskouei M.Sc (CS) –3th Semester

2. 2 Project Goal The purpose of the project is to develop a GUI based application that processes a digital image such as :- Transformation operation on the digital image Application of various filters on the digital image Saving an image file in a chosen file format. The project has been designed using the Java Platform.

3. 3 Various operations in IFFCOP The various operations in IFFCOP are as follows:- Transformation of an image (I)Resize (ii)Rotate (iii)Reflect Application of the following filters:- (I)Blur (ii) Sharpen (iii) Grayscale (iv) Invert Conversion to following chosen file formats:- (I)JPEG (ii) GIF (iii) PNG (iv) BMP Zoom effect on the image Revert to the original image

4. 4 Data Compression It is the process of reducing the amount of data required to represent a given quantity of information.If it contains data that either provide no relevant information or simply restate that which is already known then it is said to contain data redundancy.Data redundancy is the central issue in digital compression and there are three basic data redundancies that can be identified and exploited:- Coding Redundancy Interpixel Redundancy Psychovisual Redundancy Data compression is achieved when one or more of these redundancies are reduced or eliminated.

5. 5 Compression Techniques Lossless Compression:-These are designed to remove the redundancy when the data stored or transmitted and then replaced it when the image is reconstructed from those data.The reconstructed image is identical to the original image I.e all the information originally present in the image has been preserved by compression Lossy compression:-Higher compression is possible due to lossy techniques which discard some of the information present in the image and is undetectable to the human eye.The reconstructed image will not be identical to the original image although the difference need not be clearly visible to the human eye.

6. 6 Lossless Compression Techniques Run Length Encoding(RLE) Statistical Coding:-Theses techniques remove the coding redundancies in an image e.g Huffman coding Dictionary based coding:-These adopts a completely different approach ,encoding variable-length strings of symbols as single codeword .Compression occurs because these codewords are shorter than the strings of symbols that they replace. Examples of dictionary based coding are:- (I) LZW (Lempel-Ziv-Welch) coding (ii)LZ77(Lempel-Ziv) coding also called as sliding window compression (iii)LZ78

7. 7 Run Length Encoding (RLE) The technique of Run length Encoding (RLE) exploits the high interpixel redundancy that exist in relatively simple images.In RLE we look for gray levels that repeat along each row of the image A run of consecutive pixels whose gray levels are identical is replaced with two values :the length of the run and the gray level of all pixels in the run.Hence the sequence {20,20,20,20,20} becomes {5,20}.RLE can be applied on a row by row basis or we can consider the image to be one dimensional datastream in which the last pixel in the row is adjacent to the first pixel in the next row.This can lead to slightly higher compression ratios if the left and the right hand sides of the image are similar.The main practical application of RLE is the compression of binary images of documents prior to transmission by fax machine.Here,the algorithm is the extension of RLE in two dimension known as READ(relative element address designate) coding.

8. 8 Huffman coding It is simply a particular way of choosing the codewords such that the performance of the coding scheme l’ is as close as possible to the entropy of the image, which is an estimate of the average number of bits per pixel that are required to code the image.We start by ranking the pixel values in decreasing order of their probabilities.We then pair the two values with the lowest probabilities labeling one of which with 0 and the other with 1.Their probabilities are summed to give the probability of either value from the pair occurring in the image.We then identify the next two lowest probabilities from the current set of individual values or paired values these are then paired with one member of the pair labeled 0 and other 1 and so on.The process continues,building up a tree like structure of the values.

9. 9 Lempel-Ziv-Welch (LZW) coding The technique called as Lempel –Ziv-Welch(LZW) coding assigns fixed length code words to variable length sequences of source symbols to be encoded .At the inset of the coding process ,a code book or” dictionary” containing the source symbols to be constructed .For 8-bit monochrome images ,the first 256 words of the dictionary are assigned gray values 0,1,2,3…255.As the encoder sequentially examines the image pixels, gray level sequences that are not in the dictionary are placed in algorithmically determined locations. If the first two pixels of the image are white for instance ,sequences “255-255” might be assigned to location 256,the address following the location reserved for gray levels 0 through 255.  

10. 10 LZW coding(continued) The next time the two consecutive white pixel are encountered, code word 256 ,the address of the location containing sequence 255-255 ,is used to represent them. If a 9-bit,512 dictionary is employed in the coding process ,the original(8+8) bits that were used to represent the two pixels are replaced by a single 9-bit code word Clearly the size of the dictionary ia an important system parameter. If it is too small the of matching gray level sequences will be less likely :if it is too large ,the size of the code words will adversely affect compression performance.

11. 11 Lempel-Ziv77 (LZ77) coding /Sliding window compression LZ77 is what is know as a sliding window compression technique.The dictionary is a window of previously seen data that slides along the datastream.This window is usually thousands of bytes in size.At the end of the window is a look-ahead buffer ,typically a few hundred bytes long.The algorithm tries to match strings of bytes in the look-ahead buffer with the strings of bytes in the dictionary.When a match is found, the algorithm replaces the strings of bytes with the distance to the match and its length .When a string of bytes has been seen recently enough to still be within the window it can be compressed by algorithm,however if it was seen earlier in the datastream ,it will not be replaced by much shorter tokens.

12. 12 Lossy Compression/JPEG compression The joint Photographic Experts Group have specified a lossy algorithm based on transform coding. Techniques of this kind create a frequency based representation of the image and discard some of the high frequencies to create redundancy ad hence achieve compression .The basis for the JPEG algorithm is The Discrete Cosine Transform(DCT) .The DCT is preferred to the Fourier Transform for transform coding because it packs a given amount of information into fewer coefficients .Performing a transform on an image there are two disadvantages to this. First it is demanding computationally second discarding high frequencies from the spectrum generated by the transform will have effect of low pass filter ,blurring all parts of the image to the same degree. The solution is to perform the transform on small areas of the image Compression techniques that operate on blocks of pixels in this manner are often described as block coding.

13. 13 JPEG compression(continued) JPEG compression of an 8 bit gray scale image:- Split image up into 8 x 8 blocks of pixel for all blocks of pixels do Compute a discrete cosine transform(DCT) of the block Quantise the DCT coefficients Arrange coefficients into a one dimensional sequence Compress zero-valued coefficients by run length encoding Perform Huffman coding of the coefficient Output coded coefficients end for

14. 14 Common Image File Formats Among the various file formats available the following are discussed:- JPEG (Joint Photographic Experts Group) GIF(Graphics Interchange Format) BMP(Bitmap) PNG(Portable Networks Graphics)

15. 15 JPEG(Joint Photographics Experts Group) The JPEG file format is named for the Joint Photographic Experts Group, the original name of the committee that wrote the standard. One of the JPEG’s main advantages is that it can store 24-bit (thousand of colors) image information as opposed to GIF images ,which can only store 8-bit(256 color) image information. However ,JPEG compression is lossy meaning that some image data is throw away in order to compress the image. Once the image has been compressed and decompressed it is no longer identical to the original image. The first step in JPEG compression is to create a map of one brightness value and two hue values for each pixel in the image During ”sub sampling” the two hue values are averaged into one value decreasing the image by at least on third. The process is based on the principle that small changes in color (hue) are less likely to be perceived by the human eye than small changes in brightness.

16. 16 JPEG (continued) JPEG compression scheme then divides the image into 8 x 8 pixel square and uses complex mathematical processes –Direct Cosine Transformation(DCT) and quantization –to round off changes in the brightness and hue. The rounding process produces several is identical values ,which decreases the amount of the information necessary to describe the image. For example, hue values of 3and 6 might both be rounded off to 5 ,with multiple occurrences 5 described throughput each square in the image. The remaining information is then compressed and saved. The amount of information thrown away depends on the level of compression but choosing a compression level can be tricky.

17. 17 GIF (Graphics Interchange Format) The GIF (Graphics Interchange Format) was created by CompuServe in 1987 and revised in 1989.The compression algorithm used for GIF’s is LZW Written by Abraham Lempel ,Jacob Ziv and Terry Welch. The algorithm was patented by Unisys and in 1995 the company began asking developers who distribute GIF software to pay for an LZW license. This was seen as a controversial move and has led the creation of GIF such as PNG. Still GIF is the oldest image file formats on the Web, and nearly all browser support it.LZW compression is lossless meaning that when an image is squashed down, no data is lost .The GIF format is good for graphics that contain text and/or large areas of solid color.

18. 18 GIF (continued) The first step in GIF compression is to index the image color palette. This decreases the number of colors in your image to a maximum of 256 (8-bit color).You can increase your chances of making a smaller GIF by further reducing the number of color in the palette. This increases the chances of horizontal repetition of data in the image ,A key factor in LZW compression. Often an image that looks good in 256 colors can look good with 128 colors or fewer .Again this is something you need to experiment with.LZW compression works best with the images that have horizontal bands of solid color. So if you have eight pixels across a one pixel; row with the same color value LZW compression algorithm would see that as “8W “ rather than “WWWWWWWW” which saves file space.

19. 19 BMP (Bitmap) BMP is a standard format used by Windows to store device independent and application independent images. The number of bits per pixel(1,4,8,16,24,32 or 64) for given BMP file is specified in a file header. BMP files with 24 bits per pixel are common.BMP is a fairly simple file format its structure is pretty straight forward . Each Bitmap file contains:- (i)   A bitmap file header: this contains information about the type ,size and layout of a device independent bitmap file. (ii) A bitmap information header, which specifies the dimension, compression type and color format for the bitmap.

20. 20 BMP (continued) (iii)   A color table, defined as an array of RGBQUAD structures contains as many elements as there are colors in the bitmap. The color table is not present for the bitmaps with 24 color bits because each pixel is represented by 24 bit red-green-blue(RGB) values in the actual bitmap area. BMP files always contain RGB data. The file can be (i)   1 bit: 2 colors (ii)    4-bit: 16 colors (iii)   8-bit 256 colors (iv)  24-bit: 16777216 colors, mixes 256 tints of Red with 256 tints of Green and Blue. Windows versions 3.0 and later support Run-Length –Encoded(RLE) formats for compressing bitmaps that uses 4 bits per pixel and 8 bits per pixel

21. 21 PNG (Portable Networks Graphics) The Portable Network Graphics (PNG) format was designed to replace the older and simpler GIF format. PNG really has three main advantages over GIF: alpha channels (variable transparency), gamma correction (cross-platform control of image brightness), and two-dimensional interlacing (a method of progressive display). PNG also compresses better than GIF in almost every case, but the difference is generally only around 5% to 25%. PNG was and is intended to be a single-image format only.For image editing, PNG provides a useful format for the storage of intermediate stages of editing. Since PNG's compression is fully lossless--and since it supports up to 48-bit truecolor or 16-bit grayscale--saving, restoring and re-saving an image will not degrade its quality, unlike standard JPEG (even at its highest quality settings).The coding used here is LZ-77.

22. 22 JPEG conversion

23. 23 GIF conversion

24. 24 BMP conversion

25. 25 PNG conversion

26. 26 Filters using Java The following filters are used Blur filter:-The blur filter is a subclass of Convolver and simply runs through every pixel in the source image array and computes the average of the 3 x 3 box surrounding it The corresponding output pixel is that average value. Sharpen filter:-The sharpen filter is also subclass of Convolver and is the inverse of Blur. it runs through every pixel in the source array and computes the average of the 3 x 3 box surrounding it not counting the center .The corresponding output pixel has the difference between the center pixel and the surrounding average added to it. the basically says that if a pixel is 30 brighter than the surroundings make it another brighter. If however it is 10 darker then make it another darker.

27. 27 Filters using Java (continued) Grayscale filter:-Grayscale filter is a subclass of RGBImageFilter which means that Grayscale can use itself as ImageFilter parameter to FilterImageSource’s constructor. Then all it needs to do is override filterRGB() to change the incoming color values. It takes the red ,green, and blue values and computes the brightness of the pixel, using NTSC(National Television Standards Committee) color to brightness conversion factor .It ten simply returns a gray pixel that is the same brightness as the color source. Invert filter:-The invert filter is also quite simple. It takes apart the red ,green and blue channels and then invert them by subtracting them from255.These inverted values are packed back into pixel value and then returned.

28. 28 Screen shots

29. 29 Screen shots

30. 30 Screen shots

31. 31 Screen shots

32. 32 Screen shots

33. 33 Screen shots

34. 34 References Digital Image Processing by Gonzalez and Woods The Data Compression Book by Nelson and Gailly Digital Image Processing a practical introduction using Java by Nick Efford Java 2 a complete reference by Herbert Schildt Core Java Volume I & II by Horstmann and Cornell

  • Login