Red de conocimiento informático - Material del sitio web - ¿Cómo utilizar matlab o lenguaje C para eliminar el rojo, el azul o el verde de las fotos?

¿Cómo utilizar matlab o lenguaje C para eliminar el rojo, el azul o el verde de las fotos?

¿Eliminar significa blanquear?

void deleteColor(char *mBuffer,DWORD imgwidth,DWORD imgheight)

{

unsigned long i,j;

unsigned char a[4];

carácter sin firmar b;

línea larga sin signobytes=widthbytes(24*imgwidth);

for(i=0;i

{

for(j=0;j<.imgwidth;j++)

{

a[1]= mBuffer[i*linebytes + j*3];

a[2]=mBuffer[i*linebytes + j*3+1];

a[3]=mBuffer[ i*linebytes + j *3+2];

if((a[1]==0xff && a[2]==0 &&a[3]==0) ||

(a[3]==0xff && a[2]==0 && a[1]==0) ||

(a[2 ]==0xff && a[ 3]==0 && a[1]==0)

)

{

mBuffer[i*linebytes + j*3] = 0xff;

mBuffer[i*linebytes + j*3+1] = 0xff;

mBuffer[i*linebytes + j*3+2] = 0xff;

}

}

}

}

"C" externa

{

__declspec(dllexport)

char * WINAPI icePub_getBufferFromImg2(char *strImgFilename,int *width,int *height,int huiGrade);

__declspec(dllexport)

int WINAPI icePub_makeBmpFile(char *strBmpFilename,char *bmpBuffer,int altura,int ancho);

}

#pragma comentario(lib, "icePubDll.lib")

char *bmpBuffer=NULL;

int imgWidth, imgHeight;

bmpBuffer = icePub_getBufferFromImg2 ("e:\\a.jpg",&imgWidth,&imgHeight, int amp;imgHeight,0);

/ Eliminar rojo, azul, verde

deleteColor(bmpBuffer,imgWidth,imgHeight);

icePub_makeBmpFile("e : \\a.bmp",bmpBuffer,imgWidth,imgHeight);

if(bmpBuffer ! = NULL)

p>

libre(bmpBuffer);