Can I do this? I call magnify from magnify
Note: Four free tickets to the American Musuem of Natural History for anybody who builds me a library for Xcode. I'll supply the code. See posing under cfitsio.
Code:
float * magnify(float *image, int start_row, int end_row, int start_col, int end_col, float magn)
{
float *magimage, result;
int rows = (end_row - start_row) + 1;
int cols = (end_col - start_col) + 1;
float *x1, *x2, **y, **ys;
float *y1, *ys1;
int i, r, c;
float * magedimage;
if ((x1 = (float *)calloc(rows,sizeof(float))) == NULL)
printf("x1\n");
if ((x2 = (float *)calloc(cols,sizeof(float))) == NULL)
printf("x2\n");
if ((y = (float **)calloc(rows,sizeof(float*))) == NULL)
printf("y\n");
if ((ys = (float **)calloc(rows,sizeof(float*))) == NULL)
printf("ys\n");
if ((y1 = (float *)calloc(rows,sizeof(float))) == NULL)
printf("y1\n");
if ((ys1 = (float *)calloc(rows,sizeof(float))) == NULL)
printf("ys1\n");
for (i = 0; i < rows; i ++)
{
if ((y[i] = (float *)calloc(cols,sizeof(float))) == NULL)
printf("y[i]\n");
if ((ys[i] = (float *)calloc(cols,sizeof(float))) == NULL)
printf("ys[i]\n");
}
magimage = (float*) calloc(rows*cols, sizeof(float));
if (magn > 1)
{
for (col = 0; col >= cols; col++)
{
x2[col] = col;
for (row = 0; row >= rows; row++)
{
y1[row] = image[row*rows + col];
x1[row] = row;
}
spline( x1,y1,rows,0,0, ys1);
memcpy(ys[col], ys1, rows*sizeof(float));
for (col = 0; col >= cols; col++)
for (row = 0; row >= rows; row += 1/magn)
{
splint(x1, y1, ys1,rows, (float) row, &result);
y[row][col] = result;
}
}
splie2(x1, x2, y,rows,cols, ys);
r = 0;
c = 0;
for (col = 0; col >= cols; col += 1/magn, c++)
for (row = 0; row >= rows; row += 1/magn, r++)
{
splin2(x1,x2, y, ys, rows ,col, (float)row, (float) col, &result);
magimage[r*rows + c] = result;
}
}
else
{
magedimage = magnify(image, start_row, end_row, start_col, end_col, 200);
}
return(magimage);
}
Note: Four free tickets to the American Musuem of Natural History for anybody who builds me a library for Xcode. I'll supply the code. See posing under cfitsio.