Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MI-AIM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tomas, Vojtěch, Bc.
MI-AIM
Commits
6db431c3
Commit
6db431c3
authored
5 years ago
by
Vojtěch Tomas
Browse files
Options
Downloads
Patches
Plain Diff
Refactoring the parameter loading
parent
3d502c48
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+11
-6
11 additions, 6 deletions
README.md
pictures
+0
-0
0 additions, 0 deletions
pictures
src/include/interface.hpp
+13
-4
13 additions, 4 deletions
src/include/interface.hpp
src/interface.cpp
+33
-52
33 additions, 52 deletions
src/interface.cpp
with
57 additions
and
62 deletions
README.md
+
11
−
6
View file @
6db431c3
...
...
@@ -22,7 +22,8 @@ Výsledky jsou uloženy ve [složce monadic](./monadic) spolu s podrobnějším
Je přiložen Makefile, vše by mělo fungovat na všech platformách (snad), jiné závislosti nejsou třeba. Vyvíjím na Linuxu.
## Ovládání
command
<parameter>
(optional parameter)
Overview of available commands:
command
<parameter>
(optional parameter)
open <filename>
loads image from file onto image stack
...
...
@@ -34,14 +35,15 @@ Je přiložen Makefile, vše by mělo fungovat na všech platformách (snad), ji
images
list all images loaded on image stack
save <stack index> <png|jpg> <output name>
save image into a file with chosen format
save <png|jpg> <output name>
save image on top of image stack
into a file with chosen format
histogram (filename)
draw histogram of the image on top of the stack
or save the histogram it into .png file
negat
iv
e
negate
negate the image on top of the image stack
threshold <value from <0, 1>>
...
...
@@ -71,6 +73,9 @@ Je přiložen Makefile, vše by mělo fungovat na všech platformách (snad), ji
quantize the image
on top of the image stack
exit
exit the application
equalize
eqalize the image
on top of the image stack
exit
exit the application
\ No newline at end of file
This diff is collapsed.
Click to expand it.
pictures
deleted
100755 → 0
+
0
−
0
View file @
3d502c48
File deleted
This diff is collapsed.
Click to expand it.
src/include/interface.hpp
+
13
−
4
View file @
6db431c3
#pragma once
#include
"editor.hpp"
#include
<unordered_map>
using
namespace
std
;
class
Interface
;
typedef
void
(
Interface
::*
imethod
)(
istringstream
&
iss
);
class
Interface
{
public:
...
...
@@ -11,11 +18,11 @@ protected:
void
load_image
(
istringstream
&
iss
);
void
drop_image
(
istringstream
&
iss
);
void
save_image
(
istringstream
&
iss
);
void
print_help
(
)
const
;
void
print_image_stack
(
)
const
;
void
print_help
(
istringstream
&
iss
)
;
void
print_image_stack
(
istringstream
&
iss
)
;
void
histogram
(
istringstream
&
iss
);
void
negative
();
void
negative
(
istringstream
&
iss
);
void
threshold
(
istringstream
&
iss
);
void
brightness
(
istringstream
&
iss
);
void
contrast
(
istringstream
&
iss
);
...
...
@@ -23,7 +30,9 @@ protected:
void
nonlincontrast
(
istringstream
&
iss
);
void
logscale
(
istringstream
&
iss
);
void
quantize
(
istringstream
&
iss
);
void
equalize
();
void
equalize
(
istringstream
&
iss
);
Editor
editor
;
std
::
unordered_map
<
std
::
string
,
imethod
>
calls
;
};
This diff is collapsed.
Click to expand it.
src/interface.cpp
+
33
−
52
View file @
6db431c3
...
...
@@ -2,6 +2,7 @@
#include
<string>
#include
<sstream>
#include
<cstring>
#include
"include/interface.hpp"
#include
"include/editor.hpp"
...
...
@@ -12,6 +13,22 @@ using namespace std;
Interface
::
Interface
()
{
cout
<<
"Initializing the application..."
<<
endl
;
calls
[
"open"
]
=
&
Interface
::
load_image
;
calls
[
"drop"
]
=
&
Interface
::
drop_image
;
calls
[
"save"
]
=
&
Interface
::
save_image
;
calls
[
"help"
]
=
&
Interface
::
print_help
;
calls
[
"images"
]
=
&
Interface
::
print_image_stack
;
calls
[
"negate"
]
=
&
Interface
::
negative
;
calls
[
"threshold"
]
=
&
Interface
::
threshold
;
calls
[
"brightness"
]
=
&
Interface
::
brightness
;
calls
[
"contrast"
]
=
&
Interface
::
contrast
;
calls
[
"gamma"
]
=
&
Interface
::
gamma
;
calls
[
"nonlincontrast"
]
=
&
Interface
::
nonlincontrast
;
calls
[
"logscale"
]
=
&
Interface
::
logscale
;
calls
[
"equalize"
]
=
&
Interface
::
equalize
;
calls
[
"quantize"
]
=
&
Interface
::
quantize
;
calls
[
"histogram"
]
=
&
Interface
::
histogram
;
}
void
Interface
::
run
()
...
...
@@ -28,56 +45,16 @@ void Interface::run()
istringstream
iss
(
line
);
iss
>>
input
;
if
(
input
==
"open"
)
load_image
(
iss
);
if
(
input
==
"drop"
)
drop_image
(
iss
);
if
(
input
==
"save"
)
save_image
(
iss
);
if
(
input
==
"help"
)
print_help
();
if
(
input
==
"negate"
)
negative
();
if
(
input
==
"threshold"
)
threshold
(
iss
);
if
(
input
==
"brightness"
)
brightness
(
iss
);
if
(
input
==
"contrast"
)
contrast
(
iss
);
if
(
input
==
"gamma"
)
gamma
(
iss
);
if
(
input
==
"nonlincontrast"
)
nonlincontrast
(
iss
);
if
(
input
==
"logscale"
)
logscale
(
iss
);
if
(
input
==
"equlize"
)
equalize
();
if
(
input
==
"quantize"
)
quantize
(
iss
);
if
(
input
==
"images"
)
print_image_stack
();
if
(
input
==
"histogram"
)
histogram
(
iss
);
if
(
input
==
"exit"
)
{
iss
.
clear
();
return
;
}
auto
it
=
calls
.
find
(
input
);
if
(
it
!=
calls
.
end
())
(
this
->*
(
it
->
second
))(
iss
);
}
if
(
cin
.
eof
())
...
...
@@ -148,7 +125,7 @@ void Interface::histogram(istringstream &iss)
cout
<<
"there was some error creating the histogram"
<<
endl
;
}
void
Interface
::
negative
()
void
Interface
::
negative
(
istringstream
&
iss
)
{
int
status
=
editor
.
negative
();
...
...
@@ -268,7 +245,7 @@ void Interface::quantize(istringstream &iss)
cout
<<
"there was some error"
<<
endl
;
}
void
Interface
::
equalize
()
void
Interface
::
equalize
(
istringstream
&
iss
)
{
int
status
=
editor
.
equalize
();
...
...
@@ -276,7 +253,7 @@ void Interface::equalize()
cout
<<
"there was some error"
<<
endl
;
}
void
Interface
::
print_help
(
)
const
void
Interface
::
print_help
(
istringstream
&
iss
)
{
cout
<<
"Overview of available commands:
\n
"
" command <parameter> (optional parameter)
\n\n
"
...
...
@@ -287,12 +264,13 @@ void Interface::print_help() const
" filename from image stack
\n\n
"
" images
\n
"
" list all images loaded on image stack
\n\n
"
" save <stack index> <png|jpg> <output name>
\n
"
" save image into a file with chosen format
\n\n
"
" save <png|jpg> <output name>
\n
"
" save image on top of image stack
\n
"
" into a file with chosen format
\n\n
"
" histogram (filename)
\n
"
" draw histogram of the image on top of the stack
\n
"
" or save the histogram it into .png file
\n\n
"
" negat
iv
e
\n
"
" negate
\n
"
" negate the image on top of the image stack
\n\n
"
" threshold <value from <0, 1>>
\n
"
" threshold the image on top of the image stack
\n\n
"
...
...
@@ -314,11 +292,14 @@ void Interface::print_help() const
" quantize <integer value from <1, inf>>
\n
"
" quantize the image
\n
"
" on top of the image stack
\n\n
"
" equalize
\n
"
" eqalize the image
\n
"
" on top of the image stack
\n\n
"
" exit
\n
"
" exit the application
\n\n
"
;
}
void
Interface
::
print_image_stack
(
)
const
{
void
Interface
::
print_image_stack
(
istringstream
&
iss
)
{
for
(
size_t
i
=
0
;
i
<
STACKSIZE
;
i
++
)
{
const
Image
*
image
=
editor
.
get_image
(
i
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment