Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imageProcessing
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ecole
imageProcessing
Commits
1825f502
Commit
1825f502
authored
Apr 07, 2018
by
BORNON Théophile
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter command line
parent
fb9a6f07
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
101 additions
and
52 deletions
+101
-52
ImageProcessing.exe
ImageProcessing_Benchmark/bin/Debug/ImageProcessing.exe
+0
-0
ImageProcessing_Benchmark.exe
...cessing_Benchmark/bin/Debug/ImageProcessing_Benchmark.exe
+0
-0
Display.cs
S04_Projet/Display.cs
+29
-2
Filter.cs
S04_Projet/Filter.cs
+29
-37
MultiThreadedTask.cs
S04_Projet/MultiThreadedTask.cs
+4
-10
Program.cs
S04_Projet/Program.cs
+29
-3
ImageProcessing.exe
S04_Projet/bin/Debug/ImageProcessing.exe
+0
-0
filter.bat
S04_Projet/bin/Debug/filter.bat
+5
-0
filterMT.bat
S04_Projet/bin/Debug/filterMT.bat
+5
-0
load.bat
S04_Projet/bin/Debug/load.bat
+0
-0
save.bat
S04_Projet/bin/Debug/save.bat
+0
-0
saveMT.bat
S04_Projet/bin/Debug/saveMT.bat
+0
-0
No files found.
ImageProcessing_Benchmark/bin/Debug/ImageProcessing.exe
View file @
1825f502
No preview for this file type
ImageProcessing_Benchmark/bin/Debug/ImageProcessing_Benchmark.exe
View file @
1825f502
No preview for this file type
S04_Projet/Display.cs
View file @
1825f502
...
...
@@ -26,6 +26,7 @@ namespace S04_Projet
Histogram
,
Dithering
,
Debug
,
Multithreading
,
Save
}
...
...
@@ -40,10 +41,10 @@ namespace S04_Projet
"Passage à une image en nuances de gris (luminosité)"
,
"Superposer avec une autre image"
,
"Ajouter un filtre de convolution"
,
//"Créer une image",
"Générer les histogrammes de l'image"
,
"Floyd-Steinberg dithering"
,
"Activer le mode debug"
,
"Activer le multithreading"
,
"Sauvegarder"
};
...
...
@@ -52,6 +53,7 @@ namespace S04_Projet
public
static
string
fileInfos
;
private
static
Stopwatch
sw
=
new
Stopwatch
();
private
static
Menu
mainMenu
=
new
Menu
(
menuItems
);
private
static
Menu
filterMenu
=
new
Menu
(
Filter
.
Noms
);
/// <summary>
/// Charge l'image
...
...
@@ -155,6 +157,9 @@ namespace S04_Projet
case
Operation
.
Debug
:
output
=
DebugOperation
(
img
);
break
;
case
Operation
.
Multithreading
:
output
=
MultithreadingOperation
(
img
);
break
;
case
Operation
.
Save
:
SaveOperation
(
img
);
break
;
...
...
@@ -255,8 +260,15 @@ namespace S04_Projet
public
static
MyImage
FilterOperation
(
MyImage
img
)
{
int
choix
;
MyImage
newImage
;
Console
.
Clear
();
Console
.
WriteLine
(
"Quel filtre souhaitez-vous appliquer ?"
);
choix
=
filterMenu
.
ShowMenu
(
0
,
3
);
sw
.
Restart
();
newImage
=
img
.
Filter
(
Filter
.
Filtres
[
choix
],
Filter
.
Facteurs
[
choix
]);
return
n
ull
;
return
n
ewImage
;
}
public
static
MyImage
HistogramOperation
(
MyImage
img
)
...
...
@@ -305,6 +317,21 @@ namespace S04_Projet
return
img
;
}
public
static
MyImage
MultithreadingOperation
(
MyImage
img
)
{
if
(
Program
.
MULTITHREADING
)
{
Program
.
MULTITHREADING
=
false
;
menuItems
[(
int
)
Operation
.
Multithreading
]
=
"Activer le multithreading"
;
}
else
{
Program
.
MULTITHREADING
=
true
;
menuItems
[(
int
)
Operation
.
Multithreading
]
=
"Désactiver le multithreading"
;
}
return
img
;
}
public
static
MyImage
SaveOperation
(
MyImage
img
)
{
string
path
=
""
;
...
...
S04_Projet/Filter.cs
View file @
1825f502
...
...
@@ -8,59 +8,51 @@ namespace S04_Projet
{
public
class
Filter
{
public
static
short
[,]
boxBlurFilter
=
new
short
[,]
public
static
string
[]
Noms
=
new
string
[]
{
"Augmenter le contraste"
,
"Flou"
,
"Renforcement des bords"
,
"Détection des bords"
,
"Repoussage"
};
public
static
double
[]
Facteurs
=
new
double
[]
{
1
,
1
/
9.0
,
1
,
1
,
1
};
private
static
short
[,]
contrastPlus
=
new
short
[,]
{
{
0
,-
1
,
0
},
{-
1
,
5
,-
1
},
{
0
,-
1
,
0
}
};
private
static
short
[,]
flou
=
new
short
[,]
{
{
1
,
1
,
1
},
{
1
,
1
,
1
},
{
1
,
1
,
1
}
};
p
ublic
static
short
[,]
identityFilter
=
new
short
[,]
p
rivate
static
short
[,]
renforcement
=
new
short
[,]
{
{
0
,
0
,
0
},
{
0
,
1
,
0
},
{
-
1
,
1
,
0
},
{
0
,
0
,
0
}
};
public
static
short
[,]
edgeDetect1Filter
=
new
short
[,]
{
{
1
,
0
,
-
1
},
{
0
,
0
,
0
},
{
-
1
,
0
,
1
}
};
public
static
short
[,]
edgeDetect2Filter
=
new
short
[,]
private
static
short
[,]
detection
=
new
short
[,]
{
{
0
,
1
,
0
},
{
1
,
-
4
,
1
},
{
1
,-
4
,
1
},
{
0
,
1
,
0
}
};
public
static
short
[,]
edgeDetect3Filter
=
new
short
[,]
{
{
-
1
,
-
1
,
-
1
},
{
-
1
,
8
,
-
1
},
{
-
1
,
-
1
,
-
1
}
};
public
static
short
[,]
sharpenFilter
=
new
short
[,]
private
static
short
[,]
repoussage
=
new
short
[,]
{
{
0
,
-
1
,
0
},
{
-
1
,
5
,
-
1
},
{
0
,
-
1
,
0
}
{
-
2
,-
1
,
0
},
{
-
1
,
1
,
1
},
{
0
,
1
,
2
}
};
public
static
short
[,]
motionBlueFilter
=
new
short
[,]
{
{
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
},
{
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
},
{
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
},
{
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
},
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
},
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
},
};
public
static
List
<
short
[,
]>
Filtres
=
new
List
<
short
[,
]>
()
{
contrastPlus
,
flou
,
renforcement
,
detection
,
repoussage
};
}
}
S04_Projet/MultiThreadedTask.cs
View file @
1825f502
...
...
@@ -61,7 +61,10 @@ namespace S04_Projet
this
.
bPixelPtr
=
bPixelPtr
;
nbPixel
=
opt
.
width
*
opt
.
height
;
size
=
filter
.
GetLength
(
0
);
if
(
Program
.
MULTITHREADING
)
nbProcessors
=
Math
.
Min
(
Environment
.
ProcessorCount
,
8
);
else
nbProcessors
=
1
;
}
else
throw
new
Exception
(
"Impossible d'utiliser ce constructeur pour ce type d'opération"
);
}
...
...
@@ -161,15 +164,6 @@ namespace S04_Projet
int
start
=
nbPixel
/
nbProcessors
*
(
int
)
i
;
int
end
=
nbPixel
/
nbProcessors
*
((
int
)
i
+
1
);
/*double param = (double)i;
int start = (int)(Math.Log(param) * nbPixel);
int end;
if (param + stepSize < Math.E) end = (int)(Math.Log(param + stepSize) * nbPixel);
else end = nbPixel;
Console.WriteLine((double)i + "Start : " + start);
Console.WriteLine((double)i + "End : " + end);*/
byte
[,]
rMatrix
=
new
byte
[
size
,
size
];
byte
[,]
gMatrix
=
new
byte
[
size
,
size
];
byte
[,]
bMatrix
=
new
byte
[
size
,
size
];
...
...
S04_Projet/Program.cs
View file @
1825f502
...
...
@@ -83,9 +83,35 @@ namespace S04_Projet
DEBUG
=
true
;
else
if
(
args
[
i
]
==
"--multithreading"
||
args
[
i
]
==
"-MT"
)
MULTITHREADING
=
true
;
//else if (args[i] == "--multithreadingLoad" || args[i] == "-MTL")
// MULTITHREADING_LOAD = true;
else
if
(
args
[
i
]
==
"--"
)
;
else
if
(
args
[
i
]
==
"--filter"
||
args
[
i
]
==
"-f"
)
{
increment
=
2
;
int
choix
=
0
;
switch
(
args
[
i
+
1
].
ToLower
())
{
case
"flou"
:
case
"blur"
:
choix
=
1
;
break
;
case
"edgedetection"
:
case
"detectionbord"
:
choix
=
3
;
break
;
case
"renforcement"
:
case
"reinforcement"
:
choix
=
2
;
break
;
case
"repoussage"
:
case
"spinning"
:
choix
=
4
;
break
;
case
"constraste"
:
case
"constrast"
:
choix
=
0
;
break
;
}
img
=
img
.
Filter
(
Filter
.
Filtres
[
choix
],
Filter
.
Facteurs
[
choix
]);
};
if
(
DEBUG
)
{
...
...
S04_Projet/bin/Debug/ImageProcessing.exe
View file @
1825f502
No preview for this file type
S04_Projet/bin/Debug/filter.bat
0 → 100644
View file @
1825f502
@echo off
FOR /L %%i IN (1,1,100) DO (
ECHO %%i
ImageProcessing.exe -d -i img\flocon.bmp -f flou
)
\ No newline at end of file
S04_Projet/bin/Debug/filterMT.bat
0 → 100644
View file @
1825f502
@echo off
FOR /L %%i IN (1,1,100) DO (
ECHO %%i
ImageProcessing.exe -d -MT -i img\flocon.bmp -f flou
)
\ No newline at end of file
S04_Projet/bin/Debug/load
Script
.bat
→
S04_Projet/bin/Debug/load.bat
View file @
1825f502
File moved
S04_Projet/bin/Debug/
loadSaveScript
.bat
→
S04_Projet/bin/Debug/
save
.bat
View file @
1825f502
File moved
S04_Projet/bin/Debug/
loadS
aveMT.bat
→
S04_Projet/bin/Debug/
s
aveMT.bat
View file @
1825f502
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment