Loading a .raw gray scale image to a 2d array in C++ -


i quite new c++. trying read .raw image in c++ , store in 2d array further modifications. use following code:

int dimx = 192; int dimy = 256; unsigned char bufferimage[256][192]; file * pfile; pfile = fopen("d:\\t1mapanalysis\\heartroi_contour.raw", "r"); fread(&bufferimage[0][0], dimx,dimy , pfile); 

the stored values in bufferimage displayed example bufferimage[114][67]='ÿ'; should correspond 255. when want check following bool values

unsigned char val = bufferimage[114][67]; bool k = (val == 'ÿ') bool k = (val == '255') 

i error of different basic types. don't know how compare bufferimage values different gray scale values (0 255). thanks.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -