Utilisation de la Classe CxImage
Bonjour,
j'aimerai savoir si quelqu'un aurait déjà travaillé avec la classe CxImage. J'ai écrit un petit programme censé mettre les intensités de gris d'une image Bitmap(8 bit grayscale image) dans un tableau.Le problème :( c'est que je ne suis pas sûr que mon programme fait ce qu'il est censé faire malgré le fait que je n'ai aucun message d'erreur et si j'ai utilisé les fonctions appropriées:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| #include "ximage.h"
#include <stdio.h>
#include <windows.h>
#include<iostream>
using namespace std;
int main()
{
CxImage image;
image.Load("cube.bmp",CXIMAGE_FORMAT_BMP);
DWORD width, height,BitPerPixel;
width=image.GetWidth();
height=image.GetHeight();
double *GrayArray=new double [height*width];;
BYTE index,*red=new BYTE[height*width], *green=new BYTE[height*width],*blue=new BYTE[height*width];
int cx,cy;
BitPerPixel=image.GetBpp();
for(cy=0; cy<height; cy++){
for (cx=0; cx < width; cx++) {
index=image.GetPixelIndex(cx,cy);
RGBQUAD Color=image.GetPixelColor(cx,cy, true);
red [index +2] =Color.rgbRed;
green[index + 1] =Color.rgbGreen;
blue [index] =Color.rgbBlue;
GrayArray[index]=0.3*red[index]+ 0.59*green[index] + 0.11*blue[index];
}
}
return 0;
} |
Quelqu'un pourrait-il me donner quelques indications?
Merci