编译没有问题但是运行错误 求帮助

学C新手上路 学C新手上路 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#include "mydll.h"
#include<stdlib.h>
#include <stdio.h>
#include<math.h>
void main()
{
struct image img1,img2;
FILE *fp1,*fp2;
unsigned char *pdata;unsigned char *pdata1;unsigned char r,b,g;
int i,j,k,sum=0,a[3];

fp1=fopen("G:\\imgest\\Debug\\1.txt","w");
fp2=fopen("G:\\imgest\\Debug\\2.txt","w");
imgfiletomat("G:\\imgest\\Debug\\1.jpg", &img1);
img2.height=img1.height;img2.width=img1.width;img2.numcolors=1;
pdata1=(unsigned char*)malloc(img1.height*img1.width*sizeof(unsigned char));


for(i=0;i<img1.height;i++)
for(j=0;j<img1.width;j++)
for(k=0;k<img2.numcolors;k++){
*pdata1=rand()%255;
pdata1++;
}
img2.ptr=pdata1;

for(i=0;i<img1.height;i++)
{for(j=0;j<img1.width;j++)
for(k=0;k<img2.numcolors;k++)
{
fprintf(fp2,"%5d",*pdata1);
pdata1++;
}
fprintf(fp2,"\n");

}


createwindow("name1");
imgshow("name1",&img2);
wait(0);


mattoimgfile("G:\\imgest\\Debug\\c1.jpg",&img2);

destroywindow("name1");
destroyallwindows();






}
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
学C新手上路
C语言 70,040 成员 243,237 内容