Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ImageINSA_Tanguy
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Tanguy.Raufflet
ImageINSA_Tanguy
Commits
3f80baaf
Commit
3f80baaf
authored
8 years ago
by
Antoine Pazat
Committed by
Sanchez Alexandre
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Decomposition HSV en images doubles, pas de perte d'informations sur la teinte
parent
bc534d2e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/Operations/CombineHsvOp.cpp
+12
-28
12 additions, 28 deletions
app/Operations/CombineHsvOp.cpp
app/Operations/CombineHsvOp.h
+2
-2
2 additions, 2 deletions
app/Operations/CombineHsvOp.h
app/Operations/splithsvop.cpp
+62
-0
62 additions, 0 deletions
app/Operations/splithsvop.cpp
with
76 additions
and
30 deletions
app/Operations/CombineHsvOp.cpp
+
12
−
28
View file @
3f80baaf
...
...
@@ -35,7 +35,7 @@
using
namespace
std
;
using
namespace
imagein
;
CombineHSVOp
::
CombineHSVOp
()
:
Operation
(
qApp
->
translate
(
"Operations"
,
"Combine
hsv
planes"
).
toStdString
())
CombineHSVOp
::
CombineHSVOp
()
:
Double
Operation
(
qApp
->
translate
(
"Operations"
,
"Combine
HSV
planes"
).
toStdString
())
{
}
...
...
@@ -43,7 +43,7 @@ bool CombineHSVOp::needCurrentImg() const {
return
false
;
}
void
CombineHSVOp
::
operator
()(
const
imagein
::
Image
*
,
const
std
::
map
<
const
imagein
::
Image
*
,
std
::
string
>&
imgList
)
{
void
CombineHSVOp
::
operator
()(
const
imagein
::
Image
_t
<
double
>
*
,
const
map
<
const
imagein
::
Image
_t
<
double
>*
,
string
>&
imgList
)
{
QDialog
*
dialog
=
new
QDialog
();
dialog
->
setWindowTitle
(
qApp
->
translate
(
"Operations"
,
"Parameters"
));
...
...
@@ -51,18 +51,17 @@ void CombineHSVOp::operator()(const imagein::Image*, const std::map<const imagei
QFormLayout
*
layout
=
new
QFormLayout
();
dialog
->
setLayout
(
layout
);
ImageListBox_t
<
double
>**
imageBoxes
=
new
ImageListBox_t
<
double
>*
[
3
*
sizeof
(
ImageListBox_t
<
double
>*
)];
ImageListBox
**
imageBoxes
=
new
ImageListBox
*
[
3
*
sizeof
(
ImageListBox
*
)];
imageBoxes
[
0
]
=
new
ImageListBox
(
dialog
,
NULL
,
imgList
);
imageBoxes
[
0
]
=
new
ImageListBox_t
<
double
>
(
dialog
,
NULL
,
imgList
);
QLabel
*
label
=
new
QLabel
(
"Hue"
,
dialog
);
layout
->
insertRow
(
0
,
label
,
imageBoxes
[
0
]);
imageBoxes
[
1
]
=
new
ImageListBox
(
dialog
,
NULL
,
imgList
);
imageBoxes
[
1
]
=
new
ImageListBox
_t
<
double
>
(
dialog
,
NULL
,
imgList
);
QLabel
*
label1
=
new
QLabel
(
"Saturation"
,
dialog
);
layout
->
insertRow
(
1
,
label1
,
imageBoxes
[
1
]);
imageBoxes
[
2
]
=
new
ImageListBox
(
dialog
,
NULL
,
imgList
);
imageBoxes
[
2
]
=
new
ImageListBox
_t
<
double
>
(
dialog
,
NULL
,
imgList
);
QLabel
*
label2
=
new
QLabel
(
"Value"
,
dialog
);
layout
->
insertRow
(
2
,
label2
,
imageBoxes
[
2
]);
...
...
@@ -83,10 +82,14 @@ void CombineHSVOp::operator()(const imagein::Image*, const std::map<const imagei
int
height
=
imageBoxes
[
0
]
->
currentImage
()
->
getHeight
();
Image
*
resImg
=
new
Image
(
width
,
height
,
3
);
const
Image_t
<
double
>*
H
=
imageBoxes
[
0
]
->
currentImage
();
const
Image_t
<
double
>*
S
=
imageBoxes
[
1
]
->
currentImage
();
const
Image_t
<
double
>*
V
=
imageBoxes
[
2
]
->
currentImage
();
for
(
int
i
=
0
;
i
<
width
;
i
++
){
for
(
int
j
=
0
;
j
<
height
;
j
++
){
color
.
setHsv
(
imageBoxes
[
0
]
->
currentImage
()
->
getPixel
(
i
,
j
,
0
),
imageBoxes
[
1
]
->
currentImage
()
->
getPixel
(
i
,
j
,
0
)
,
imageBoxes
[
2
]
->
currentImage
()
->
getPixel
(
i
,
j
,
0
)
);
color
.
setHsv
(
H
->
getPixel
(
i
,
j
,
0
),
S
->
getPixel
(
i
,
j
,
0
)
,
V
->
getPixel
(
i
,
j
,
0
)
);
resImg
->
setPixel
(
i
,
j
,
0
,
color
.
red
());
resImg
->
setPixel
(
i
,
j
,
1
,
color
.
green
());
resImg
->
setPixel
(
i
,
j
,
2
,
color
.
blue
());
...
...
@@ -94,25 +97,6 @@ void CombineHSVOp::operator()(const imagein::Image*, const std::map<const imagei
}
}
// GrayscaleImage* channels[3];
// unsigned int maxWidth = numeric_limits<unsigned int>::max();
// unsigned int maxHeight = numeric_limits<unsigned int>::max();
// for(unsigned int c = 0; c < nChannel; ++c) {
// const Image* img = imageBoxes[c]->currentImage();
// if(img == NULL) return;
// channels[c] = Converter<GrayscaleImage>::convert(*img);
// maxWidth = min(maxWidth, channels[c]->getWidth());
// maxHeight = min(maxHeight, channels[c]->getHeight());
// }
// Image* resImg = new Image(512, 512, 3);
// for(unsigned int c = 0; c < nChannel; ++c) {
// for(unsigned int j = 0; j < resImg->getHeight(); ++j) {
// for(unsigned int i = 0; i < resImg->getWidth(); ++i) {
// resImg->setPixel(i, j, c, channels[c]->getPixel(i, j));
// }
// }
// }
this
->
outImage
(
resImg
,
qApp
->
translate
(
"CombineHsvOp"
,
"Reconstructed image"
).
toStdString
());
}
This diff is collapsed.
Click to expand it.
app/Operations/CombineHsvOp.h
+
2
−
2
View file @
3f80baaf
...
...
@@ -22,12 +22,12 @@
#include
"Operation.h"
class
CombineHSVOp
:
public
Operation
class
CombineHSVOp
:
public
Double
Operation
{
public:
CombineHSVOp
();
void
operator
()(
const
imagein
::
Image
*
,
const
std
::
map
<
const
imagein
::
Image
*
,
std
::
string
>&
);
void
operator
()(
const
imagein
::
Image
_t
<
double
>
*
,
const
std
::
map
<
const
imagein
::
Image
_t
<
double
>
*
,
std
::
string
>&
);
bool
needCurrentImg
()
const
;
};
...
...
This diff is collapsed.
Click to expand it.
app/Operations/splithsvop.cpp
+
62
−
0
View file @
3f80baaf
/*
* Copyright 2011-2012 INSA Rennes
*
* This file is part of ImageINSA.
*
* ImageINSA is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ImageINSA is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ImageINSA. If not, see <http://www.gnu.org/licenses/>.
*/
#include
<GrayscaleImage.h>
#include
<QColor>
#include
"SplitHsvOp.h"
#include
"../Tools.h"
using
namespace
std
;
using
namespace
imagein
;
bool
SplitHsvOp
::
needCurrentImg
()
const
{
return
true
;
}
SplitHsvOp
::
SplitHsvOp
()
:
Operation
(
qApp
->
translate
(
"Operations"
,
"Split HSV planes"
).
toStdString
())
{
}
void
SplitHsvOp
::
operator
()(
const
imagein
::
Image
*
image
,
const
std
::
map
<
const
imagein
::
Image
*
,
std
::
string
>&
)
{
int
width
=
image
->
getWidth
();
int
height
=
image
->
getHeight
();
Image_t
<
double
>*
resImgH
=
new
Image_t
<
double
>
(
width
,
height
,
1
);
Image_t
<
double
>*
resImgS
=
new
Image_t
<
double
>
(
width
,
height
,
1
);
Image_t
<
double
>*
resImgV
=
new
Image_t
<
double
>
(
width
,
height
,
1
);
for
(
unsigned
int
i
=
0
;
i
<
width
;
i
++
)
{
for
(
unsigned
int
j
=
0
;
j
<
height
;
j
++
)
{
QColor
color
=
QColor
(
image
->
getPixel
(
i
,
j
,
0
),
image
->
getPixel
(
i
,
j
,
1
),
image
->
getPixel
(
i
,
j
,
2
));
resImgH
->
setPixelAt
(
i
,
j
,
color
.
hue
());
resImgS
->
setPixelAt
(
i
,
j
,
color
.
saturation
());
resImgV
->
setPixelAt
(
i
,
j
,
color
.
value
());
}
}
this
->
outDoubleImage
(
resImgH
,
"Hue"
,
false
,
false
);
this
->
outDoubleImage
(
resImgS
,
"Saturation"
,
false
,
false
);
this
->
outDoubleImage
(
resImgV
,
"Value"
,
false
,
false
);
}
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