Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
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
Sébastien Peillet
otb
Commits
7172eebf
Commit
7172eebf
authored
9 years ago
by
Guillaume Pasero
Browse files
Options
Downloads
Patches
Plain Diff
Backed out changeset 9c6dd90073ba
parent
923c00ae
No related branches found
No related tags found
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Modules/Core/ImageBase/include/otbConvertPixelBuffer.h
+93
-8
93 additions, 8 deletions
Modules/Core/ImageBase/include/otbConvertPixelBuffer.h
Modules/Core/ImageBase/include/otbConvertPixelBuffer.txx
+673
-0
673 additions, 0 deletions
Modules/Core/ImageBase/include/otbConvertPixelBuffer.txx
with
766 additions
and
8 deletions
Modules/Core/ImageBase/include/otbConvertPixelBuffer.h
+
93
−
8
View file @
7172eebf
...
...
@@ -17,8 +17,8 @@
#ifndef __otbConvertPixelBuffer_h
#define __otbConvertPixelBuffer_h
#include
"itkConvertPixelBuffer.h"
#include
<complex>
#include
"itkObject.h"
namespace
otb
{
...
...
@@ -26,11 +26,13 @@ namespace otb
* \class ConvertPixelBuffer
* \brief Class to convert blocks of data from one type to another.
*
* ConvertPixelBuffer extends the static methods in itk::ConvertPixelBuffer.
* It adds several methods for complex pixels conversions :
* ConvertComplexVectorImageToVectorImage
* ConvertComplexVectorImageToVectorImageComplex
* ConvertComplexToGray
* ConvertPixelBuffer has a static method Convert(). It is used by
* itkImageFileReader to convert from an unknown type at run-time to the
* compile-time template pixel type in itkImageFileReader. To work with
* complex pixel types like RGB and RGBA a traits class is used.
* OutputConvertTraits() is the traits class. The default one used is
* DefaultConvertPixelTraits.
*
*
* \ingroup OTBImageBase
*/
...
...
@@ -39,9 +41,19 @@ template <
typename
OutputPixelType
,
class
OutputConvertTraits
>
class
ConvertPixelBuffer
:
public
itk
::
ConvertPixelBuffer
<
InputPixelType
,
OutputPixelType
,
OutputConvertTraits
>
class
ConvertPixelBuffer
{
public:
/** Determine the output data type. */
typedef
typename
OutputConvertTraits
::
ComponentType
OutputComponentType
;
/** General method converts from one type to another. */
static
void
Convert
(
InputPixelType
*
inputData
,
int
inputNumberOfComponents
,
OutputPixelType
*
outputData
,
size_t
size
);
static
void
ConvertVectorImage
(
InputPixelType
*
inputData
,
int
inputNumberOfComponents
,
OutputPixelType
*
outputData
,
size_t
size
);
static
void
ConvertComplexVectorImageToVectorImage
(
std
::
complex
<
InputPixelType
>*
inputData
,
int
inputNumberOfComponents
,
OutputPixelType
*
outputData
,
size_t
size
);
...
...
@@ -54,6 +66,79 @@ public:
OutputPixelType
*
outputData
,
size_t
size
);
protected:
/** Convert to Gray output. */
/** Input values are cast to output values. */
static
void
ConvertGrayToGray
(
InputPixelType
*
inputData
,
OutputPixelType
*
outputData
,
size_t
size
);
/** Weights convert from linear RGB to CIE luminance assuming a
* modern monitor. See Charles Poynton's Colour FAQ
*
* http://www.inforamp.net/~poynton/notes/colour_and_gamma/ColorFAQ.html */
static
void
ConvertRGBToGray
(
InputPixelType
*
inputData
,
OutputPixelType
*
outputData
,
size_t
size
);
/** Weights convert from linear RGB to CIE luminance assuming a
* modern monitor. Values are attentuated by the Alpha channel. See
* Charles Poynton's Colour FAQ
* http://www.inforamp.net/~poynton/notes/colour_and_gamma/ColorFAQ.html */
static
void
ConvertRGBAToGray
(
InputPixelType
*
inputData
,
OutputPixelType
*
outputData
,
size_t
size
);
static
void
ConvertMultiComponentToGray
(
InputPixelType
*
inputData
,
int
inputNumberOfComponents
,
OutputPixelType
*
outputData
,
size_t
size
);
/** Convert to RGB output. */
/** Each RGB output component is set the the
* input Gray value. */
static
void
ConvertGrayToRGB
(
InputPixelType
*
inputData
,
OutputPixelType
*
outputData
,
size_t
size
);
/** Input values are cast component by component to output values. */
static
void
ConvertRGBToRGB
(
InputPixelType
*
inputData
,
OutputPixelType
*
outputData
,
size_t
size
);
/** Input values are attenuated by the Alpha channel. */
static
void
ConvertRGBAToRGB
(
InputPixelType
*
inputData
,
OutputPixelType
*
outputData
,
size_t
size
);
/** Conversion depends upon the number of components in the
* input. If the number of input components is 2, the output
* components are each set to the first input component attenuated
* by the second input component. This assumes that a two input
* pixel represents intensity and alpha. If the number of input
* components is not 2, the first three output components a are set
* to the first three input components. The remaining input
* components are ignored. */
static
void
ConvertMultiComponentToRGB
(
InputPixelType
*
inputData
,
int
inputNumberOfComponents
,
OutputPixelType
*
outputData
,
size_t
size
);
/** Convert to RGBA output. */
static
void
ConvertGrayToRGBA
(
InputPixelType
*
inputData
,
OutputPixelType
*
outputData
,
size_t
size
);
static
void
ConvertRGBToRGBA
(
InputPixelType
*
inputData
,
OutputPixelType
*
outputData
,
size_t
size
);
static
void
ConvertRGBAToRGBA
(
InputPixelType
*
inputData
,
OutputPixelType
*
outputData
,
size_t
size
);
static
void
ConvertMultiComponentToRGBA
(
InputPixelType
*
inputData
,
int
inputNumberOfComponents
,
OutputPixelType
*
outputData
,
size_t
size
);
/** Convert tensor output. */
/** Each input is made into a 6 component symmetric pixel */
static
void
ConvertTensor6ToTensor6
(
InputPixelType
*
inputData
,
OutputPixelType
*
outputData
,
size_t
size
);
static
void
ConvertTensor9ToTensor6
(
InputPixelType
*
inputData
,
OutputPixelType
*
outputData
,
size_t
size
);
/** Convertions related to complex */
static
void
ConvertGrayToComplex
(
InputPixelType
*
inputData
,
OutputPixelType
*
OutputData
,
size_t
size
);
static
void
ConvertComplexToComplex
(
InputPixelType
*
inputData
,
OutputPixelType
*
outputData
,
size_t
size
);
static
void
ConvertMultiComponentToComplex
(
InputPixelType
*
inputData
,
int
inputNumberOfComponents
,
OutputPixelType
*
outputData
,
size_t
size
);
private:
ConvertPixelBuffer
();
...
...
@@ -62,7 +147,7 @@ private:
}
// end namespace otb
#ifndef
OTB
_MANUAL_INSTANTIATION
#ifndef
ITK
_MANUAL_INSTANTIATION
#include
"otbConvertPixelBuffer.txx"
#endif
...
...
This diff is collapsed.
Click to expand it.
Modules/Core/ImageBase/include/otbConvertPixelBuffer.txx
+
673
−
0
View file @
7172eebf
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