Home

IMAGE PROCESSING - Philippe J. Giabbanelli

image

Contents

1. 5 TJ CD Ga oj a ST oj J TE NI Cc Cc O Informations about the input file Informations about the input file Name lena pgm Name tiger pgm Dimensions 200x200 using layers Dimensions ZoUx2Za0 using layers Max grey level 255 Max grey level 200 2 Application of filter Quantize 10 17 06 11 49 12 2 Application of filter Quantize 10 17 06 12 10 30 Parameter B 8 Parameter B 8 Parameter 7 Parameter 6 Parameter 2 B A 2 Parameter 2 B A 4 2 B A is made to divide and stretch lt is a constant 2 B A is made to divide and stretch It is a constant Conclusion Conclusion We reduced the number of bits to encode the picture We reduced the number of bits to encode the picture It can lead to false contours effects It can lead to false contours effects The average error is 297 62500 which is close to 0 The average error is 1647 62500 which is close to 2 3 Application of filter Quantize 10 17 06 11 49 15 3 Application of filter Quantize 10 17 06 12 10 38 Parameter B 8 Parameter B 8 Parameter A B Parameter 9 Parameter 2 B A 4 Parameter 2 B A 8 2 B A is made to divide and stretch It is a constant 2 B A is made to divide and stretch It is a constant Gonclusion Gonclusion We reduced the number of bits to encode the picture We reduced the number of bits to encode the picture lt can lead to false contours effects It can lea
2. img exportLotiles tprintt exportFlot Yor erreur it img exportCotiles fprintf exportFlot n we produce the report on this event We remind the user about false contours effects if they are strong rpt addEventUonclusion We reduced the number of bits to encode the picture nIt can lead to false contours effects rpt add The average error is rpt add erreurMoyenne rpt add rpt add taille rptadd which is close to rpt add U0 erreurMoyenne taille rpt add n if IU0 erreurMoyenne taille gt 6 rpt add gt Warning visible false contour effects lt n it img exportLotiles fclose exportFlot We also modified one line of the given algorithm if lena256 m n 0 then RelError m n Ilena256 m n lenaX m n I Because lena256 m n 0 this expression is simplified to RelError m n lenaX m n Of course bigger is the ratio and stronger are the false contours When we take Lena in 256 grey levels and we turn in into 128 or 64 grey levels the effects are not so easy to see However if we continue to decrease the number of bits then it leads to major problems as seen in the previous page Philippe Giabbanelli Images Files and Quantization Vil Examples of reports on some experimentations Detailed Report Produced by Aqualonne s Software Detailed Report Produced by Aqualonne s Software lt c gt Philippe Giabbanelli 2006 A cI V J
3. up to three matrices to store the data The final result of the algorithms will be in the output instance while the data will be extracted from the input instance It is possible and sometimes necessary to change the type of output By example the user can decide to see his resulting color image in three grey level images to understand what happened on each layer Our save function can do that automatically as it can take a color image and turn in into a grey level using a linear formula in our case we chose to take a third of each layer but there are also many other formulas available like Gray 0 3Red 0 59Green 0 11Blue y gt The user doesn t need to say the type of the file automatically deduced A colour image can be exported at three layers or turned into grey level ll Interface class Because we don t want the user to loose his time by providing non useful information such as the type of file or the name of output there is a default output name deduced from the input By example if the input is called mylmage pgm the default output is myImagebis pgm If the user decides to save his resulting color image in three grey level images to see what happen on each layer then it will automatically be named myImagebisR pgm myImagebisG pgm myImagebisB pgm Everything related to names and extensions is 1n the Interface class The user doesn t need to provide any name for the output a default name is alw
4. IMAGE PROCESSING PROJECT 1 IMAGE FILES AND QUANTIZATION j P r Y SR J f S h La d F Fa l a y O a J E gt a f w E F E EE a at 27 D _ 4 a a gt L l J rt OR s i z 7 a T E W c 2 7 E 7 E c S dia a ue ow d MILIE GLABBANELLL OCTOBER Z STUDENT 2061251 l Image class This class is the main one of the application it takes an image file to parse its content it can save the data to multiple format and it also provide a basic interface for algorithms The user only needs to provide a file name He does not have to choose a file extension from a list because it is highly redundant the type can be determined from the file itself Therefore the first operation performed by open is to find the type Once we have it we know if it is in grey level or in colours depending on this answer we store the data in one or three matrices dynamically allocated We also store all the comments in one variable of type string using the following algorithm char C while c getc f comment c We take in the comments while c getc f n comment c And whatever is after comment n Until the carriage return ungetc c If the line didn t begin by a comment we put the char back To make it easy we will work with two instances of this class one as input and the other as output each containing
5. ays provided III Matrix class All the data is stored into matrices which provide basic manipulations dynamic creation accessing the values read write free the allocated memory copy the data from another matrix The standard access to the data is using a two dimensional representations by example we ask for the data Red x y In the future if some algorithms really need to refer to a pixel as the 1 th element instead of the element at a given row and column then we will provide a conversion between two and one dimension Typically many classes can inherit from matrix to add more and more components like iterators or mask if we want to apply something on a range of pixel from a given center and radius Philippe Giabbanelli 2 Images Files and Quantization IV Report class The user will probably have to apply several filters and want a deep analysis of what happened during the processes We consider rather painful to read the values in console mode and even uglier is the fact that due to a large amount of values we would have to pause the screen to read it Therefore we provide an automated tool to have report files in txt format This 1s implemented by the class Report We use the following functions create make the header of the report and the first section dealing with the input file addEvent add a section for the application of a filter It is provided a unique number so that it is more comforta
6. ble to read and also a time By example 2 Application of filter Quantize 10 14 06 17 08 20 addEventParameter A sub part of an Event i e a Filter is the values given to the parameters addEventParameterDescription To understand the effect of a parameter on the data addEventConclusion A short text resuming what happened on the picture due to the filter printReport Last step we print the whole report in a file Of course the user can decide not to have this file In this case he just have to turn this option off through the menu Because this is a kind of interface between two classes it is implemented in Interface class Automated report sheet instead of reading incomprehensible values in console mode V Quantization of a picture The function which implements the quantization of a picture is the following void Quantize image In image Out int B int A rpt addEvent luantize add a new event in the log application of quantize rpt addEventParameter B B take the values of the parameter rpt addEventParameter A A if A gt B return Uut setModity int constante Z for int i B A i gt i constante 2 rpt addEventParameter 2 B A constante a so take this value for debuging for int m m lt In getwidth m for int n n lt In getheight n Uut setvalue int In getvalue m n constante constante m n rpt addEventParamaterDescription 2 B A
7. d to false contours effects The average error is 884 62500 which is close to 1 The average error is 3 79 62500 which is close to 6 gt Warning visible false contour effects lt 4 Application of filter Quantize 10 17 06 11 49 18 DA D Gen A EE EE ats 4 Application of filter Quantize 10 17 06 17 10 41 See j j i aaas Parameter 4 Parameter B 6 Parameter 2 B A 16 Parameter 4 2 B A is made to divide and stretch It is a constant Parameter 2 B A 16 Conclusion 2 B A is made to divide and stretch It is a constant We reduced the number of bits to encode the picture Lonclusion It can lead to false contours effects We reduced the number of bits to encode the picture The average error is 4440 62500 which is close to 7 It can lead to false contours effects gt Warning visible false contour effects lt The average error is 7867 62000 which is close to 127 gt Warning visible false contour effects lt Philippe Giabbanelli 5 Images Files and Quantization VIII A short user manual Because a lot of things have been explained all along this paper we don t consider very useful to provide a full manual However if the user wants to skip the technical aspect to focus on this use on the program then he can just read this section 1 Open a picture When the program starts it asks for a picture of type PGM of PPM in ASCII format Therefore the user needs to g
8. e interactive analysis of a file are not yet implemented IX Things to do in next version 1 Converting from C style to C Because we are mostly a C programmer we often used C functions especially for saving the files We apologize for that and we are currently taking the Advanced C Programming course When we will know how to deal with files and be sure of our memory management we will turn the C functions fopen fclose fprintf getc malloc calloc into C functions 2 Trying to prevent erase of the original file If the user wants to save his file with the same name that the original file it will erase it It is not a problem for us but we have to say the user that what he is doing can be dangerous are you sure etc We implemented a little function for this which is not yet working 3 Be sure that everything is also working on colours images Philippe Giabbanelli 6 Images Files and Quantization
9. is made to divide and stretch lt is a constant description rpt addEventUonclusion We reduced the number of bits to encode the picture nit can lead to false contours effects Images Files and Quantization VI Experimentation We also wanted to quantify the amounts of errors introduced by our quantization For this goal we compute the relative error for each pixel and we take the sum divided by the number of pixels If the user wants it the relative error for each pixel can be saved because it slows the program the option is off by default To implement this we added some lines at the end of the function quantize FILE exportFlot export of the file in L mode we apologize for that it img exportLotiles string exportlotName img getUutputName ERROR txt const char C stri exportHotName c str TL exportFlot topen c_strl w NULL cout lt lt Impossible to export error file lt lt endl return fprintf exportFlot Error results for each pixel in double precision n double taille In getwidth In getheight erreurMoyenne 0 0 erreur 0 0 creating variable for int m m lt In getwidth m computing relative errors for int n n lt In getheight n if In getvalue n m D erreur double abs In getvalue n m Out getvalue n m ln getvalue n m else erreur Qut getvalue n m erreurMoyenne erreur store the sum if
10. ive the name and the path if necessary of the file By example if the file is in the same directory lena pgm If the file is in the root of C then C lena pgm 2 Apply a filter Once the picture is opened the user can apply the filter of his choice now there is only one choice By example if he wants to apply a quantization he will write 1 Then he will follow the instruction which are asking for some parameters and sometimes explain the effects of this parameter 3 Save and quit To save we use s and to quit we use q A default filename is always provided so the user doesn t need to write it 4 Customize the output It is possible to change the output parameters If the user doesn t like the default name provided by the application he can enter the one of his choice by using n like Name He can also change the type of the file using t like Type If the user wants to export the file related to algorithms like the relative error he needs to use c like Configure Exporting this file slow the program it is why we made such a choice Then the user can turn on the export of related file He can also decide to turn off the export of analysis and then he won t be provided the full report 5 Other major issues If the user wants to see the comments included in the opened file he can use v as View comments A brief summarize of what have been done on the program is available by The output of histogram and th

Download Pdf Manuals

image

Related Search

Related Contents

ScanControl 1612 - JB-lighting Lichtanlagentechnik  UNUSUAL U45Y  Page de garde  Hilti 3487019 Use and Care Manual  Satellite Radius™ 11 User`s Guide  Mise en page 1  Anbaurahmen AN-049-001TS mit/ohne Antriebssatz AN-049  Belinea 10 17 28 TFT 17" 8 ms  

Copyright © All rights reserved.
Failed to retrieve file