unwrap: implemented wrap_around arguments

This commit is contained in:
Gregor Thalhammer
2013-11-22 10:42:27 +01:00
committed by Jostein Bø Fløystad
parent 6f40c95c08
commit c6c2d78b3b
2 changed files with 13 additions and 10 deletions
@@ -141,8 +141,8 @@ void quicker_sort(EDGE *left, EDGE *right)
//--------------end quicker_sort algorithm -----------------------------------
//--------------------start initialse pixels ----------------------------------
//initialse pixels. See the explination of the pixel class above.
//--------------------start initialize pixels ----------------------------------
//initialize pixels. See the explination of the pixel class above.
//initially every pixel is assumed to belong to a group consisting of only itself
void initialisePIXELs(float *WrappedImage, unsigned char *input_mask, unsigned char *extended_mask, PIXELM *pixel, int image_width, int image_height)
{
@@ -156,8 +156,6 @@ void initialisePIXELs(float *WrappedImage, unsigned char *input_mask, unsigned
{
for (j=0; j < image_width; j++)
{
//pixel_pointer->x = j;
//pixel_pointer->y = i;
pixel_pointer->increment = 0;
pixel_pointer->number_of_pixels_in_group = 1;
pixel_pointer->value = *wrapped_image_pointer;
@@ -176,7 +174,7 @@ void initialisePIXELs(float *WrappedImage, unsigned char *input_mask, unsigned
}
}
}
//-------------------end initialise pixels -----------
//-------------------end initialize pixels -----------
//gamma function in the paper
float wrap(float pixel_value)
@@ -681,7 +679,8 @@ void returnImage(PIXELM *pixel, float *unwrappedImage, int image_width, int ima
//the main function of the unwrapper
int unwrap(float* WrappedImage, float* UnwrappedImage, unsigned char* input_mask,
int image_width, int image_height)
int image_width, int image_height,
int wrap_around_x, int wrap_around_y)
{
unsigned char *extended_mask;
int image_size = image_height * image_width;
+8 -4
View File
@@ -2,16 +2,20 @@ import numpy as np
cimport numpy as np
cdef extern int unwrap(float* WrappedImage, float* UnwrappedImage, unsigned char* input_mask,
int image_width, int image_height)
int image_width, int image_height,
int wrap_around_x, int wrap_around_y)
def unwrap2D(float[:,::1] array, unsigned char[:,::1] mask):
def unwrap2D(float[:,::1] array, unsigned char[:,::1] mask,
wrap_around_x = False, wrap_around_y = False):
cdef float[:,::1] unwrapped_array = np.empty_like(array)
cdef int h = array.shape[0]
cdef int w = array.shape[1]
unwrap(&array[0,0],
&unwrapped_array[0,0],
&mask[0,0],
array.shape[0], array.shape[1])
return unwrapped_array
array.shape[0], array.shape[1],
wrap_around_x, wrap_around_y,
)
return np.asarray(unwrapped_array)