This commit is contained in:
xdrm-brackets 2015-10-19 16:43:44 +02:00
parent 22cc49fdc1
commit 85d5213e0f
11 changed files with 737 additions and 32 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 352 KiB

View File

@ -1,9 +1,9 @@
import pygtk import pygtk
pygtk.require('2.0') pygtk.require('2.0')
import gtk import gtk
from Explorateur import * from interface.Explorateur import *
class Test: class Interface:
#DEFINITION DES EVENEMENT BOUTON #DEFINITION DES EVENEMENT BOUTON
def evnmt_quitter(self, widget, donnees = None): def evnmt_quitter(self, widget, donnees = None):
print "Evnmt delete survenu" print "Evnmt delete survenu"

View File

View File

@ -1,29 +0,0 @@
import pygtk
pygtk.require('2.0')
import gtk
dialog = gtk.FileChooserDialog("Open ...",
None,
gtk.FILE_CHOOSER_ACTION_OPEN,
(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_OPEN, gtk.RESPONSE_OK))
dialog.set_default_response(gtk.RESPONSE_OK)
filter = gtk.FileFilter()
filter.set_name("All files");
filter.add_pattern("*")
dialog.add_filter(filter)
#filter = gtk.FileFilter()
response = dialog.run()
if response == gtk.RESPONSE_OK:
print dialog.get_filename(), 'selected'
select = dialog.get_filename()
elif response == gtk.RESPONSE_CANCEL:
print 'Cosed, no files selected'
dialog.destroy()
print "Nom du fichier selectionne :" + select

399
code/mainwithiface.py Normal file
View File

@ -0,0 +1,399 @@
# ~*~ encoding: utf-8 ~*~ #
###########################
# TRAITEMENT D'IMAGES #
###########################
# classes
from BMPFile import *
from Noise import *
from tests import *
import random
import sys
from os import system as sh
import time
# test par défaut puis quitte
# defaultTest();
# exit();
# arrêt si moins de 2 arguments
if len(sys.argv) < 3:
print "Require 2 args : \n* input image\n* output image"
exit()
import pygtk
pygtk.require('2.0')
import gtk
from interface.Explorateur import *
class Interface:
#DEFINITION DES EVENEMENT BOUTON
def evnmt_quitter(self, widget, donnees = None):
print "Evnmt delete survenu"
gtk.main_quit()
def evnmt_exploreur(self, widget, donnees = None):
self.name = select_file() #stoque le nom du fichier selection dans cette variable
self.libelle.set_label("fichier selectionne : " + self.name)
def evnmt_refresh_text(self, widget, donnees = None):
print "Evenement refresh"
print self.bouton3.get_label()
print self.diag.get_text()
self.bouton3.set_label(self.diag.get_text())
#EVENEMENT COMBOBOX
def changed_cb(self, widget):
print "coucou toi"
str1 = self.get_active_text(widget)
self.traitement_img(str1)
def get_active_text(self, widget):
modele = widget.get_model()
est_actif = widget.get_active()
if est_actif < 0:
return None
return modele[est_actif][0]
#fonction qui repere l option choisit
def traitement_img(self, str1):
interfaceSelection(self.combo.get_active())
def __init__(self):
self.fen = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.fen.set_title("Traitement d image")
self.fen.set_default_size(500, 500)
self.fen.connect("delete_event", self.evnmt_quitter)
#creation du libelle
self.libelle = gtk.Label("Aucun fichier selectionnee")
#creation de la zone de dialogue
#self.diag = gtk.Entry(0)
self.diag = gtk.Entry(0)
self.diag.set_text("nom du fichier qui contiendra la nouvelle image")
#Creationd une combo box
self.combo = gtk.combo_box_new_text()
self.combo.set_wrap_width(4);self.combo.set_entry_text_column(1)
self.combo.set_column_span_column(10);
self.combo.append_text( "Traitement à effectuer:" );
self.combo.append_text( "*** TESTS DE FICHIER ***" );
self.combo.append_text( "Creation manuelle" );
self.combo.append_text( "Parse/Unparse" );
self.combo.append_text( "Afficher palette" );
self.combo.append_text( "" );
self.combo.append_text( "*** TESTS DE BRUIT ***" );
self.combo.append_text( "Salt&Pepper" );
self.combo.append_text( "Additif (Bernouilli)" );
self.combo.append_text( "Additif (Gaussien)" );
self.combo.append_text( "" );
self.combo.append_text( "*** TESTS DE DIFFERENCES ***" );
self.combo.append_text( "Difference en %" );
self.combo.append_text( "SNR (origine/bruit)" );
self.combo.append_text( "Difference en image" );
self.combo.append_text( "Fusion d'images (+)" );
self.combo.append_text( "Fusion d'images (-)" );
self.combo.append_text( "" );
self.combo.append_text( "*** TESTS DE FORMES ***" );
self.combo.append_text( "Reveler une teinte" );
self.combo.append_text( "Colorer une forme" );
self.combo.append_text( "Colorer les formes" );
self.combo.append_text( "Relever les contours" );
self.combo.append_text( "" );
self.combo.append_text( "*** TESTS DE FILTRES ***" );
self.combo.append_text( "Filtre moyen" );
self.combo.append_text( "Laplace" );
self.combo.append_text( "Roberts" );
self.combo.append_text( "Prewitt" );
self.combo.append_text( "Sobel" );
self.combo.append_text( "Convolution" );
self.combo.append_text( "bichrome" );
self.combo.append_text( "Passe Haut" );
self.combo.connect('changed', self.changed_cb)
self.combo.set_active(0);
#creation des boutons
self.bouton = gtk.Button("Explorateur de fichier")
self.bouton2 = gtk.Button("Quitter le programme")
self.bouton3 = gtk.Button("Texte entree")
self.bouton.connect("clicked", self.evnmt_exploreur)
self.bouton2.connect("clicked", self.evnmt_quitter)
self.bouton3.connect("clicked", self.evnmt_refresh_text)
self.box = gtk.VBox(False, 0)
self.box1 = gtk.HBox(False, 0)
self.box2 = gtk.HBox(False, 0)
self.fen.add(self.box)
#Gestion des differents elements de la fenetre
#box 1 permet de creer deux elements sur la meme igne de box
self.box1.pack_start(self.bouton, True, True, 0) #bouton d explorateur
self.box1.pack_start(self.bouton2, True, True, 0)#bouton pour quitter le porogramme
self.box.pack_start(self.box1, True, True, 0) #ajout d une boite dans une boite
self.box.pack_start(self.libelle, True, True, 0) #ajout du libelle contenant le chemin ou non du fichier selectionnne
self.box.pack_start(self.box2, True, True, 0)
self.box2.pack_start(self.diag, True, True, 0)
self.box.pack_start(self.bouton3)
self.box.pack_start(self.combo)
self.bouton.show()
self.bouton2.show()
self.bouton3.show()
self.libelle.show()
self.diag.show()
self.combo.show()
self.box.show()
self.box1.show()
self.box2.show()
self.fen.show()
def boucle(self):
gtk.main()
m = Interface()
################" INTERFACE "###################
def interfaceSelection(action):
startStr = "\n+---------------------------+---------+"
result = ""
execTime = Timer(); execTime.reset();
# fichier
if action == 2:
w = raw_input("width [100]: ")
h = raw_input("height [100]: ")
arg1, arg2 = 100, 100
if w != "":
arg1 = int(w)
if h != "":
arg2 = int(h)
print startStr
testManualCreation(image1, arg1, arg2) # teste la création d'un fichier à partir d'une matrice uniquement
elif action == 3:
print startStr
result = testFileIntegrity(image1) # teste le PARSE/UNPARSE
elif action == 4:
print startStr
result = printIntPalette(image1) # affiche la palette d'une image
# bruits
elif action == 7:
inS = raw_input("seuil bruitage [50]: ")
outS = raw_input("seuil débruitage [1] : ")
outB = raw_input("borne débruitage [1] : ")
s = raw_input("Lissage ? (0-1): ")
arg1, arg2, arg3, arg4 = 50, 1, 1, 1
if inS != "":
arg1 = int(inS)
if outS != "":
arg2 = int(outS)
if outB != "":
arg3 = int(outB)
if s != "":
arg4 = int(s)
print startStr
testSaltAndPepper(image1, arg1, arg2, arg3, arg4) # teste le bruitage/débruitage de type "Sel & Poivre"
elif action == 8:
inS = raw_input("seuil bruitage [10]: ")
outS = raw_input("seuil débruitage [35] : ")
arg1, arg2 = 10, 35
if inS != "":
arg1 = int(inS)
if outS != "":
arg2 = int(outS)
print startStr
testAdditiveBernouilliNoise(image1, arg1, arg2) # teste le bruitage/débruitage de type "Additif"
elif action == 9:
inS = raw_input("sigma [10]: ")
outS = raw_input("seuil débruitage [35] : ")
arg1, arg2 = 10, 35
if inS != "":
arg1 = int(inS)
if outS != "":
arg2 = int(outS)
print startStr
testAdditiveGaussianNoise(image1, arg1, arg2) # teste le bruitage/débruitage de type "Additif"
# performances
elif action == 12:
print startStr
printImageQuality(image1, image2) # compare 2 images et donne le pourcentage de ressemblance/différence
elif action == 13:
print startStr
printSNR(image1, image2) # compare 2 images et retourne le SNR
elif action == 14:
print startStr
imageForImageQuality(image1, image2) # crée une image correspondant aux différences de 2 images
elif action == 15:
print startStr
mergeImagesAdditive(image1, image2) # crée une image étant la fusion (addition) de 2 images
elif action == 16:
print startStr
mergeImagesSubstractive(image1, image2) # crée une image étant la fusion (soustractive) de 2 images
elif action == 19:
r = raw_input("rouge [0]: ")
g = raw_input("vert [0]: ")
b = raw_input("bleu [0]: ")
s = raw_input("seuil [50]: ")
arg1, arg2, arg3, arg4 = 0,0,0,50
if r != "":
arg1 = int(r)
if g != "":
arg2 = int(g)
if b != "":
arg3 = int(b)
if s != "":
arg4 = int(s)
print startStr
revealShapes(image1, arg1, arg2, arg3, arg4) # révèle la couleur spécifiée
elif action == 20:
x = raw_input("abscisses(x) [0]: ")
y = raw_input("ordonnées(y) [0]: ")
arg1, arg2 = 0,0
if x != "":
arg1 = int(x)
if y != "":
arg2 = int(y)
print startStr
colorShape(image1, arg1, arg2) # colorie la forme contenant le pixel de coordonnées donné
elif action == 21:
print startStr
colorAllShapes(image1) # colorie la forme contenant le pixel de coordonnées donné
elif action == 22:
print startStr
testStroke(image1) # trace les contours uniquement à partir de formes pleines
# filtres
elif action == 25:
print startStr
testAverageFilter(image1) # teste le lissage
elif action == 26:
print startStr
testLaplace(image1) # teste le filtre de Laplace
elif action == 27:
print startStr
testRoberts(image1) # teste le filtre de Roberts
elif action == 28:
print startStr
testPrewitt(image1) # teste le filtre de Prewitt
elif action == 29:
print startStr
testSobel(image1) # teste le filtre de Sobel
elif action == 30:
print startStr
testConvolution(image1) # teste le filtre de Convolution
elif action == 31:
print startStr
testBichrome(image1) # teste le passage au bichromatique
elif action == 32:
print startStr
testHighPass(image1) # teste le filtre passe haut
else:
print "Wrong choice"
exit();
print "+---------------------------+---------+"
print "| EXECUTION TIME | %s |" % execTime.get()
print "+---------------------------+---------+"
print
print result
print '- [PRESS ANY KEY TO CONTINUE] -';
print '- [ BUT PRESS "Q" TO QUIT ] -';
print '- [ OR PRESS "R" TO RELOAD ] -';
loopKey = raw_input('- [ OR PRESS "S" TO SAVE ] -');
if( loopKey == 'q' or loopKey == 'Q' ):
exit();
elif( loopKey == 'r' or loopKey == 'R' ):
loadFiles();
elif( loopKey == 's' or loopKey == 'S' ):
out = raw_input("out file: ");
image1.unparse();
image1.write(out);
interfaceLoop();
################" EXECUTABLE "###################
sh('clear');
print "+---------------------------+"
print "| |"
print "| CHARGEMENT... |"
print "| |"
print "+---------------------------+"
# ON CREE LES IMAGES
image1, file1 = BMPFile(True), "";
image2, file2 = BMPFile(), "";
with open( sys.argv[1] ) as file:
file1 += file.read();
try:
with open( sys.argv[2] ) as file:
file2 += file.read()
except Exception as e:
print e;
def loadFiles():
image1.parse( file1 );
for line in image1.content.map:
for pix in line:
image1.drawer.setPixel( pix );
image1.drawer.refresh();
if( file2 != "" ):
image2.parse( file2 );
loadFiles();
m.boucle()
# interfaceLoop();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 352 KiB

BIN
code/sap.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 KiB

335
docs/interface.svg Normal file
View File

@ -0,0 +1,335 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm"
height="297mm"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="Nouveau document 1">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
inkscape:cx="541.02715"
inkscape:cy="694.28194"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1056"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g4939">
<rect
ry="18.337547"
y="97.392563"
x="77.88752"
height="452.79639"
width="244.93924"
id="rect3755"
style="fill:#eeeeee;fill-opacity:1;stroke:#dfdfdf;stroke-width:0.21076591;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.42153182, 0.21076591;stroke-dashoffset:0" />
<g
id="g3795">
<rect
style="fill:#999999;fill-opacity:1;stroke:#dfdfdf;stroke-width:0.14207564;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.28415128, 0.14207564;stroke-dashoffset:0"
id="rect3757"
width="210.7197"
height="24.293644"
x="94.997292"
y="111.64394"
ry="6.5795283" />
<text
xml:space="preserve"
style="font-size:24.49528503px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"
x="155.98335"
y="132.73729"
id="text3761"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3763"
x="155.98335"
y="132.73729">image A</tspan></text>
</g>
<g
id="g3790">
<rect
ry="6.5795283"
y="147.64395"
x="94.997292"
height="24.293644"
width="210.7197"
id="rect3759"
style="fill:#999999;fill-opacity:1;stroke:#dfdfdf;stroke-width:0.14207564;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.28415128, 0.14207564;stroke-dashoffset:0" />
<text
sodipodi:linespacing="125%"
id="text3765"
y="168.73729"
x="155.98335"
style="font-size:24.49528503px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"
xml:space="preserve"><tspan
y="168.73729"
x="155.98335"
id="tspan3767"
sodipodi:role="line">image B</tspan></text>
</g>
<g
transform="translate(0,100)"
id="g3800">
<rect
style="fill:#999999;fill-opacity:1;stroke:#dfdfdf;stroke-width:0.14207564;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.28415128, 0.14207564;stroke-dashoffset:0"
id="rect3802"
width="210.7197"
height="24.293644"
x="94.997292"
y="147.64395"
ry="6.5795283" />
<text
xml:space="preserve"
style="font-size:24.49528503px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"
x="167.90208"
y="167.67281"
id="text3804"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3806"
x="167.90208"
y="167.67281">action</tspan></text>
</g>
<path
sodipodi:nodetypes="ccc"
inkscape:connector-curvature="0"
id="path3808"
d="m 145.00448,198.26178 c 19.63131,21.6938 43.86801,31.14085 65.28845,11.86682 27.86227,9.45192 46.18794,14.47333 60.48253,-0.28893"
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<g
id="g3829"
transform="translate(0,136)">
<rect
ry="6.5795283"
y="147.64395"
x="94.997292"
height="24.293644"
width="210.7197"
id="rect3831"
style="fill:#999999;fill-opacity:1;stroke:#dfdfdf;stroke-width:0.14207564;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.28415128, 0.14207564;stroke-dashoffset:0" />
<text
sodipodi:linespacing="125%"
id="text3833"
y="168.53995"
x="164.96576"
style="font-size:24.49528503px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"
xml:space="preserve"><tspan
y="168.53995"
x="164.96576"
id="tspan3835"
sodipodi:role="line">valider</tspan></text>
</g>
<g
transform="translate(0,244)"
id="g4869">
<rect
style="fill:#999999;fill-opacity:1;stroke:#dfdfdf;stroke-width:0.14207564;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.28415128, 0.14207564;stroke-dashoffset:0"
id="rect4871"
width="210.7197"
height="24.293644"
x="94.997292"
y="147.64395"
ry="6.5795283" />
<text
xml:space="preserve"
style="font-size:24.49528503px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"
x="116.79449"
y="164.65874"
id="text4873"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4875"
x="116.79449"
y="164.65874">inverser images</tspan></text>
</g>
<g
id="g4877"
transform="translate(0,284)">
<rect
ry="6.5795283"
y="147.64395"
x="94.997292"
height="24.293644"
width="210.7197"
id="rect4879"
style="fill:#999999;fill-opacity:1;stroke:#dfdfdf;stroke-width:0.14207564;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.28415128, 0.14207564;stroke-dashoffset:0" />
<text
sodipodi:linespacing="125%"
id="text4881"
y="165.60362"
x="110.82018"
style="font-size:24.49528503px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"
xml:space="preserve"><tspan
y="165.60362"
x="110.82018"
id="tspan4883"
sodipodi:role="line">recharger image</tspan></text>
</g>
<g
transform="translate(0,324)"
id="g4885">
<rect
style="fill:#999999;fill-opacity:1;stroke:#dfdfdf;stroke-width:0.14207564;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.28415128, 0.14207564;stroke-dashoffset:0"
id="rect4887"
width="210.7197"
height="24.293644"
x="94.997292"
y="147.64395"
ry="6.5795283" />
<text
xml:space="preserve"
style="font-size:24.49528503px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"
x="142.12103"
y="166.65874"
id="text4889"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4891"
x="142.12103"
y="166.65874">enregistrer</tspan></text>
</g>
<g
id="g4893"
transform="translate(0,364)">
<rect
ry="6.5795283"
y="147.64395"
x="94.997292"
height="24.293644"
width="210.7197"
id="rect4895"
style="fill:#999999;fill-opacity:1;stroke:#dfdfdf;stroke-width:0.14207564;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.28415128, 0.14207564;stroke-dashoffset:0" />
<text
sodipodi:linespacing="125%"
id="text4897"
y="168.53995"
x="164.96576"
style="font-size:24.49528503px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"
xml:space="preserve"><tspan
y="168.53995"
x="164.96576"
id="tspan4899"
sodipodi:role="line">quitter</tspan></text>
</g>
</g>
<rect
ry="18.340992"
y="97.350044"
x="357.85428"
height="452.88144"
width="87.14859"
id="rect4977"
style="fill:#eeeeee;fill-opacity:1;stroke:#dfdfdf;stroke-width:0.12573093;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.25146186, 0.12573093;stroke-dashoffset:0" />
<rect
style="fill:#808000;fill-opacity:1;stroke:#dfdfdf;stroke-width:0.12585999;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.25171998, 0.12585999;stroke-dashoffset:0"
id="rect5079"
width="29.666998"
height="27.868998"
x="386.59506"
y="124.67769"
ry="0" />
<rect
ry="0"
y="160.67769"
x="386.59506"
height="27.868998"
width="29.666998"
id="rect5083"
style="fill:#808000;fill-opacity:1;stroke:#dfdfdf;stroke-width:0.12585999;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.25171998, 0.12585999;stroke-dashoffset:0" />
<rect
style="fill:#800000;fill-opacity:1;stroke:#dfdfdf;stroke-width:0.12585999000000000;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.25171998000000001, 0.12585999000000000;stroke-dashoffset:0"
id="rect5085"
width="29.666998"
height="27.868998"
x="386.59506"
y="260.67767"
ry="0" />
<g
id="g5095"
transform="matrix(0.398773,0,0,0.398773,164.93428,273.66386)">
<rect
y="369.50504"
x="542.85712"
height="9.2857141"
width="85.714287"
id="rect5089"
style="fill:#800000;fill-opacity:1;stroke:#dfdfdf;stroke-width:0.15000001;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.3, 0.15;stroke-dashoffset:0" />
<path
inkscape:connector-curvature="0"
id="path5091"
d="M 614.28571,349.50504 645,375.93361 621.42857,401.6479 613.57143,397.36218 630,378.79075 608.57143,355.21932 z"
style="fill:#800000;fill-opacity:1;stroke:none" />
<path
style="fill:#800000;fill-opacity:1;stroke:none"
d="M 559.28572,349.50504 528.57143,375.93361 552.14286,401.6479 560,397.36218 543.57143,378.79075 565,355.21932 z"
id="path5093"
inkscape:connector-curvature="0" />
</g>
<g
id="g5114"
transform="matrix(0.29343312,0,0,0.29343312,217.19152,348.14569)">
<path
d="m 646.42856,379.50504 c 0,23.27485 -18.868,42.14285 -42.14285,42.14285 -23.27486,0 -42.14286,-18.868 -42.14286,-42.14285 0,-23.27486 18.868,-42.14286 42.14286,-42.14286 23.27485,0 42.14285,18.868 42.14285,42.14286 z"
sodipodi:ry="42.142857"
sodipodi:rx="42.142857"
sodipodi:cy="379.50504"
sodipodi:cx="604.28571"
id="path5108"
style="fill:#800000;fill-opacity:1;stroke:none"
sodipodi:type="arc" />
<path
transform="matrix(0.83050847,0,0,0.83050847,102.42131,64.322889)"
sodipodi:type="arc"
style="fill:#eeeeee;fill-opacity:1;stroke:none"
id="path5110"
sodipodi:cx="604.28571"
sodipodi:cy="379.50504"
sodipodi:rx="42.142857"
sodipodi:ry="42.142857"
d="m 646.42856,379.50504 c 0,23.27485 -18.868,42.14285 -42.14285,42.14285 -23.27486,0 -42.14286,-18.868 -42.14286,-42.14285 0,-23.27486 18.868,-42.14286 42.14286,-42.14286 23.27485,0 42.14285,18.868 42.14285,42.14286 z" />
<path
inkscape:connector-curvature="0"
id="path5112"
d="m 625.71429,370.21932 17.14285,17.85715 20,-15.71429"
style="fill:none;stroke:#800000;stroke-width:4.80000019;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

