|
Trouver une ressource
Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !
Sujet : Comment declarée la matrice matrix[x][y] [ Archives / Maths & Algorithmes ] (pirate75000)
Informations & options pour cette discussion
jeudi 17 juillet 2003 à 22:36:26 |
Comment declarée la matrice matrix[x][y]

pirate75000
|
Comment declarée la matrice matrix[x][y] Le but est de remplir la matirce avec le Tableau Tab puis effectuer une inversion video par matrice puis réécrit le fichier image Je pense qu'il doit avoir plus simple pour une inversion vidéo mais j'aurais bessoin d'autre fonction en matrice, comme cela j'aurais un model je pourrais me débrouiller Merci int CorrigeImg (char* NomIn, char* NomOut) { //Déclaration des variables FILE* pFic; BYTE* Tab = NULL; int width; //la taille d' une ligne en octets int NbPpl,Nbl,width,i,x,y;
BITMAPFILEHEADER* BmpHeadEtal = NULL; BITMAPINFO* BmpInfoEtal = NULL; //Read picture BmpHeadEtal = (BITMAPFILEHEADER*) new BYTE [14]; BmpInfoEtal = (BITMAPINFO*)new BYTE [sizeof(BITMAPINFOHEADER) + 256*sizeof(RGBQUAD)]; if ((pFic = fopen(NomIn,"rb")) == NULL) return ERROR_OPEN; if ((fread (BmpHeadEtal, 1, 14, pFic)) != 14) return ERROR_READ; if ((fread (BmpInfoEtal, 4, 10+256, pFic)) != 266) return ERROR_READ; NbPpl = BmpInfoEtal->bmiHeader.biWidth; Nbl = BmpInfoEtal->bmiHeader.biHeight; width = WIDTHBYTES(NbPpl * 8); // DWORD Align Tab = new BYTE [width*Nbl]; if (fread (Tab, 1, (width*Nbl), pFic) != width*Nbl) return ERROR_READ; if (fclose (pFic)) return ERROR_CLOSE;
//Dib -> Matrice for (int y=0;y<Nbl;y++){ for(int x;x<width;x++){ matrix[x][y]=Tab[x+y*width]; } } //On traite la matrice pour inversion vidéo
//Matrice -> Dib for (int y=0;y<Nbl;y++){ for(int x;x<width;x++){ Tab[x+y*width]=matrix[x][y]; } } //Ecriture de l'image if ((pFic = fopen(NomOut,"wb")) == NULL) return ERROR_OPEN; if ((fwrite (BmpHeadEtal, 1, 14, pFic)) != 14) return ERROR_WRITE; if ((fwrite (BmpInfoEtal, 4, 10+256, pFic)) != 266) return ERROR_WRITE; if (! (fwrite (Tab, 1, (width*Nbl), pFic))) return ERROR_WRITE; if (fclose (pFic)) return ERROR_CLOSE; }
|
|
|
|
jeudi 17 juillet 2003 à 22:54:21 |
Re : Comment declarée la matrice matrix[x][y]

payen
|
si tu veux la declarer en dynamique, tu peux aller voir la premiere fonction de ma source (mon unique !!!) : http://www.cppfrance.com/article.aspx?Val=2094------------------------------- Réponse au message : ------------------------------- > Comment declarée la matrice matrix[x][y] > Le but est de remplir la matirce avec le Tableau Tab > puis effectuer une inversion video par matrice > puis réécrit le fichier image > > Je pense qu'il doit avoir plus simple pour une inversion vidéo > mais j'aurais bessoin d'autre fonction en matrice, > comme cela j'aurais un model je pourrais me débrouiller > Merci > > > int CorrigeImg (char* NomIn, char* NomOut) > { > //Déclaration des variables > FILE* pFic; > BYTE* Tab = NULL; > int width; //la taille d' une ligne en octets > int NbPpl,Nbl,width,i,x,y; > > BITMAPFILEHEADER* BmpHeadEtal = NULL; > BITMAPINFO* BmpInfoEtal = NULL; > //Read picture > BmpHeadEtal = (BITMAPFILEHEADER*) new BYTE [14]; > BmpInfoEtal = (BITMAPINFO*)new BYTE [sizeof(BITMAPINFOHEADER) + 256*sizeof(RGBQUAD)]; > if ((pFic = fopen(NomIn,"rb")) == NULL) > return ERROR_OPEN; > if ((fread (BmpHeadEtal, 1, 14, pFic)) != 14) > return ERROR_READ; > if ((fread (BmpInfoEtal, 4, 10+256, pFic)) != 266) > return ERROR_READ; > NbPpl = BmpInfoEtal->bmiHeader.biWidth; > Nbl = BmpInfoEtal->bmiHeader.biHeight; > width = WIDTHBYTES(NbPpl * 8); // DWORD Align > Tab = new BYTE [width*Nbl]; > if (fread (Tab, 1, (width*Nbl), pFic) != width*Nbl) > return ERROR_READ; > if (fclose (pFic)) > return ERROR_CLOSE; > > //Dib -> Matrice > for (int y=0;y<Nbl;y++){ > for(int x;x<width;x++){ > matrix[x][y]=Tab[x+y*width]; > } > } > //On traite la matrice pour inversion vidéo > > > > //Matrice -> Dib > for (int y=0;y<Nbl;y++){ > for(int x;x<width;x++){ > Tab[x+y*width]=matrix[x][y]; > } > } > //Ecriture de l'image > if ((pFic = fopen(NomOut,"wb")) == NULL) > return ERROR_OPEN; > if ((fwrite (BmpHeadEtal, 1, 14, pFic)) != 14) > return ERROR_WRITE; > if ((fwrite (BmpInfoEtal, 4, 10+256, pFic)) != 266) > return ERROR_WRITE; > if (! (fwrite (Tab, 1, (width*Nbl), pFic))) > return ERROR_WRITE; > if (fclose (pFic)) > return ERROR_CLOSE; > } > |
|
|
|
Cette discussion est classé dans : nbl, error, return, width, pfic
Répondre à ce message
Sujets en rapport avec ce message
Prob WIN32 [ par AngeloVivaldi ]
bonjour, voici un code ke g tapé pour mon apprentissage de la prog Graphique :#include LRESULT CALLBACK WinProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
problème classe winnt.h [ par totoscill ]
Bonjour,J'ai un problème avec la classe winnt.h de windows:J'essais d'ouvrir mon port série avec des fonction qui utilise DWORD.Lorsque je compile:d:\
GTK+/VC++ [ par niwniwa ]
bonjour je veux travailler avec GTK+, et pour commencer j'ai fait un petit programme juste pour faire la lecture d'une image et l'affichage de ses d
Enumération incomplète avec RegEnumKeyEx [ par Taron31 ]
Bonjour, dans un programme je dois énumérer toutes les clefs de HKEY_CURRENT_USER, j'ouvre donc cette clef, je récupère le nombre de subkeys (RegQuery
Hook WH_MOUSE_LL [ par vecchio56 ]
Bonjour,J'utilise un hook bas niveau de type WH_MOUSE_LL, et j'ai un problème lorque je cherche a fermer ma fenêtre principale (la souris se bloque).
error C2143 [ par IH2MCBETA ]
1>c:\users\richard\documents\visual studio 2005\ih2mc\parameters.h(15) : error C2143: erreur de syntaxe : absence de ';' avant '*'1>c:\users\richard\d
comment ajouter un .lib a son projet? [ par LaTatadu91 ]
Bonjour,voila mon probleme, j'utilise actuellement des fonctions d'une librairie pour OPCet mon compilateur (visual studio 2005) me dit :error LNK2019
help au namespace [ par sam_45 ]
Bonjour à tous,Je suis entrains de developper mon premier logiciel en C++.net où suis debutant. J'ai un problème avec le namespace. je n'arrive pas à
créer arbre.. [ par abdelkaderg54 ]
Salut à tous , ben voilà j'été entrain de faire un petit programme en c++ Il s'agit de deffirentes fonctions pour manipuler un arbre binnair de recher
Pb de Syntaxe XML [ par Ticachey ]
Bonjour tout le monde ! Je dois rédiger une structure XML permettant de renvoyer sous ce format les résultats obtenus sous Php de diverses fonctions s
Livres en rapport
|
Téléchargements
Logiciels à télécharger sur le même thème :
Comparez les prix Nouvelle version
|