ddt 1.1.0
Loading...
Searching...
No Matches
imageHelpers.hpp File Reference

Helper function declaration. This file is part of the DDT Image Handling Library and provides helper functions for handling of CPL images. More...

#include <tuple>
#include <vector>
#include <string>
#include <cpl.h>

Go to the source code of this file.

Functions

std::vector< int > SubarrayLineInt (cpl_image *image, std::tuple< int, int > start, std::tuple< int, int > end)
 
std::vector< int > SubarrayLineInt (cpl_image *image, int x0, int y0, int x1, int y1)
 
std::vector< double > SubarrayLineDouble (cpl_image *image, int x0, int y0, const int x1, const int y1)
 
std::vector< std::vector< int > > SubarrayRectInt (cpl_image *image, std::tuple< int, int > start, std::tuple< int, int > end)
 
std::vector< std::vector< int > > SubarrayRectInt (cpl_image *image, int llx, int lly, int urx, int ury)
 
cpl_image * SubImageRect (cpl_image *image, std::tuple< int, int > start, std::tuple< int, int > end)
 
cpl_image * SubImageRect (cpl_image *image, int llx, int lly, int urx, int ury)
 
cpl_image * SubImageRectOutside (const cpl_image *const image, const int llx, const int lly, const int urx, const int ury)
 
cpl_image * SubImageCircular (const cpl_image *const image, const int xcenter, const int ycenter, const int radius)
 
cpl_image * SubImageCircularOutside (const cpl_image *const image, const int xcenter, const int ycenter, const int radius)
 
double PixelDistance (const double startx, const double starty, const double endx, const double endy, double *const xoffset=nullptr, double *const yoffset=nullptr)
 
double PixelDistanceDegrees (const cpl_propertylist *const property_list, const double startx, const double starty, const double endx, const double endy, double *const xoffsetdeg, double *const yoffsetdeg)
 
double PixelToDegreesScalingFactor (const cpl_propertylist *const property_list)
 
std::string ConvertDegreesToString (double deg)
 

Detailed Description

Helper function declaration. This file is part of the DDT Image Handling Library and provides helper functions for handling of CPL images.

Author
Christoph Bortlisz, CGI
Since
2020/07/29

Function Documentation

◆ ConvertDegreesToString()

std::string ConvertDegreesToString ( double  deg)

Convert a degree value into a string representation of the form [dd:]hh:mm:ss. The degrees part dd is prepended only if it is != 0.

Parameters
degthe degrees value to be converted
Returns
string representation of the degrees value

◆ PixelDistance()

double PixelDistance ( const double  startx,
const double  starty,
const double  endx,
const double  endy,
double *const  xoffset,
double *const  yoffset 
)

Returns the pixel distance between two pixels, provided with their x and y coordinates. In addition, the x- and y-offset is returned.

Parameters
startxx coordinate of the first pixel
startyy coordinate of the first pixel
endxx coordinate of the second pixel
endyy coordinate of the second pixel
xoffsetif provided and no nullptr, will contain the offset in x direction
yoffsetif provided and no nullptr, will contain the offset in y direction
Returns
the pixel distance

Returns the pixel distance between two pixels, provided with their x and y coordinates. In addition, the x- and y-offset is returned.

Parameters
startxx coordinate of the first pixel
startyy coordinate of the first pixel
endxx coordinate of the second pixel
endyy coordinate of the second pixel
xoffsetif provided and no nullptr, will contain the offset in x direction
yoffsetif provided and no nullptr, will contain the offset in y direction

◆ PixelDistanceDegrees()

double PixelDistanceDegrees ( const cpl_propertylist *const  property_list,
const double  startx,
const double  starty,
const double  endx,
const double  endy,
double *const  xoffsetdeg,
double *const  yoffsetdeg 
)

Returns the distance in degrees between two pixels, provided with their x and y coordinates. In addition, the x- and y-offset in degrees is returned.

Parameters
property_listthe cpl_propertylist object retrieved from a CPL image
startxx coordinate of the first pixel
startyy coordinate of the first pixel
endxx coordinate of the second pixel
endyy coordinate of the second pixel
xoffsetdegif provided and no nullptr, will contain the offset in x direction
yoffsetdegif provided and no nullptr, will contain the offset in y direction
Returns
the pixel distance in degrees, or 0.0 if the scaling factor could not be determined

◆ PixelToDegreesScalingFactor()

double PixelToDegreesScalingFactor ( const cpl_propertylist *const  property_list)

Returns the scaling factor to convert pixel distances to degrees.

Parameters
property_listthe cpl_propertylist object retrieved from a CPL image
Returns
the pixel to degrees scaling factor, or 0.0 if not available

◆ SubarrayLineDouble()

std::vector< double > SubarrayLineDouble ( cpl_image *  image,
int  x0,
int  y0,
const int  x1,
const int  y1 
)

Returns a double subarray of pixel values from a cpl_image along a line defined by start and end point (x and y image coordinates)

◆ SubarrayLineInt() [1/2]

std::vector< int > SubarrayLineInt ( cpl_image *  image,
int  x0,
int  y0,
int  x1,
int  y1 
)

Returns an integer subarray of pixel values from a cpl_image along a line defined by start and end point (x and y image coordinates)

◆ SubarrayLineInt() [2/2]

std::vector< int > SubarrayLineInt ( cpl_image *  image,
std::tuple< int, int >  start,
std::tuple< int, int >  end 
)

This file is part of the DDT Image Handling Library and provides helper functions for the processing of CPL images. Returns an integer subarray of pixel values from a cpl_image along a line defined by start and end point (tuples of image coordinates)

This file is part of the DDT Image Handling Library and provides functions to process CPL images. Returns an integer subarray of pixel values from a cpl_image along a line defined by start and end point (tuples of image coordinates)

◆ SubarrayRectInt() [1/2]

std::vector< std::vector< int > > SubarrayRectInt ( cpl_image *  image,
int  llx,
int  lly,
int  urx,
int  ury 
)

Returns an integer subarray of pixel values from a cpl_image within a rectangle defined by two corners (coordinates of lower left and upper right corners)

◆ SubarrayRectInt() [2/2]

std::vector< std::vector< int > > SubarrayRectInt ( cpl_image *  image,
std::tuple< int, int >  start,
std::tuple< int, int >  end 
)

Returns an integer subarray of pixel values from a cpl_image within a rectangle defined by two corners (tuples of image coordinates)

◆ SubImageCircular()

cpl_image * SubImageCircular ( const cpl_image *const  image,
const int  xcenter,
const int  ycenter,
const int  radius 
)

Returns a circular CPL subimage from a cpl_image. The circular area is defined by the center coordinates and the radius. The returned image has all pixels lying outside the circular area added to the bad pixel map.

Note that the returned image has a odd number of pixels in each dimension. This is to have the center coordinate really in the center of the circle. So e.g. a radius of 25 will result in an image with 49 x 49 pixels. The resulting diameter of the circle will be: radius * 2 - 1

The image has to be deleted using cpl_image_delete().

◆ SubImageCircularOutside()

cpl_image * SubImageCircularOutside ( const cpl_image *const  image,
const int  xcenter,
const int  ycenter,
const int  radius 
)

Returns a copy of a cpl_image with all pixels within a circle defined by the center coordinates and the radius are rejected (added to the bad pixel map), so that these pixels are not considered in further image processing steps

In order to have the center coordinate really in the center of the circle, the resulting diameter of the circle will be: radius * 2 - 1. So e.g. a radius of 25 will result in a circle diameter of 49.

The image has to be deleted using cpl_image_delete().

◆ SubImageRect() [1/2]

cpl_image * SubImageRect ( cpl_image *  image,
int  llx,
int  lly,
int  urx,
int  ury 
)

Returns a CPL subimage from a cpl_image within a rectangle defined by two corners (coordinates of lower left and upper right corners)

Returns a CPL subimage from a cpl_image within a rectangle defined by two corners (coordinates of lower left and upper right corners)

The image has to be deleted using cpl_image_delete().

◆ SubImageRect() [2/2]

cpl_image * SubImageRect ( cpl_image *  image,
std::tuple< int, int >  start,
std::tuple< int, int >  end 
)

Returns a CPL subimage from a cpl_image within a rectangle defined by two corners (tuples of image coordinates)

Returns a CPL subimage from a cpl_image within a rectangle defined by two corners (tuples of image coordinates)

The image has to be deleted using cpl_image_delete().

◆ SubImageRectOutside()

cpl_image * SubImageRectOutside ( const cpl_image *const  image,
const int  llx,
const int  lly,
const int  urx,
const int  ury 
)

Returns a copy of a cpl_image with all pixels within a rectangle defined by two corners (coordinates of lower left and upper right corners) are rejected (added to the bad pixel map), so that these pixels are not considered in further image processing steps

The image has to be deleted using cpl_image_delete().