Nén Ảnh part 5
Số trang: 12
Loại file: pdf
Dung lượng: 225.78 KB
Lượt xem: 11
Lượt tải: 0
Xem trước 2 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Tham khảo tài liệu nén ảnh part 5, công nghệ thông tin, đồ họa - thiết kế - flash phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
Nội dung trích xuất từ tài liệu:
Nén Ảnh part 5 Ch¬ng tr×nh 13.6 IFCT2D.C. §¶o ngîc FCT. KÝch thíc khèisö dông trªn ¶nh gèc./*Program 13.6 IFCT2D.C. Inverse FCT. Blocksize used on the original image should be knownto the user.*//* This program is for carrying outthe inverse of the 2-D Fast Cosine Transform. */#define PI 3.14159#include #include #include #include #include #include void IFCT(float *, unsigned int *, float *, int ,int );void bit_reversal(unsigned int *, int , int );void WTSINV(float *,int, int);void main() { int m,N,i,j,k1,k2,NB,NT,NS,k; float *x,*C,**w; unsigned int *L; double nsq; FILE *fptri, *fptro; char file_name[14] ; float *buffi ; unsigned char *buffo; clrscr(); printf ( This program is for the inverse 2-DFCT . ) ; printf ( Enter name of input file --->) ; scanf (%s , file_name) ; fptri=fopen(file_name, rb); if( fptri ==NULL) { printf( No such file exists. ); exit(1); } 357nsq=(double)filelength(fileno(fptri)); /*-------------------- Assume image is square, ----------------------*/N=(int)sqrt(nsq/sizeof(float));m=(int)(log10((double)N)/log10((double)2.0));k=1;for(i=0; im) ;/*------------------------------------ 3582-D inverse FCT using the row-column approach.----------------------------------- */for(i=0;i MASK=1; C=0; for(i=0,j=m-1;i>i; A x[0]*=(float)N/1.414; for(i=1;i=1;k--) for(i=0;i { for(k=0;k 3. HiÓn thÞ IKRAMR.IMG. So s¸nh ¶nh nµy víi ¶nh IKRAM.IMG. TiÕp theo t«i sÏ giíi thiÖu mét ch¬ng tr×nh mµ sÏ hiÓn thÞ c¸c khèi 8 8 cña kÕt qu¶ ®· chuyÓn ®æi trªn mµn h×nh v¨n b¶n. Chó ý r»ng gi¸ trÞ sÏgi¶m xuèng mét c¸ch nhanh chãng kÓ tõ gãc tr¸i cña mµn h×nh, hay lµ®iÓm tÇn sè (0,0). §Ó tho¸t khái ch¬ng tr×nh nµy, bÊm ESC. Ch¬ng tr×nh 13.7 DISPFCT.C. Ch¬ng tr×nh hiÓn thÞ khèi 2-DFCT./*Program 13.7 DISPFCT.C. Program to display 2-D FCT blocks.*//* This program displays the result of the 2-DFCT. */#include #include #include #include #include #include void main( ) { int i,j,k1,k2,N,N1,NB,NS; float *buff,nsq; FILE *fptr; char file_name[14]; int ch; clrscr(); printf(Enter input file name containing 2-DFCT result.-->); scanf(%s,file_name); fptr=fopen(file_name,rb); if(fptr==NULL) { printf( No such file exists. ); exit(1); }nsq=(float)filelength(fileno(fptr)); 363N=sqrt((double)(nsq/sizeof(float)));printf( Enter block size used (8x8, 16x16,etc.)-->);scanf(%dx%d,&NB,&NB);N1=N/NB;NS=NB*N;buff=(float *)malloc(NS*sizeof(float));printf( Press ESC to exit.);clrscr();for(i=0;i13.4.2 Sù phãng to vµ sù thu nhá cña c¸c ¶nh Mét trong c¸c øng dông cña FCT lµ thay ®æi kÝch thíc cña ¶nh, baogåm sù phãng to vµ sù thu nhá ¶nh. Chóng ta sÏ chÊp nhËn r»ng mét ¶nhphãng to dïng FCT th× sÏ kh«ng cã g× kh¸c so víi mét ¶nh phãng to dïngFFT, trong ®ã ta dïng c¸c thuéc tÝnh vèn cã cña FFT cña ¶nh. Toµn bé ýtëng lµ ta sÏ chia tÇn sè lÊy mÉu bªn trong víi 2 vµ nh vËy sÏ t¨ng gÊp®«i kho¶ng c¸ch tÇn sè. Khi FCT cña mét khèi gi¶m rÊt nhanh kÓ tõ ®iÓmtÇn sè (0,0), chóng ta cã thÓ nh©n ®«i kho¶ng c¸ch tÇn sè b»ng c¸ch thªmvµo c¸c ®iÓm 0. §iÒu nµy lµm cho chóng ta gi¶m ®îc mét nöa tÇn sè lÊymÉu bªn trong vµ t¨ng gÊp ®«i kÝch thíc cña ¶nh. V× vËy trong t¬nglai, kü thuËt truyÒn h×nh ph¶i sö dông kü thuËt ¶nh sè, th× tÝnh chÊt nµycã thÓ gióp cho ta t¹o ra ®îc c¸c tivi cã mµn ¶nh réng. Sù thu nhá thùchiÖn b»ng c¸ch bít ®i c¸c gi¸ trÞ cña tÇn sè cao. Ch¬ng tr×nh sau ®©y sÏ phãng to cña mét ¶nh. Ch¬ng tr×nh nµy yªucÇu FCT cña mét ¶nh vµ kÝch thíc cña c¸c khèi trªn ¶nh gèc. KÕt qu¶ch¹y ch¬ng tr×nh nµy lµ mét ¶nh cã kÝch thíc gÊp ®«i. Ch¬ng tr×nh 13.8 IFCT2DX.C. Ch¬ng tr×nh phãng to ¶nhgÊp ®«i dïng 2-D FCT./*Program 13.8 IFCT2DX.C. Program for imagedoubling using the 2-D FCT.The 2-D FCT of the image is the input file.*//* This program is for carrying out the inverseof the 2-D Fast Cosine Transform.It doubles the size of the image at the sametime. */#define PI 3.14159#include #include #include #include #include #include void IFCT(float *, unsigned int *, float *, int ,int );void bit_reversal(unsigned int *, int , int );void WTSINV(float *,int, int); 365void main() { int m,N,i,j,k1,k2,NB,NS,N1,NB1,m1,NT,NT1,k; float *x,*C,**w; unsigned int *L; double nsq; FILE *fptri,*fptro; char file_name[14]; float *buffi; unsigned char *buffo; clrscr(); printf (This program is for the inverse 2-DFCT. ) ; printf(It doubles the size of the image at thesame time.); printf( Enter name of input file --- > ) ; scanf(%s,file ...
Nội dung trích xuất từ tài liệu:
Nén Ảnh part 5 Ch¬ng tr×nh 13.6 IFCT2D.C. §¶o ngîc FCT. KÝch thíc khèisö dông trªn ¶nh gèc./*Program 13.6 IFCT2D.C. Inverse FCT. Blocksize used on the original image should be knownto the user.*//* This program is for carrying outthe inverse of the 2-D Fast Cosine Transform. */#define PI 3.14159#include #include #include #include #include #include void IFCT(float *, unsigned int *, float *, int ,int );void bit_reversal(unsigned int *, int , int );void WTSINV(float *,int, int);void main() { int m,N,i,j,k1,k2,NB,NT,NS,k; float *x,*C,**w; unsigned int *L; double nsq; FILE *fptri, *fptro; char file_name[14] ; float *buffi ; unsigned char *buffo; clrscr(); printf ( This program is for the inverse 2-DFCT . ) ; printf ( Enter name of input file --->) ; scanf (%s , file_name) ; fptri=fopen(file_name, rb); if( fptri ==NULL) { printf( No such file exists. ); exit(1); } 357nsq=(double)filelength(fileno(fptri)); /*-------------------- Assume image is square, ----------------------*/N=(int)sqrt(nsq/sizeof(float));m=(int)(log10((double)N)/log10((double)2.0));k=1;for(i=0; im) ;/*------------------------------------ 3582-D inverse FCT using the row-column approach.----------------------------------- */for(i=0;i MASK=1; C=0; for(i=0,j=m-1;i>i; A x[0]*=(float)N/1.414; for(i=1;i=1;k--) for(i=0;i { for(k=0;k 3. HiÓn thÞ IKRAMR.IMG. So s¸nh ¶nh nµy víi ¶nh IKRAM.IMG. TiÕp theo t«i sÏ giíi thiÖu mét ch¬ng tr×nh mµ sÏ hiÓn thÞ c¸c khèi 8 8 cña kÕt qu¶ ®· chuyÓn ®æi trªn mµn h×nh v¨n b¶n. Chó ý r»ng gi¸ trÞ sÏgi¶m xuèng mét c¸ch nhanh chãng kÓ tõ gãc tr¸i cña mµn h×nh, hay lµ®iÓm tÇn sè (0,0). §Ó tho¸t khái ch¬ng tr×nh nµy, bÊm ESC. Ch¬ng tr×nh 13.7 DISPFCT.C. Ch¬ng tr×nh hiÓn thÞ khèi 2-DFCT./*Program 13.7 DISPFCT.C. Program to display 2-D FCT blocks.*//* This program displays the result of the 2-DFCT. */#include #include #include #include #include #include void main( ) { int i,j,k1,k2,N,N1,NB,NS; float *buff,nsq; FILE *fptr; char file_name[14]; int ch; clrscr(); printf(Enter input file name containing 2-DFCT result.-->); scanf(%s,file_name); fptr=fopen(file_name,rb); if(fptr==NULL) { printf( No such file exists. ); exit(1); }nsq=(float)filelength(fileno(fptr)); 363N=sqrt((double)(nsq/sizeof(float)));printf( Enter block size used (8x8, 16x16,etc.)-->);scanf(%dx%d,&NB,&NB);N1=N/NB;NS=NB*N;buff=(float *)malloc(NS*sizeof(float));printf( Press ESC to exit.);clrscr();for(i=0;i13.4.2 Sù phãng to vµ sù thu nhá cña c¸c ¶nh Mét trong c¸c øng dông cña FCT lµ thay ®æi kÝch thíc cña ¶nh, baogåm sù phãng to vµ sù thu nhá ¶nh. Chóng ta sÏ chÊp nhËn r»ng mét ¶nhphãng to dïng FCT th× sÏ kh«ng cã g× kh¸c so víi mét ¶nh phãng to dïngFFT, trong ®ã ta dïng c¸c thuéc tÝnh vèn cã cña FFT cña ¶nh. Toµn bé ýtëng lµ ta sÏ chia tÇn sè lÊy mÉu bªn trong víi 2 vµ nh vËy sÏ t¨ng gÊp®«i kho¶ng c¸ch tÇn sè. Khi FCT cña mét khèi gi¶m rÊt nhanh kÓ tõ ®iÓmtÇn sè (0,0), chóng ta cã thÓ nh©n ®«i kho¶ng c¸ch tÇn sè b»ng c¸ch thªmvµo c¸c ®iÓm 0. §iÒu nµy lµm cho chóng ta gi¶m ®îc mét nöa tÇn sè lÊymÉu bªn trong vµ t¨ng gÊp ®«i kÝch thíc cña ¶nh. V× vËy trong t¬nglai, kü thuËt truyÒn h×nh ph¶i sö dông kü thuËt ¶nh sè, th× tÝnh chÊt nµycã thÓ gióp cho ta t¹o ra ®îc c¸c tivi cã mµn ¶nh réng. Sù thu nhá thùchiÖn b»ng c¸ch bít ®i c¸c gi¸ trÞ cña tÇn sè cao. Ch¬ng tr×nh sau ®©y sÏ phãng to cña mét ¶nh. Ch¬ng tr×nh nµy yªucÇu FCT cña mét ¶nh vµ kÝch thíc cña c¸c khèi trªn ¶nh gèc. KÕt qu¶ch¹y ch¬ng tr×nh nµy lµ mét ¶nh cã kÝch thíc gÊp ®«i. Ch¬ng tr×nh 13.8 IFCT2DX.C. Ch¬ng tr×nh phãng to ¶nhgÊp ®«i dïng 2-D FCT./*Program 13.8 IFCT2DX.C. Program for imagedoubling using the 2-D FCT.The 2-D FCT of the image is the input file.*//* This program is for carrying out the inverseof the 2-D Fast Cosine Transform.It doubles the size of the image at the sametime. */#define PI 3.14159#include #include #include #include #include #include void IFCT(float *, unsigned int *, float *, int ,int );void bit_reversal(unsigned int *, int , int );void WTSINV(float *,int, int); 365void main() { int m,N,i,j,k1,k2,NB,NS,N1,NB1,m1,NT,NT1,k; float *x,*C,**w; unsigned int *L; double nsq; FILE *fptri,*fptro; char file_name[14]; float *buffi; unsigned char *buffo; clrscr(); printf (This program is for the inverse 2-DFCT. ) ; printf(It doubles the size of the image at thesame time.); printf( Enter name of input file --- > ) ; scanf(%s,file ...
Tìm kiếm theo từ khóa liên quan:
kỹ thuật xử lý ảnh công nghệ xử lý ảnh phương pháp xử lý ảnh hướng dẫn xử lý ảnh kinh nghiệm xử lý ảnhGợi ý tài liệu liên quan:
-
Giáo trình Khai thác phần mềm ứng dụng
247 trang 111 0 0 -
65 trang 87 3 0
-
51 trang 79 0 0
-
21 trang 61 0 0
-
8 trang 48 0 0
-
Ứng dụng phương pháp xử lý ảnh bằng Matlab để phân tích ảnh chuyển động của một vật thể
8 trang 47 0 0 -
393 trang 47 0 0
-
Đồ án tốt nghiệp: Thiết kế, thi công bãi giữ xe ứng dụng công nghệ RFID và xử lý ảnh
85 trang 44 0 0 -
Xây dựng hệ thống nhận dạng lỗi tự động của tấm pin năng lượng mặt trời
3 trang 40 0 0 -
Bài giảng Xử lý ảnh: Chương 6 - Ths. Trần Thúy Hà
38 trang 40 0 0