View File

@ -257,7 +257,7 @@
\section{Le bruit de type <<Poivre \& Sel>>} \section{Le bruit de type <<Poivre \& Sel>>}
\textbf{Définition graphique: }L'image est parsemée de pixels ayant une teinte extrême (blancs ou noirs) sans rapport avec leur contexte (voisinage).\\\\ \textbf{Définition graphique: }L'image est parsemée de pixels ayant une teinte extrême (blancs ou noirs) sans rapport avec leur contexte (voisinage).\\\\
\textbf{Bruitage: }Le bruitage se fait en fonction du paramètre réel \begin{math}seuil\in[0;1]\end{math}. Il y a donc \begin{math}n = seuil\times width\times height\end{math} couples \begin{math}(x, y)\end{math} aléatoires qui sont en noir ou blanc (choix aléatoire), ce qui correspond à \begin{math}(100\times seuil)\end{math} \% de la totalité des pixels.\\\\ \textbf{Bruitage: }Le bruitage se fait en fonction du paramètre réel \begin{math}seuil\in[0;1]\end{math}. Il y a donc \begin{math}n = seuil\times width\times height\end{math} couples \begin{math}(x, y)\end{math} aléatoires qui sont en noir ou blanc (choix aléatoire), ce qui correspond à \begin{math}(100\times seuil)\end{math} \% de la totalité des pixels.\\\\
\textbf{Débruitage: }L'image est débruitée en fonction de deux paramètres \emph{seuil} et \emph{borne}, tout deux compris dans \begin{math}[0;255]\end{math}. Chaque pixel est traité si et seulement si il est proche du noir ou du blanc, c'est-à-dire compris dans \begin{math}[0;borne]\end{math} pour le noir et dans \begin{math}[255-borne;255]\end{math} pour le blanc. Chaque pixel traité est comparé à la couleur moyenne de ses 8 voisins, si la différence avec sa couleur est supérieure à \emph{seuil}, le pixel se voit attribuer la couleur moyenne de ses voisins. Il est à noter que si borne vaut 255, tout les pixels seront traités, de même que si seuil vaut 255, tout les pixels traités se verront affecter la couleur moyenne de leurs voisins.\\\\ \textbf{Débruitage: }L'image est débruitée en fonction de deux paramètres \emph{seuil} et \emph{borne}, tout deux compris dans \begin{math}[0;255]\end{math}. Chaque pixel est traité si et seulement si il est proche du noir ou du blanc, c'est-à-dire compris dans \begin{math}[0;borne]\end{math} pour le noir et dans \begin{math}[255-borne;255]\end{math} pour le blanc. Chaque pixel traité est comparé à la couleur moyenne de ses 3 (haut gauche) voisins, si la différence avec sa couleur est supérieure à \emph{seuil}, le pixel se voit attribuer la couleur moyenne de ses voisins. Il est à noter que si borne vaut 255, tout les pixels seront traités, de même que si seuil vaut 255, tout les pixels traités se verront affecter la couleur moyenne de leurs voisins.\\\\
% effet 50% % effet 50%
\begin{figure}[!ht] \begin{figure}[!ht]
\centering \centering