ImageTransformsGPU.h File Reference

Contains functions to transform whole images. More...

#include <fstream>
#include <iostream>
#include <iomanip>
#include <hugin_shared.h>
#include <vigra/basicimage.hxx>
#include <vigra_ext/ROIImage.h>
#include <vigra_ext/Interpolators.h>
#include <vigra/accessor.hxx>
#include <vigra/impex.hxx>
#include <vigra_ext/impexalpha.hxx>
#include <vigra_ext/FunctorAccessor.h>
#include <hugin_math/hugin_math.h>
#include <hugin_utils/utils.h>
#include <appbase/ProgressDisplayOld.h>
#include "MultiThreadOperations.h"
#include <boost/thread/thread.hpp>
#include <boost/bind.hpp>

Include dependency graph for ImageTransformsGPU.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Namespaces

namespace  vigra_ext

Classes

struct  vigra_ext::Error_GpuNumericTraits_not_specialized_for_this_case
struct  vigra_ext::GpuNumericTraits< A >

Defines

#define DEFINE_GPUNUMERICTRAITS(IMAGECOMPONENT, GLFORMAT, GLFORMATRGB, GLTRANSFER, GLTRANSFERRGB, GLTYPE)

Enumerations

enum  {
  XGL_BYTE = 0, XGL_UNSIGNED_BYTE, XGL_SHORT, XGL_UNSIGNED_SHORT,
  XGL_INT, XGL_UNSIGNED_INT, XGL_FLOAT, XGL_RGBA8,
  XGL_RGBA16, XGL_RGBA32F, XGL_LUMINANCE8_ALPHA8, XGL_LUMINANCE16_ALPHA16,
  XGL_LUMINANCE_ALPHA32F, XGL_RGB8, XGL_RGB16, XGL_RGB32F,
  XGL_LUMINANCE8, XGL_LUMINANCE16, XGL_LUMINANCE32F, XGL_LUMINANCE,
  XGL_RGB, XGL_LUMINANCE_ALPHA, XGL_RGBA
}

Functions

bool IMPEX transformImageGPUIntern (const std::string &coordXformGLSL, const std::string &interpolatorGLSL, const int interpolatorSize, const std::string &photometricGLSL, const std::vector< double > &invLut, const std::vector< double > &destLut, const vigra::Diff2D srcSize, const void *const srcBuffer, const int srcGLInternalFormat, const int srcGLTransferFormat, const int srcGLFormat, const int srcGLType, const void *const srcAlphaBuffer, const int srcAlphaGLType, const vigra::Diff2D destUL, const vigra::Diff2D destSize, void *const destBuffer, const int destGLInternalFormat, const int destGLTransferFormat, const int destGLFormat, const int destGLType, void *const destAlphaBuffer, const int destAlphaGLType, const bool warparound)
 DEFINE_GPUNUMERICTRAITS (vigra::Int8, XGL_LUMINANCE8_ALPHA8, XGL_RGBA8, XGL_LUMINANCE8, XGL_RGB8, XGL_BYTE)
 DEFINE_GPUNUMERICTRAITS (vigra::UInt8, XGL_LUMINANCE8_ALPHA8, XGL_RGBA8, XGL_LUMINANCE8, XGL_RGB8, XGL_UNSIGNED_BYTE)
 DEFINE_GPUNUMERICTRAITS (vigra::Int16, XGL_LUMINANCE16_ALPHA16, XGL_RGBA16, XGL_LUMINANCE16, XGL_RGB16, XGL_SHORT)
 DEFINE_GPUNUMERICTRAITS (vigra::UInt16, XGL_LUMINANCE16_ALPHA16, XGL_RGBA16, XGL_LUMINANCE16, XGL_RGB16, XGL_UNSIGNED_SHORT)
 DEFINE_GPUNUMERICTRAITS (vigra::Int32, XGL_LUMINANCE_ALPHA32F, XGL_RGBA32F, XGL_LUMINANCE32F, XGL_RGB32F, XGL_INT)
 DEFINE_GPUNUMERICTRAITS (vigra::UInt32, XGL_LUMINANCE_ALPHA32F, XGL_RGBA32F, XGL_LUMINANCE32F, XGL_RGB32F, XGL_UNSIGNED_INT)
 DEFINE_GPUNUMERICTRAITS (float, XGL_LUMINANCE_ALPHA32F, XGL_RGBA32F, XGL_LUMINANCE32F, XGL_RGB32F, XGL_FLOAT)
 DEFINE_GPUNUMERICTRAITS (double, XGL_LUMINANCE_ALPHA32F, XGL_RGBA32F, XGL_LUMINANCE32F, XGL_RGB32F, XGL_FLOAT)
template<class SrcImageIterator, class SrcAccessor, class DestImageIterator, class DestAccessor, class TRANSFORM, class PixelTransform, class AlphaImageIterator, class AlphaAccessor, class Interpolator>
void transformImageGPUIntern (vigra::triple< SrcImageIterator, SrcImageIterator, SrcAccessor > src, vigra::triple< DestImageIterator, DestImageIterator, DestAccessor > dest, std::pair< AlphaImageIterator, AlphaAccessor > alpha, TRANSFORM &transform, PixelTransform &pixelTransform, vigra::Diff2D destUL, Interpolator interp, bool warparound, AppBase::MultiProgressDisplay &prog)
 Transform an image into the panorama.
template<class SrcImageIterator, class SrcAccessor, class SrcAlphaIterator, class SrcAlphaAccessor, class DestImageIterator, class DestAccessor, class TRANSFORM, class PixelTransform, class AlphaImageIterator, class AlphaAccessor, class Interpolator>
void transformImageAlphaGPUIntern (vigra::triple< SrcImageIterator, SrcImageIterator, SrcAccessor > src, std::pair< SrcAlphaIterator, SrcAlphaAccessor > srcAlpha, vigra::triple< DestImageIterator, DestImageIterator, DestAccessor > dest, std::pair< AlphaImageIterator, AlphaAccessor > alpha, TRANSFORM &transform, PixelTransform &pixelTransform, vigra::Diff2D destUL, Interpolator interp, bool warparound, AppBase::MultiProgressDisplay &prog)
 transform input images with alpha channel
template<class SrcImageIterator, class SrcAccessor, class DestImageIterator, class DestAccessor, class AlphaImageIterator, class AlphaAccessor, class TRANSFORM, class PixelTransform>
void transformImageGPU (vigra::triple< SrcImageIterator, SrcImageIterator, SrcAccessor > src, vigra::triple< DestImageIterator, DestImageIterator, DestAccessor > dest, std::pair< AlphaImageIterator, AlphaAccessor > alpha, vigra::Diff2D destUL, TRANSFORM &transform, PixelTransform &pixelTransform, bool warparound, Interpolator interpol, AppBase::MultiProgressDisplay &progress)
 Transform an image into the panorama.
template<class SrcImageIterator, class SrcAccessor, class SrcAlphaIterator, class SrcAlphaAccessor, class DestImageIterator, class DestAccessor, class AlphaImageIterator, class AlphaAccessor, class TRANSFORM, class PixelTransform>
void transformImageAlphaGPU (vigra::triple< SrcImageIterator, SrcImageIterator, SrcAccessor > src, std::pair< SrcAlphaIterator, SrcAlphaAccessor > srcAlpha, vigra::triple< DestImageIterator, DestImageIterator, DestAccessor > dest, std::pair< AlphaImageIterator, AlphaAccessor > alpha, vigra::Diff2D destUL, TRANSFORM &transform, PixelTransform &pixelTransform, bool warparound, Interpolator interpol, AppBase::MultiProgressDisplay &progress)
 Transform image, and respect a possible alpha channel.


Detailed Description

Contains functions to transform whole images.

Uses PTools::Transform for the calculations

Author:
Andrew Mihal
$Id$

This 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 2 of the License, or (at your option) any later version.

This software 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 Lesser General Public License for more details.

You should have received a copy of the GNU General Public License along with this software; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Definition in file ImageTransformsGPU.h.


Define Documentation

#define DEFINE_GPUNUMERICTRAITS IMAGECOMPONENT,
GLFORMAT,
GLFORMATRGB,
GLTRANSFER,
GLTRANSFERRGB,
GLTYPE   ) 
 

Definition at line 100 of file ImageTransformsGPU.h.


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
XGL_BYTE 
XGL_UNSIGNED_BYTE 
XGL_SHORT 
XGL_UNSIGNED_SHORT 
XGL_INT 
XGL_UNSIGNED_INT 
XGL_FLOAT 
XGL_RGBA8 
XGL_RGBA16 
XGL_RGBA32F 
XGL_LUMINANCE8_ALPHA8 
XGL_LUMINANCE16_ALPHA16 
XGL_LUMINANCE_ALPHA32F 
XGL_RGB8 
XGL_RGB16 
XGL_RGB32F 
XGL_LUMINANCE8 
XGL_LUMINANCE16 
XGL_LUMINANCE32F 
XGL_LUMINANCE 
XGL_RGB 
XGL_LUMINANCE_ALPHA 
XGL_RGBA 

Definition at line 78 of file ImageTransformsGPU.h.


Function Documentation

DEFINE_GPUNUMERICTRAITS double  ,
XGL_LUMINANCE_ALPHA32F  ,
XGL_RGBA32F  ,
XGL_LUMINANCE32F  ,
XGL_RGB32F  ,
XGL_FLOAT 
 

