Hello,
Okay I'm stumped and can't figure out why this code chunk isn't working properly (works on square matrixs; everything else doesn't work)....
uint8 * imageTranspose( uint8 *im ){
uint8 *im_transpose;
int x, y, org_offset, tran_offset;
int im_size = dims[0] * dims[1];
if ( (im_transpose = malloc(sizeof(uint16) * im_size)) == NULL )
mexErrMsgTxt("trans im malloc failed...n");
//Transpose
for(x=0;x<dims[0]; x++){
for(y=0;y<dims[1]; y++){
org_offset = x+(y*dims[0]); //So X=X & Y=Y
tran_offset= y-(x*dims[1]); //So X=Y & Y=X
*(im_transpose+tran_offset) = *(im+org_offset);
//mexPrintf("%dt%dn",*(im+org_offset),*(im_transpose+tran_offset));
}
}
return im_transpose;
}
At the end of the day I will not be using Matlab and therefore I'm just using it as a prototyping tool. Does anyone have any ideas by chance?
Thanks,
Anthony