complete update

This commit is contained in:
gurkenhabicht 2018-05-19 19:04:50 +02:00
parent 17c1c6c1e6
commit 07d6db93dc
4 changed files with 997 additions and 851 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,32 @@
## Installation
This is a carbon copy of the ANSI C version. Sole purpose of its existence is to be compiled under Visual Studio.
If you do not use VS, pick the ANSI C version __../src/ansi_c__implementation__.
## Features
This little piece of code compares 3 different implementations of a least mean square filter.
+ local mean
+ direct predecessor
+ differential predecessor
Greyscale PPM files can be used for input at this iteration. Output will be generated as .txt files with predicted value generated by the filter and its error value as well as given actual value from the PPM file. Furthermore there is an output as an svg graph to compare the implementatiosn on a visual level. These graphical results are build from __graphResults_template.html__ which creates the actual output to __graphResults.html__. Open this file to see the results.
You can hide graphs by clicking on its name for better visibility.
Use `$ ./lms -h` for help.
### Usage
There are a bunch of options you can predefine but do not have to. The only parameter needed is __-i__ which is the inputfile.
| Parameter | Description | StdVal |
|----------:|:-----------------------------:|:-------|
| -i | The inputfile, has to be PPM | none |
| -n | Amount of input data used | 500 |
| -w | Size of M (window) | 5 |
| -c | Choose RGB color channel, green has least noise. | green |
| -l | Learnrate of machine learning | 0.8 |
| -s | Seed randomizing weights. Choose for repoducability. | time(NULL)|

View File

@ -1,62 +1,51 @@
<!DOCTYPE html>
<html>
<head>
NLMSvariants | Graphical Output ||
<font id="1" color="blue" onclick="clicksvg(this)">Eingangswert</font> |
<font id="2" color="red" onclick="clicksvg(this)">direkter Vorgaenger</font> |
<font id="3" color="green" onclick="clicksvg(this)">letzter Mittelwert</font>
<script>
function clicksvg(e){
id = e.id
graph = document.getElementById("svg_" + id);
if(graph.style.visibility == "hidden" || !graph.style.visibility){
graph.style.visibility = "visible";
}else{
graph.style.visibility = "hidden";
}
}
</script>
</head>
<body>
<svg height="1200" viewBox="100 50 400 -400" width="3000" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>NLMSvariants output graph
</desc>
<defs>
<pattern id="smallGrid" width="10" height="10" patternUnits="userSpaceOnUse">
<path d="M 10 0 L 0 0 0 10" fill="none" stroke="gray" stroke-width="0.5"></path>
</pattern>
<pattern id="grid10" width="100" height="100" patternUnits="userSpaceOnUse">
<rect width="100" height="100" fill="url(#smallGrid)"></rect>
<path d="M 100 0 L 0 0 0 100" fill="none" stroke="gray" stroke-width="1"></path>
</pattern>
</defs>
<rect fill="white" height="1200" width="3000" y="0"></rect>
<rect fill="url(#grid10)" height="1200" width="3000" y="0"></rect>
<g transform="translate(0,0) scale(1, 1)">
<line class="l1 s-black " stroke="black" x1="-200" x2="3000" y1="400" y2="400"></line>
<line class="l1 s-black " stroke="black" x1="200" x2="200" y1="-200" y2="1200"></line>
</g>
<g transform="translate(200, 400) scale(1,-1)">
<path d="M0 0
<text class="t36 t-mid bold f-black" x="50" y="50">+ +</text>
<text class="t36 t-mid bold f-black" x="-50" y="50">- +</text>
<text class="t36 t-mid bold f-black" x="50" y="-50">+ -</text>
<text class="t36 t-mid bold f-black" x="-50" y="-50">- -</text>
</g>
</svg>
<table width = "100%" border = 1>
<tr align = "top">
<td colspan = "2" bgcolor = "#fefefe">
<h1>
<font color="blue">Eingangswert</font> |
<font color="red">direkter Vorgaenger</font> |
<font color="green">letzter Mittelwert</font>
</h1>
</td>
</tr>
</body>
<html>
<!DOCTYPE html>
<html>
<head>
NLMSvariants | Graphical Output || click font to hide graph
<h2><font face="arial" id="1" color="black" onclick="clicksvg(this)">Image Samples</font> |
<font face="arial" id="2" color="green" onclick="clicksvg(this)">Local Mean</font> |
<font face="arial" id="3" color="blue" onclick="clicksvg(this)">Direct predecessor</font> |
<font face="arial" id="4" color="red" onclick="clicksvg(this)">Differential predecessor</font></h2>
<script>
function clicksvg(e){
id = e.id
graph = document.getElementById("svg_" + id);
if(graph.style.visibility == "hidden" || !graph.style.visibility){
graph.style.visibility = "visible";
}else{
graph.style.visibility = "hidden";
}
}
</script>
</head>
<body bgcolor="#efefef">
<svg height="1200" viewBox="100 50 400 -400" width="3000" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>NLMSvariants output graph
</desc>
<defs>
<pattern id="smallGrid" width="10" height="10" patternUnits="userSpaceOnUse">
<path d="M 10 0 L 0 0 0 10" fill="none" stroke="gray" stroke-width="0.5"></path>
</pattern>
<pattern id="grid10" width="100" height="100" patternUnits="userSpaceOnUse">
<rect width="100" height="100" fill="url(#smallGrid)"></rect>
<path d="M 100 0 L 0 0 0 100" fill="none" stroke="gray" stroke-width="1"></path>
</pattern>
</defs>
<rect fill="white" height="800" width="3000" y="0"></rect>
<rect fill="url(#grid10)" height="800" width="3000" y="0"></rect>
<g transform="translate(0,0) scale(1, 1)">
<line class="l1 s-black " stroke="black" x1="-200" x2="3000" y1="400" y2="400"></line>
<line class="l1 s-black " stroke="black" x1="50" x2="50" y1="-200" y2="800"></line>
</g>
<g transform="translate(50, 400) scale(1,-1)">
<path d="M0 0
<text class="t36 t-mid bold f-black" x="40" y="40">+ +</text>
<text class="t36 t-mid bold f-black" x="-40" y="40">- +</text>
<text class="t36 t-mid bold f-black" x="40" y="-40">+ -</text>
<text class="t36 t-mid bold f-black" x="-40" y="-40">- -</text>
</g>
</svg>
</body>
<html>

View File

@ -0,0 +1,28 @@
/* *svg graph building* */
typedef struct {
double xVal[7];
double yVal[7];
}point_t;
/* *ppm read, copy, write* */
typedef struct {
unsigned char red, green, blue;
}colorChannel_t;
typedef struct {
int x, y;
colorChannel_t *data;
}imagePixel_t;
enum fileSuffix_t{ // used in conjunction with mkFileName()
PURE_WEIGHTS,
USED_WEIGHTS,
DIRECT_PREDECESSOR,
RESULTS,
LOCAL_MEAN,
TEST_VALUES,
DIFFERENTIAL_PREDECESSOR
};