DEFINE_GPUNUMERICTRAITS float  ,
XGL_LUMINANCE_ALPHA32F  ,
XGL_RGBA32F  ,
XGL_LUMINANCE32F  ,
XGL_RGB32F  ,
XGL_FLOAT 
 

DEFINE_GPUNUMERICTRAITS vigra::UInt32  ,
XGL_LUMINANCE_ALPHA32F  ,
XGL_RGBA32F  ,
XGL_LUMINANCE32F  ,
XGL_RGB32F  ,
XGL_UNSIGNED_INT 
 

DEFINE_GPUNUMERICTRAITS vigra::Int32  ,
XGL_LUMINANCE_ALPHA32F  ,
XGL_RGBA32F  ,
XGL_LUMINANCE32F  ,
XGL_RGB32F  ,
XGL_INT 
 

DEFINE_GPUNUMERICTRAITS vigra::UInt16  ,
XGL_LUMINANCE16_ALPHA16  ,
XGL_RGBA16  ,
XGL_LUMINANCE16  ,
XGL_RGB16  ,
XGL_UNSIGNED_SHORT 
 

DEFINE_GPUNUMERICTRAITS vigra::Int16  ,
XGL_LUMINANCE16_ALPHA16  ,
XGL_RGBA16  ,
XGL_LUMINANCE16  ,
XGL_RGB16  ,
XGL_SHORT 
 

DEFINE_GPUNUMERICTRAITS vigra::UInt8  ,
XGL_LUMINANCE8_ALPHA8  ,
XGL_RGBA8  ,
XGL_LUMINANCE8  ,
XGL_RGB8  ,
XGL_UNSIGNED_BYTE 
 

DEFINE_GPUNUMERICTRAITS vigra::Int8  ,
XGL_LUMINANCE8_ALPHA8  ,
XGL_RGBA8  ,
XGL_LUMINANCE8  ,
XGL_RGB8  ,
XGL_BYTE 
 

template<class SrcImageIterator, class SrcAccessor, class SrcAlphaIterator, class SrcAlphaAccessor, class DestImageIterator, class DestAccessor, class AlphaImageIterator, class AlphaAccessor, class TRANSFORM, class PixelTransform>
void transformImageAlphaGPU vigra::triple< SrcImageIterator, SrcImageIterator, SrcAccessor >  src,
std::pair< SrcAlphaIterator, SrcAlphaAccessor >  srcAlpha,
vigra::triple< DestImageIterator, DestImageIterator, DestAccessor >  dest,
std::pair< AlphaImageIterator, AlphaAccessor >  alpha,
vigra::Diff2D  destUL,
TRANSFORM &  transform,
PixelTransform &  pixelTransform,
bool  warparound,
Interpolator  interpol,
AppBase::MultiProgressDisplay progress
 

Transform image, and respect a possible alpha channel.

Definition at line 548 of file ImageTransformsGPU.h.

References DEBUG_DEBUG, vigra_ext::INTERP_BILINEAR, vigra_ext::INTERP_CUBIC, vigra_ext::INTERP_NEAREST_NEIGHBOUR, vigra_ext::INTERP_SINC_1024, vigra_ext::INTERP_SINC_256, vigra_ext::INTERP_SPLINE_16, vigra_ext::INTERP_SPLINE_36, vigra_ext::INTERP_SPLINE_64, and vigra_ext::transformImageAlphaGPUIntern().

Referenced by HuginBase::Nona::RemappedPanoImage< RemapImage, AlphaImage >::remapImage().

template<class SrcImageIterator, class SrcAccessor, class SrcAlphaIterator, class SrcAlphaAccessor, class DestImageIterator, class DestAccessor, class TRANSFORM, class PixelTransform, class AlphaImageIterator, class AlphaAccessor, class Interpolator>
void transformImageAlphaGPUIntern vigra::triple< SrcImageIterator, SrcImageIterator, SrcAccessor >  src,
std::pair< SrcAlphaIterator, SrcAlphaAccessor >  srcAlpha,
vigra::triple< DestImageIterator, DestImageIterator, DestAccessor >  dest,
std::pair< AlphaImageIterator, AlphaAccessor >  alpha,
TRANSFORM &  transform,
PixelTransform &  pixelTransform,
vigra::Diff2D  destUL,
Interpolator  interp,
bool  warparound,
AppBase::MultiProgressDisplay prog
 

transform input images with alpha channel

Definition at line 261 of file ImageTransformsGPU.h.

References vigra_ext::ImageInterpolator< SrcImageIterator, SrcAccessor, INTERPOLATOR >::emitGLSL(), AppBase::MultiProgressDisplay::popTask(), AppBase::MultiProgressDisplay::pushTask(), and vigra_ext::transformImageGPUIntern().

Referenced by vigra_ext::transformImageAlphaGPU().

template<class SrcImageIterator, class SrcAccessor, class DestImageIterator, class DestAccessor, class AlphaImageIterator, class AlphaAccessor, class TRANSFORM, class PixelTransform>
void transformImageGPU vigra::triple< SrcImageIterator, SrcImageIterator, SrcAccessor >  src,
vigra::triple< DestImageIterator, DestImageIterator, DestAccessor >  dest,
std::pair< AlphaImageIterator, AlphaAccessor >  alpha,
vigra::Diff2D  destUL,
TRANSFORM &  transform,
PixelTransform &  pixelTransform,
bool  warparound,
Interpolator  interpol,
AppBase::MultiProgressDisplay progress
 

Transform an image into the panorama.

Uses the GPU for processing.

It can be used for partial transformations as well, if the boundig box of a remapped image is known.

Usage: create an output image that should contain the remapped src image. if dest doesn't cover the whole output panorama, use destUL to specify the offset of dest from the output panorama.

Parameters:
src source image
dest (partial) panorama image. the image size needed to hold the complete remapped image can be calculated using calcBorderPoints().
destUL upper left point of dest in final panorama. set to (0,0) if dest has the same size as the complete panorama.
transform function used to remap the picture.
centerDist image, with the same size as dest, that will contain the distance of the corrosponding pixel from the center of src. This is useful to calculate nice seams. Use a null image if this information is not needed.
interpol Interpolation algorithm that should be used.

Definition at line 483 of file ImageTransformsGPU.h.

References DEBUG_DEBUG, vigra_ext::INTERP_BILINEAR, vigra_ext::INTERP_CUBIC, vigra_ext::INTERP_NEAREST_NEIGHBOUR, vigra_ext::INTERP_SINC_1024, vigra_ext::INTERP_SINC_256, vigra_ext::INTERP_SPLINE_16, vigra_ext::INTERP_SPLINE_36, vigra_ext::INTERP_SPLINE_64, and vigra_ext::transformImageGPUIntern().

Referenced by HuginBase::Nona::RemappedPanoImage< RemapImage, AlphaImage >::remapImage().

template<class SrcImageIterator, class SrcAccessor, class DestImageIterator, class DestAccessor, class TRANSFORM, class PixelTransform, class AlphaImageIterator, class AlphaAccessor, class Interpolator>
void transformImageGPUIntern vigra::triple< SrcImageIterator, SrcImageIterator, SrcAccessor >  src,
vigra::triple< DestImageIterator, DestImageIterator, DestAccessor >  dest,
std::pair< AlphaImageIterator, AlphaAccessor >  alpha,
TRANSFORM &  transform,
PixelTransform &  pixelTransform,
vigra::Diff2D  destUL,
Interpolator  interp,
bool  warparound,
AppBase::MultiProgressDisplay prog
 

Transform an image into the panorama.

Uses the GPU for processing.

It can be used for partial transformations as well, if the bounding box of a remapped image is known.

Usage: create an output image that should contain the remapped src image. if dest doesn't cover the whole output panorama, use destUL to specify the offset of dest from the output panorama.

Parameters:
src source image
dest (partial) panorama image. the image size needed to hold the complete remapped image can be calculated using calcBorderPoints().
destUL upper left point of dest in final panorama. set to (0,0) if dest has the same size as the complete panorama.
transform function used to remap the picture.
centerDist image, with the same size as dest, that will contain the distance of the corrosponding pixel from the center of src. This is useful to calculate nice seams. Use a null image if this information is not needed.
interp Interpolator class (calculates weights for interpolation)

Definition at line 182 of file ImageTransformsGPU.h.

References vigra_ext::ImageInterpolator< SrcImageIterator, SrcAccessor, INTERPOLATOR >::emitGLSL(), AppBase::MultiProgressDisplay::popTask(), and AppBase::MultiProgressDisplay::pushTask().

Referenced by vigra_ext::transformImageAlphaGPUIntern(), and vigra_ext::transformImageGPU().

bool IMPEX transformImageGPUIntern const std::string coordXformGLSL,
const std::string interpolatorGLSL,
const int  interpolatorSize,
const std::string photometricGLSL,
const std::vector< double > &  invLut,
const std::vector< double > &  destLut,
const vigra::Diff2D  srcSize,
const void *const   srcBuffer,
const int  srcGLInternalFormat,
const int  srcGLTransferFormat,
const int  srcGLFormat,
const int  srcGLType,
const void *const   srcAlphaBuffer,
const int  srcAlphaGLType,
const vigra::Diff2D  destUL,
const vigra::Diff2D  destSize,
void *const   destBuffer,
const int  destGLInternalFormat,
const int  destGLTransferFormat,
const int  destGLFormat,
const int  destGLType,
void *const   destAlphaBuffer,
const int  destAlphaGLType,
const bool  warparound
 


Generated on Sat Apr 19 01:25:45 2014 for Hugintrunk by  doxygen 1.3.9.1