Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CAMP
campvis-public
Commits
5a0121cc
Commit
5a0121cc
authored
Jan 16, 2015
by
Christian Schulte zu Berge
Browse files
Extended GlImageResampler to allow for arbitrary target image dimensions.
parent
699e8ff7
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/preprocessing/processors/glimageresampler.cpp
View file @
5a0121cc
...
...
@@ -44,11 +44,13 @@ namespace campvis {
,
p_inputImage
(
"InputImage"
,
"Input Image"
,
""
,
DataNameProperty
::
READ
)
,
p_outputImage
(
"OutputImage"
,
"Output Image"
,
"GlImageResampler.out"
,
DataNameProperty
::
WRITE
)
,
p_resampleScale
(
"ResampleScale"
,
"Resampling Scale"
,
.5
f
,
.01
f
,
10.
f
)
,
p_targetSize
(
"TargetSize"
,
"Size of Resampled Image"
,
cgt
::
ivec3
(
128
),
cgt
::
ivec3
(
1
),
cgt
::
ivec3
(
1024
))
,
_shader
(
0
)
{
addProperty
(
p_inputImage
);
addProperty
(
p_inputImage
,
INVALID_RESULT
|
INVALID_PROPERTIES
);
addProperty
(
p_outputImage
);
addProperty
(
p_resampleScale
);
addProperty
(
p_resampleScale
,
INVALID_RESULT
|
INVALID_PROPERTIES
);
addProperty
(
p_targetSize
);
}
GlImageResampler
::~
GlImageResampler
()
{
...
...
@@ -73,7 +75,8 @@ namespace campvis {
if
(
img
!=
0
)
{
cgt
::
vec3
originalSize
(
img
->
getSize
());
cgt
::
ivec3
resampledSize
(
cgt
::
ceil
(
originalSize
*
p_resampleScale
.
getValue
()));
//cgt::ivec3 resampledSize(cgt::ceil(originalSize * p_resampleScale.getValue()));
const
cgt
::
ivec3
&
resampledSize
=
p_targetSize
.
getValue
();
cgt
::
TextureUnit
inputUnit
;
inputUnit
.
activate
();
...
...
@@ -115,4 +118,14 @@ namespace campvis {
}
}
void
GlImageResampler
::
updateProperties
(
DataContainer
&
dataContainer
)
{
ImageRepresentationGL
::
ScopedRepresentation
img
(
dataContainer
,
p_inputImage
.
getValue
());
if
(
img
!=
0
)
{
p_targetSize
.
setMaxValue
(
cgt
::
ivec3
(
img
->
getSize
())
*
int
(
p_resampleScale
.
getMaxValue
()));
p_targetSize
.
setValue
(
cgt
::
ivec3
(
cgt
::
vec3
(
img
->
getSize
())
*
p_resampleScale
.
getValue
()));
}
}
}
modules/preprocessing/processors/glimageresampler.h
View file @
5a0121cc
...
...
@@ -72,11 +72,13 @@ namespace campvis {
DataNameProperty
p_outputImage
;
///< ID for output gradient volume
FloatProperty
p_resampleScale
;
///< Resampling Scale
IVec3Property
p_targetSize
;
///< Size of resampled image
protected:
/// \see AbstractProcessor::updateResult
virtual
void
updateResult
(
DataContainer
&
dataContainer
);
virtual
void
updateProperties
(
DataContainer
&
dataContainer
);
cgt
::
Shader
*
_shader
;
///< Shader for resampling
static
const
std
::
string
loggerCat_
;
...
...
@@ -85,3 +87,4 @@ namespace campvis {
}
#endif // GLIMAGERESAMPLER_H__
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment