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
6e8940d3
Commit
6e8940d3
authored
Feb 20, 2018
by
Théophile BORNON
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Begin benchmarking
parent
3399a593
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
210 additions
and
51 deletions
+210
-51
ImageProcessing.sln
ImageProcessing.sln
+7
-1
App.config
ImageProcessing_Benchmark/App.config
+6
-0
ImageProcessing_Benchmark.csproj
ImageProcessing_Benchmark/ImageProcessing_Benchmark.csproj
+52
-0
Program.cs
ImageProcessing_Benchmark/Program.cs
+28
-0
AssemblyInfo.cs
ImageProcessing_Benchmark/Properties/AssemblyInfo.cs
+36
-0
lena.bmp
ImageProcessing_Benchmark/bin/Debug/img/lena.bmp
+0
-0
ImageProcessing.csproj
S04_Projet/ImageProcessing.csproj
+2
-2
MyImage.cs
S04_Projet/MyImage.cs
+65
-38
Program.cs
S04_Projet/Program.cs
+14
-10
No files found.
S04_Projet
.sln
→
ImageProcessing
.sln
View file @
6e8940d3
...
@@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
...
@@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2026
VisualStudioVersion = 15.0.27130.2026
MinimumVisualStudioVersion = 10.0.40219.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "S04_Projet", "S04_Projet\S04_Projet.csproj", "{229D3602-654B-498B-9478-5CC3982C358C}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageProcessing", "S04_Projet\ImageProcessing.csproj", "{229D3602-654B-498B-9478-5CC3982C358C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageProcessing_Benchmark", "ImageProcessing_Benchmark\ImageProcessing_Benchmark.csproj", "{54D04E0E-009D-4928-BEF8-B2FF464536CC}"
EndProject
EndProject
Global
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
GlobalSection(SolutionConfigurationPlatforms) = preSolution
...
@@ -15,6 +17,10 @@ Global
...
@@ -15,6 +17,10 @@ Global
{229D3602-654B-498B-9478-5CC3982C358C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{229D3602-654B-498B-9478-5CC3982C358C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{229D3602-654B-498B-9478-5CC3982C358C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{229D3602-654B-498B-9478-5CC3982C358C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{229D3602-654B-498B-9478-5CC3982C358C}.Release|Any CPU.Build.0 = Release|Any CPU
{229D3602-654B-498B-9478-5CC3982C358C}.Release|Any CPU.Build.0 = Release|Any CPU
{54D04E0E-009D-4928-BEF8-B2FF464536CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{54D04E0E-009D-4928-BEF8-B2FF464536CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54D04E0E-009D-4928-BEF8-B2FF464536CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54D04E0E-009D-4928-BEF8-B2FF464536CC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
HideSolutionNode = FALSE
...
...
ImageProcessing_Benchmark/App.config
0 → 100644
View file @
6e8940d3
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.6.1"
/>
</
startup
>
</
configuration
>
\ No newline at end of file
ImageProcessing_Benchmark/ImageProcessing_Benchmark.csproj
0 → 100644
View file @
6e8940d3
<?xml version="1.0" encoding="utf-8"?>
<Project
ToolsVersion=
"15.0"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<Import
Project=
"$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
Condition=
"Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"
/>
<PropertyGroup>
<Configuration
Condition=
" '$(Configuration)' == '' "
>
Debug
</Configuration>
<Platform
Condition=
" '$(Platform)' == '' "
>
AnyCPU
</Platform>
<ProjectGuid>
{54D04E0E-009D-4928-BEF8-B2FF464536CC}
</ProjectGuid>
<OutputType>
Exe
</OutputType>
<RootNamespace>
ImageProcessing_Benchmark
</RootNamespace>
<AssemblyName>
ImageProcessing_Benchmark
</AssemblyName>
<TargetFrameworkVersion>
v4.6.1
</TargetFrameworkVersion>
<FileAlignment>
512
</FileAlignment>
<AutoGenerateBindingRedirects>
true
</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
<PlatformTarget>
AnyCPU
</PlatformTarget>
<DebugSymbols>
true
</DebugSymbols>
<DebugType>
full
</DebugType>
<Optimize>
false
</Optimize>
<OutputPath>
bin\Debug\
</OutputPath>
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<PlatformTarget>
AnyCPU
</PlatformTarget>
<DebugType>
pdbonly
</DebugType>
<Optimize>
true
</Optimize>
<OutputPath>
bin\Release\
</OutputPath>
<DefineConstants>
TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Core"
/>
<Reference
Include=
"System.Xml.Linq"
/>
<Reference
Include=
"System.Data.DataSetExtensions"
/>
<Reference
Include=
"Microsoft.CSharp"
/>
<Reference
Include=
"System.Data"
/>
<Reference
Include=
"System.Net.Http"
/>
<Reference
Include=
"System.Xml"
/>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"Program.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
</ItemGroup>
<ItemGroup>
<None
Include=
"App.config"
/>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
</Project>
\ No newline at end of file
ImageProcessing_Benchmark/Program.cs
0 → 100644
View file @
6e8940d3
using
System.Diagnostics
;
using
System.IO
;
namespace
ImageProcessing_Benchmark
{
class
Program
{
static
void
Main
(
string
[]
args
)
{
string
results
=
""
;
Stopwatch
sw
=
new
Stopwatch
();
System
.
Console
.
WriteLine
(
"Benchmarking"
);
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
sw
.
Restart
();
Process
.
Start
(
"S04_Projet.exe"
);
while
(
Process
.
GetProcessesByName
(
"S04_Projet"
).
Length
!=
0
);
sw
.
Stop
();
results
+=
sw
.
ElapsedMilliseconds
+
"\n"
;
}
File
.
WriteAllText
(
"bench.csv"
,
results
);
System
.
Console
.
WriteLine
(
"Done"
);
System
.
Console
.
Read
();
}
}
}
ImageProcessing_Benchmark/Properties/AssemblyInfo.cs
0 → 100644
View file @
6e8940d3
using
System.Reflection
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("ImageProcessing_Benchmark")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP Inc.")]
[assembly: AssemblyProduct("ImageProcessing_Benchmark")]
[assembly: AssemblyCopyright("Copyright © HP Inc. 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("54d04e0e-009d-4928-bef8-b2ff464536cc")]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
ImageProcessing_Benchmark/bin/Debug/img/lena.bmp
0 → 100644
View file @
6e8940d3
768 KB
S04_Projet/
S04_Projet
.csproj
→
S04_Projet/
ImageProcessing
.csproj
View file @
6e8940d3
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
<AutoGenerateBindingRedirects>
true
</AutoGenerateBindingRedirects>
<AutoGenerateBindingRedirects>
true
</AutoGenerateBindingRedirects>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
<PlatformTarget>
AnyCPU
</PlatformTarget>
<PlatformTarget>
x64
</PlatformTarget>
<DebugSymbols>
true
</DebugSymbols>
<DebugSymbols>
true
</DebugSymbols>
<DebugType>
full
</DebugType>
<DebugType>
full
</DebugType>
<Optimize>
false
</Optimize>
<Optimize>
false
</Optimize>
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
<WarningLevel>
4
</WarningLevel>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<PlatformTarget>
AnyCPU
</PlatformTarget>
<PlatformTarget>
x64
</PlatformTarget>
<DebugType>
pdbonly
</DebugType>
<DebugType>
pdbonly
</DebugType>
<Optimize>
true
</Optimize>
<Optimize>
true
</Optimize>
<OutputPath>
bin\Release\
</OutputPath>
<OutputPath>
bin\Release\
</OutputPath>
...
...
S04_Projet/MyImage.cs
View file @
6e8940d3
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
using
System.IO
;
using
System.IO
;
using
System.Diagnostics
;
using
System.Diagnostics
;
using
System.Text
;
using
System.Text
;
using
System.Threading
.Tasks
;
using
System.Threading
;
namespace
S04_Projet
namespace
S04_Projet
{
{
...
@@ -10,6 +10,8 @@ namespace S04_Projet
...
@@ -10,6 +10,8 @@ namespace S04_Projet
{
{
private
Options
opt
;
private
Options
opt
;
private
Pixel
[,]
Pixels
;
private
Pixel
[,]
Pixels
;
private
int
nbProcessors
;
byte
[]
file
;
public
enum
grayFilterType
public
enum
grayFilterType
{
{
...
@@ -27,7 +29,7 @@ namespace S04_Projet
...
@@ -27,7 +29,7 @@ namespace S04_Projet
public
MyImage
(
string
path
)
public
MyImage
(
string
path
)
{
{
opt
=
new
Options
();
opt
=
new
Options
();
byte
[]
file
=
new
byte
[
0
];
file
=
new
byte
[
0
];
try
try
{
{
file
=
File
.
ReadAllBytes
(
path
);
file
=
File
.
ReadAllBytes
(
path
);
...
@@ -41,14 +43,15 @@ namespace S04_Projet
...
@@ -41,14 +43,15 @@ namespace S04_Projet
{
{
if
(
file
.
Length
!=
0
)
if
(
file
.
Length
!=
0
)
{
{
FromFileToImage
(
file
);
FromFileToImage
();
}
}
}
}
}
}
public
MyImage
(
byte
[]
file
)
public
MyImage
(
byte
[]
file
)
{
{
FromFileToImage
(
file
);
this
.
file
=
file
;
FromFileToImage
();
}
}
public
MyImage
(
Options
opt
,
Pixel
[,]
Pixels
)
public
MyImage
(
Options
opt
,
Pixel
[,]
Pixels
)
...
@@ -57,7 +60,7 @@ namespace S04_Projet
...
@@ -57,7 +60,7 @@ namespace S04_Projet
this
.
Pixels
=
Pixels
;
this
.
Pixels
=
Pixels
;
}
}
private
void
FromFileToImage
(
byte
[]
file
)
private
void
FromFileToImage
()
{
{
opt
=
new
Options
();
opt
=
new
Options
();
#
region
Header
#
region
Header
...
@@ -85,43 +88,67 @@ namespace S04_Projet
...
@@ -85,43 +88,67 @@ namespace S04_Projet
int
pixelNumber
=
opt
.
width
*
opt
.
height
;
int
pixelNumber
=
opt
.
width
*
opt
.
height
;
Pixels
=
new
Pixel
[
opt
.
width
,
opt
.
height
];
Pixels
=
new
Pixel
[
opt
.
width
,
opt
.
height
];
#
region
Mono
#
region
Mono
if
(!
Program
.
MULTITHREADING
)
{
int
x
,
y
;
byte
r
,
g
,
b
;
for
(
int
i
=
0
;
i
<
pixelNumber
;
i
++)
for
(
int
i
=
0
;
i
<
pixelNumber
;
i
++)
{
{
int
x
=
i
%
opt
.
width
;
x
=
i
%
opt
.
width
;
int
y
=
i
/
opt
.
width
;
y
=
i
/
opt
.
width
;
byte
b
=
file
[
i
*
3
+
opt
.
offset
];
b
=
file
[
i
*
3
+
opt
.
padding
*
y
+
opt
.
offset
];
byte
g
=
file
[
i
*
3
+
opt
.
offset
+
1
];
g
=
file
[
i
*
3
+
opt
.
padding
*
y
+
opt
.
offset
+
1
];
byte
r
=
file
[
i
*
3
+
opt
.
offset
+
2
];
r
=
file
[
i
*
3
+
opt
.
padding
*
y
+
opt
.
offset
+
2
];
Pixels
[
x
,
y
]
=
new
Pixel
(
r
,
g
,
b
);
Pixels
[
x
,
y
]
=
new
Pixel
(
r
,
g
,
b
);
}
}
#
endregion
}
#
region
Parallel
/*
Parallel.For(0, pixelNumber, i =>
{
Pixels[i % opt.width, i / opt.width] = new Pixel(file[i * 3 + opt.offset],
file[i * 3 + opt.offset + 1],
file[i * 3 + opt.offset + 2]
);
});
*/
#
endregion
#
endregion
#
region
Multithreading
#
region
Multithreading
int
nbProcessors
=
Environment
.
ProcessorCount
;
if
(
Program
.
MULTITHREADING
)
{
nbProcessors
=
Environment
.
ProcessorCount
;
int
pixelPerThread
=
pixelNumber
/
nbProcessors
;
Thread
[]
threads
=
new
Thread
[
nbProcessors
];
for
(
int
i
=
0
;
i
<
nbProcessors
;
i
++)
for
(
int
i
=
0
;
i
<
nbProcessors
;
i
++)
{
{
threads
[
i
]
=
new
Thread
(
new
ParameterizedThreadStart
(
LoadImage
));
threads
[
i
].
Start
(
i
);
}
}
for
(
int
i
=
0
;
i
<
nbProcessors
;
i
++)
threads
[
i
].
Join
();
}
#
endregion
#
endregion
file
=
null
;
#
endregion
#
endregion
}
}
private
void
LoadImage
(
object
i
)
{
int
start
=
opt
.
width
*
opt
.
height
/
nbProcessors
*
(
int
)
i
;
int
end
=
opt
.
width
*
opt
.
height
/
nbProcessors
*
((
int
)
i
+
1
);
int
x
,
y
;
byte
r
,
g
,
b
;
for
(
int
j
=
start
;
j
<
end
;
j
++)
{
x
=
j
%
opt
.
width
;
y
=
j
/
opt
.
width
;
b
=
file
[
j
*
3
+
opt
.
padding
*
y
+
opt
.
offset
];
g
=
file
[
j
*
3
+
opt
.
padding
*
y
+
opt
.
offset
+
1
];
r
=
file
[
j
*
3
+
opt
.
padding
*
y
+
opt
.
offset
+
2
];
Pixels
[
x
,
y
]
=
new
Pixel
(
r
,
g
,
b
);
}
}
private
void
FromImageToFile
(
string
output
)
private
void
FromImageToFile
(
string
output
)
{
{
int
nbPixel
=
(
opt
.
height
*
opt
.
width
);
int
nbPixel
=
(
opt
.
height
*
opt
.
width
);
...
@@ -298,7 +325,7 @@ namespace S04_Projet
...
@@ -298,7 +325,7 @@ namespace S04_Projet
return
new
MyImage
(
options
,
PixelArr
);
return
new
MyImage
(
options
,
PixelArr
);
}
}
public
MyImage
ApplyConvFilter
(
in
t
[,]
filter
,
double
factor
)
public
MyImage
ApplyConvFilter
(
shor
t
[,]
filter
,
double
factor
)
{
{
if
(
filter
.
GetLength
(
0
)
==
filter
.
GetLength
(
1
)
&&
filter
.
GetLength
(
0
)
%
2
==
1
)
if
(
filter
.
GetLength
(
0
)
==
filter
.
GetLength
(
1
)
&&
filter
.
GetLength
(
0
)
%
2
==
1
)
{
{
...
@@ -308,7 +335,7 @@ namespace S04_Projet
...
@@ -308,7 +335,7 @@ namespace S04_Projet
Pixel
[,]
PixelArr
=
new
Pixel
[
options
.
width
,
options
.
height
];
Pixel
[,]
PixelArr
=
new
Pixel
[
options
.
width
,
options
.
height
];
int
x
,
y
;
int
x
,
y
;
int
[,]
rMatrix
,
gMatrix
,
bMatrix
;
byte
[,]
rMatrix
,
gMatrix
,
bMatrix
;
byte
r
,
g
,
b
;
byte
r
,
g
,
b
;
for
(
int
i
=
0
;
i
<
nbPixel
;
i
++)
for
(
int
i
=
0
;
i
<
nbPixel
;
i
++)
...
@@ -339,11 +366,11 @@ namespace S04_Projet
...
@@ -339,11 +366,11 @@ namespace S04_Projet
}
}
}
}
private
int
[,]
GetMatrix
(
int
x0
,
int
y0
,
int
size
,
RGB
rgb
)
private
byte
[,]
GetMatrix
(
int
x0
,
int
y0
,
int
size
,
RGB
rgb
)
{
{
int
[,]
matrix
=
new
int
[
size
,
size
];
byte
[,]
matrix
=
new
byte
[
size
,
size
];
for
(
int
i
=
0
;
i
<
size
*
size
;
i
++)
for
(
int
i
=
0
;
i
<
size
*
size
;
i
++)
{
{
int
x
=
x0
+
(
i
%
size
)
-
((
size
-
1
)
/
2
);
int
x
=
x0
+
(
i
%
size
)
-
((
size
-
1
)
/
2
);
int
y
=
y0
+
(
i
/
size
)
-
((
size
-
1
)
/
2
);
int
y
=
y0
+
(
i
/
size
)
-
((
size
-
1
)
/
2
);
...
@@ -364,13 +391,13 @@ namespace S04_Projet
...
@@ -364,13 +391,13 @@ namespace S04_Projet
return
matrix
;
return
matrix
;
}
}
public
static
byte
ConvolutionalResult
(
int
[,]
matrix
,
in
t
[,]
conv
,
int
size
,
double
factor
)
public
static
byte
ConvolutionalResult
(
byte
[,]
matrix
,
shor
t
[,]
conv
,
int
size
,
double
factor
)
{
{
int
r
=
0
;
;
short
r
=
0
;
;
for
(
int
x
=
0
;
x
<
size
;
x
++)
for
(
int
x
=
0
;
x
<
size
;
x
++)
for
(
int
y
=
0
;
y
<
size
;
y
++)
for
(
int
y
=
0
;
y
<
size
;
y
++)
r
+=
matrix
[
x
,
y
]
*
conv
[
x
,
y
]
;
r
+=
(
short
)(
matrix
[
x
,
y
]
*
conv
[
x
,
y
])
;
r
=
(
in
t
)
Math
.
Round
(
r
*
factor
);
r
=
(
shor
t
)
Math
.
Round
(
r
*
factor
);
if
(
r
>
255
)
return
255
;
if
(
r
>
255
)
return
255
;
else
if
(
r
<
0
)
return
0
;
else
if
(
r
<
0
)
return
0
;
else
return
(
byte
)
r
;
else
return
(
byte
)
r
;
...
...
S04_Projet/Program.cs
View file @
6e8940d3
...
@@ -11,58 +11,62 @@ namespace S04_Projet
...
@@ -11,58 +11,62 @@ namespace S04_Projet
{
{
class
Program
class
Program
{
{
public
static
bool
MULTITHREADING
=
false
;
static
void
Main
(
string
[]
args
)
static
void
Main
(
string
[]
args
)
{
{
int
[,]
boxBlurFilter
=
new
int
[,]
{
MyImage
img
=
new
MyImage
(
"img/lena.bmp"
);
img
.
Save
(
"output.bmp"
);
/*short[,] boxBlurFilter = new short[,] {
{1,1,1 },
{1,1,1 },
{1,1,1 },
{1,1,1 },
{1,1,1 }
{1,1,1 }
};
};
int
[,]
identityFilter
=
new
in
t
[,]
short[,] identityFilter = new shor
t[,]
{
{
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 1, 0 },
{ 0, 1, 0 },
{ 0, 0, 0 }
{ 0, 0, 0 }
};
};
int
[,]
edgeDetect1Filter
=
new
in
t
[,]
short[,] edgeDetect1Filter = new shor
t[,]
{
{
{ 1, 0, -1 },
{ 1, 0, -1 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ -1, 0, 1 }
{ -1, 0, 1 }
};
};
int
[,]
edgeDetect2Filter
=
new
in
t
[,]
short[,] edgeDetect2Filter = new shor
t[,]
{
{
{ 0, 1, 0 },
{ 0, 1, 0 },
{ 1, -4, 1 },
{ 1, -4, 1 },
{ 0, 1, 0 }
{ 0, 1, 0 }
};
};
int
[,]
edgeDetect3Filter
=
new
in
t
[,]
short[,] edgeDetect3Filter = new shor
t[,]
{
{
{ -1, -1, -1 },
{ -1, -1, -1 },
{ -1, 8, -1 },
{ -1, 8, -1 },
{ -1, -1, -1 }
{ -1, -1, -1 }
};
};
int
[,]
sharpenFilter
=
new
in
t
[,]
short[,] sharpenFilter = new shor
t[,]
{
{
{ 0, -1, 0 },
{ 0, -1, 0 },
{ -1, 5, -1 },
{ -1, 5, -1 },
{ 0, -1, 0 }
{ 0, -1, 0 }
};
};
MyImage
imgg
=
new
MyImage
(
"img/
flocon
.bmp"
);
MyImage imgg = new MyImage("img/
coco
.bmp");
imgg.ApplyConvFilter(identityFilter, 1).Save("id.bmp");
imgg.ApplyConvFilter(identityFilter, 1).Save("id.bmp");
imgg.ApplyConvFilter(edgeDetect1Filter, 1).Save("edge1.bmp");
imgg.ApplyConvFilter(edgeDetect1Filter, 1).Save("edge1.bmp");
imgg.ApplyConvFilter(edgeDetect2Filter, 1).Save("edge2.bmp");
imgg.ApplyConvFilter(edgeDetect2Filter, 1).Save("edge2.bmp");
imgg.ApplyConvFilter(edgeDetect3Filter, 1).Save("edge3.bmp");
imgg.ApplyConvFilter(edgeDetect3Filter, 1).Save("edge3.bmp");
imgg.ApplyConvFilter(sharpenFilter, 1).Save("sharpen.bmp");
imgg.ApplyConvFilter(sharpenFilter, 1).Save("sharpen.bmp");
imgg
.
ApplyConvFilter
(
boxBlurFilter
,
(
double
)
1
/
9
).
Save
(
"blur.bmp"
);
imgg.ApplyConvFilter(boxBlurFilter, (double)1/9).Save("blur.bmp");
*/
Console
.
ForegroundColor
=
ConsoleColor
.
White
;
/*
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("#############################################################");
Console.WriteLine("#############################################################");
Console.WriteLine("### Bienvenue ###");
Console.WriteLine("### Bienvenue ###");
Console.WriteLine("#############################################################");
Console.WriteLine("#############################################################");
...
@@ -83,7 +87,7 @@ namespace S04_Projet
...
@@ -83,7 +87,7 @@ namespace S04_Projet
//Console.Clear();
//Console.Clear();
Console
.
Read
();
Console.Read();
*/
#
region
Test
#
region
Test
/*MyImage imgRotate90 = img.Rotate90();
/*MyImage imgRotate90 = img.Rotate90();
imgRotate90.Save("90.bmp");
imgRotate90.Save("90.bmp");
...
...
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