Cirrus Logic CS485 Dokumentacja Strona 165

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 319
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 164
Linear Image Transforms
7-11
7
Example 7-2 Computing the DCT of an Image (continued)
// Create without filling
iplAllocateImage( imga, 0,0 );
if( NULL == imga->imageData ) return 0;
// Fill by sample data
for( i=0; i<width*height; i++)
((char*)imga->imageData)[i] = (char)(i+1);
iplAllocateImage( imgb, 0, 0 );
if( NULL == imgb->imageData ) return 0;
iplDCT2D( imga, imgb, IPL_DCT_Forward );
// Now there are (width+height-1) DCT coefficients
for( y=1; y<height; y++)
for( x=1; x<width; x++)
((short*)imgb->imageData)[y*width+x]= (short)0;
// Restore source image from some DCT coefficients
iplDCT2D( imgb, imga, IPL_DCT_Inverse );
// Check if an error occurred
if( iplGetErrStatus() != IPL_StsOk ) return 0;
}
__finally {
iplDCT2D( NULL, NULL, IPL_DCT_Free );
iplDeallocate(imga,IPL_IMAGE_HEADER|IPL_IMAGE_DATA);
iplDeallocate(imgb,IPL_IMAGE_HEADER|IPL_IMAGE_DATA);
}
return IPL_StsOk == iplGetErrStatus();
}
Przeglądanie stron 164
1 2 ... 160 161 162 163 164 165 166 167 168 169 170 ... 318 319

Komentarze do niniejszej Instrukcji

Brak uwag