📄 模拟图像放大源代码.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 + -