exercise 1 investigate jpeg compression
play

Exercise 1: Investigate JPEG Compression Goals : Investigate the - PowerPoint PPT Presentation

Exercise 1: Investigate JPEG Compression Goals : Investigate the compression efficiency of JPEG for gray-level images Measure and draw Rate-PSNR curves for JPEG (will use as reference later) Preparation 1 Install ImageMagick (for image


  1. Exercise 1: Investigate JPEG Compression Goals : Investigate the compression efficiency of JPEG for gray-level images Measure and draw Rate-PSNR curves for JPEG (will use as reference later) Preparation 1 Install ImageMagick (for image conversion and JPEG encoding/decoding) Many Linux distributions: sudo apt install imagemagick Other Operating Systems: see https://www.imagemagick.org 2 Get and Compile PSNR Tool (for measuring PSNR between two images) Get C++ sources (see “psnr-tool”) from course web site or Whiteboard Build the PSNR tool (e.g., using “g++ -o psnr -Ofast main.cpp image.cpp”) 3 Get Example Image in PGM format (examples for gray-level images) Get the file “Kodak-Images-PGM(gray).zip” from course web site or Whiteboard Extract the archive: You will get a pgm folder with 24 examples of gray-level images Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding

  2. Exercise 1: Test JPEG Compression Encode, Decode, and Measure PSNR and Bit Rate Encode a PGM image using JPEG (using the “convert” command of ImageMagick) Command: convert original.pgm -quality Q compressed.jpg “original.pgm” = original pgm image; “compressed.jpg” = resulting JPEG file the parameter Q is a number between 1 and 100, inclusive, which determines the compression ratio (using the “convert” command of ImageMagick) Decode a JPEG image Command: convert compressed.jpg reconstructed.pgm “compressed.jpg” = JPEG file; “reconstructed.pgm” = reconstructed image in PGM format Measure PSNR and Bit Rate (using the “psnr” tool) Command: ./psnr original.pgm reconstructed.pgm compressed.jpg The command outputs the bit rate (in bits per pixel) and the PSNR (in dB) Test different quality parameters in the range [1; 100]. Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding

  3. Exercise 1: Generate a Rate-PSNR Curve Measure and Plot the Rate-PSNR Curve for JPEG Compression Select one of the PGM images Write a shell script that varies the quality parameter Q from 1 to 100 and, for each quality parameter Q, does the following encode the PGM image into a JPEG file using the corresponding quality Q decode the JPEG file back into PGM format outputs the bit rate and PSNR to a file (one line for each quality parameter) Plot the rate-PSNR curve for a range from 0 to 2 bits per pixel You can use gnuplot or a similar tool Repeat the experiment for another example image (or all 24 example images) Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding

  4. Exercise 1: (Optional) Compare HEVC to JPEG Checkout and compile the latest version of the HEVC reference software svn co https://hevc.hhi.fraunhofer.de/svn/svn_HEVCSoftware/trunk/ HEVC cd HEVC/build/linux make release Encoding, decoding, PSNR and bit rate measurement (for a value of QP ∈ [ 0 ; 51 ] ) W=$(head -2 org.pgm | tail -1 | awk ’{print $1}’) # get image width H=$(head -2 org.pgm | tail -1 | awk ’{print $2}’) # get image height convert org.pgm -depth 8 gray:org.y # remove pgm header ./HEVC/bin/TAppEncoderStatic -c HEVC/cfg/encoder_intra_main.cfg \ --InputChromaFormat=400 --Profile=main-RExt -fr 1 \ -wdt $W -hgt $H -f 1 -i org.y -b stream.265 -q $QP # encode using HEVC ./HEVC/bin/TAppDecoderStatic -b stream.265 -o dec.y -d 8 # decode using HEVC convert -size ${W}x${H} -depth 8 gray:dec.y dec.pgm # add pgm header ./psnr org.pgm rec.pgm stream.265 # measure PSNR + rate Get a rate-PSNR curve by varying QP from 0 to 51 Plot the curve into the same diagram as the rate-PSNR curve for JPEG Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend