|
cpl_image * | clipm_image_display_insert_gaps (const cpl_image *input, cpl_size x_input_position, cpl_size y_input_position, cpl_size x_segmentsize, cpl_size y_segmentsize, cpl_size x_gapwidth, cpl_size y_gapwidth, int flag_gaps_bad, clipm_fill_mode fill_pattern, double fill_brightness) |
| Insert horizontal and vertical gaps into an image. More...
|
|
This module provides tool functions for the display of images.
- Synopsis:
-
cpl_image* clipm_image_display_insert_gaps |
( |
const cpl_image * |
input, |
|
|
cpl_size |
x_input_position, |
|
|
cpl_size |
y_input_position, |
|
|
cpl_size |
x_segmentsize, |
|
|
cpl_size |
y_segmentsize, |
|
|
cpl_size |
x_gapwidth, |
|
|
cpl_size |
y_gapwidth, |
|
|
int |
flag_gaps_bad, |
|
|
clipm_fill_mode |
fill_pattern, |
|
|
double |
fill_brightness |
|
) |
| |
Insert horizontal and vertical gaps into an image.
- Parameters
-
input | Input image (FITS convention) |
x_input_position | Horizontal start position of the input image in a bigger mosaic (see below) (FITS), default is 1 |
y_input_position | Vertical start position of the input image in a bigger mosaic (see below) (FITS), default is 1 |
x_segmentsize | Image segment width (0 <= x_segmentsize <= xsize) |
y_segmentsize | Image segment height (0 <= y_segmentsize <= ysize) |
x_gapwidth | Gap width ( >= 0) |
y_gapwidth | Gap height ( >= 0) |
flag_gaps_bad | Mark the gaps as bad pixels if != 0, default should be 1 |
fill_pattern | Fill pattern mode |
fill_brightness | Fill pattern brightness |
- Returns
- New expanded image with filled gaps, NULL on error
- Principle:
- The input image is expanded by splitting it into segments and inserting horizontal and vertical gaps inbetween. The purpose is for example to show the gaps in images coming from sensor arrays (mosaics).
- If the input image represents only a fraction (window) of a bigger mosaic, then input_position can be used to specify its lower left position. This actually just shifts the gap pattern in the output to the left/bottom. Or in other words, the gap pattern is shifted by an offset off_gap which is: off_gap = - input_position + 1.
- If the image size is not a natural multiple of the segment size, then the gaps are inserted in segment intervals anyway.
- If in horizontal or vertical direction one of the segment size or the gap width is zero, then no gaps are inserted in this direction.
- Gap Fill Pattern:
- The gaps are filled with a pattern fill_pattern, which must be one of the modes in Fill Pattern Modes. The following filling methods are applied:
- fill_pattern == CLIPM_FILL_VALUE: the gaps are filled exactly with the value fill_brightness.
- Any other mode: a fill pattern is applied with the background being the minimum value of the image, and:
- The pattern foreground is scaled by abs(fill_brightness) to the range between minimum and maximum (i.e. fill_brightness = 1.0 is default, smaller values are dimming, greater values are enhancing).
- If fill_brightness < 0, then the pattern is inverted.
- Bad Pixel Handling:
- Existing bad pixel flags are copied to the new locations in the returned image.
- The pixel values from the input image buffer are copied to the new locations also for bad pixels.
- The inserted gaps are marked as bad if flag_gaps_bad is != 0. The default should be 1, since it is important to exclude them from computations.
- Error Handling:
- The following error codes can be set by this function:
- CPL_ERROR_NULL_INPUT: input is NULL
- CPL_ERROR_ILLEGAL_INPUT: segmentsize or gapwidth is < 0
- CPL_ERROR_UNSUPPORTED_MODE: fill_pattern is none of Fill Pattern Modes
- Example:
- The following image simulates a crop of a mosaic from a detector array, with 150x150 pixel detectors, cropped to the region [66...300, 81...257]. The gaps' width corresponds to 15 pixels.
Calling:
input,
66, 81,
150, 150,
15, 15,
0,
0.3);
*
results: