Change image data to double

$0

Description

#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>

double **im2double(image,numrows,numcolumns)
unsigned char *image;
int numrows,numcolumns;
{
double **orig_im;
int i,row,col;

if ((orig_im=(double **)malloc(numrows*sizeof(double *)))==NULL)
{
printf("Not enough memory.\n");
exit(1);
}

i=0;
for (row=0; row<numrows; row++)
{
if ((orig_im[row]=(double *)malloc(numcolumns*sizeof(double)))==NULL)
{
printf("Not enough memory.\n");
exit(1);
}
for (col=0; col<numcolumns; col++) {
orig_im[row][col]=((double)(image[i++]));
}
}
return(orig_im);
}

Change image data from double to uchar

 

Reviews

There are no reviews yet.

Be the first to review “Change image data to double”
Category: