?? 模擬圖像放大源代碼.txt
字號:
模擬圖像放大源代碼[原創]
做簡單模擬,見笑。
/*
to enlarge an image by K times
AUTHOR:BugEyes
http://BugEyes.blog.edu.cn
*/
#define N 4
#define K 3
#define M 100
#i nclude <stdlib.h>
#i nclude <conio.h>
void init(int arr[N][N])
{
int i,j;
for(i=0;i<N;i++)
for(j=0;j<N;j++)
arr[i][j]=random(M);
}
void enlarge(int arr[N][N],int result[K*N][K*N])
{
int i,j,row,col;
for(i=0;i<N;i++)
for(j=0;j<N;j++)
for(row=K*i;row<K*i+K;row++)
for(col=K*j;col<K*j+K;col++)
result[row][col]=arr[i][j];
}
void output(int arr[N][N],int n)
{
int i,j;-3CBR> for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
printf("%5d",arr[i][j]);
printf("\n\n\n");
}
}
void output1(int arr[K*N][K*N],int n)
{
int i,j;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
printf("%5d",arr[i][j]);
printf("\n\n\n");
}
}
main()
{
int array[N][N],result[K*N][K*N];
init(array);
enlarge(array,result);
clrscr();
output(array,N);
printf("\n\n");
output1(result,K*N);
}
BugEyes 發表于 2005-8-13 9:55:00
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -