编译没有问题但是运行错误 求帮助
#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();
}
#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();
}
...全文
相关推荐
宋鑫诚c++项目2作业-----求两数和与差
项目背景介绍在本题目中,“宋鑫诚c++项目2作业-----求两数和与差”主要涉及了C++编程语言的基础应用。通过解决实际问题的方式帮助学生加深对C++的理解和运用能力。
求数字个位置和.rar(vb初学者不妨看看)
**编写和运行程序**:将上述代码编写到VB环境中,然后编译运行。压缩包内的“求数字各位之和.exe”就是编译后的可执行文件,可以直接运行而无需VB开发环境。
idea 右键项目没有run 运行选项
"idea 右键项目没有run 运行选项" Idea 右键项目没有 Run 运行选项是很多开发者经常遇到的问题。在本文中,我们将详细介绍该问题的解决方法,并提供了详细的示例代码和步骤指南。
oracle存储过程编译错误问题
同时,使用Oracle的调试工具,如DBMS_DEBUG_JDWP,可以帮助在运行时分析和调试代码,找出问题的根源。
Dev c++中遇到Id returned 1 exit status编译错误,该怎么办?
**未关闭的.exe窗口**:有时,如果上一次运行的程序窗口没有正确关闭,可能会导致新的编译过程中出现问题。试着关闭所有运行过的程序窗口,然后重新编译。


