这个程序为什么会停止工作? 逻辑没问题啊,把那个cout注释取消又不报错了????
#include<iostream>#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <windows.h>
#include<math.h>
#include <stdlib.h>
using namespace std;
using namespace cv;
int main()
{
IplImage* img=cvLoadImage("lena.jpg",1);
int M=img->height;
int N=img->width;
CvScalar* s=new CvScalar[M*N];
cvShowImage("加密前的图片",img);
for (int i = 0; i < img->height; i++)
{
for (int j = 0; j < img->width; j++)
{
s[i*M+j]=cvGet2D(img,i,j);//提取像素点
}
}
int S=1000;
int sum=0;
for(int i=0;i<M*N;i++)
sum+=s[i].val[0];
double supkey=(double(sum%256))/256;
double x1=0.1;
double u=4;
double y11=0.2;
double k=3;
double x=x1*supkey;
double y=y11*supkey;
double* L=(double*)malloc(M*N+S);
double* C=(double*)malloc(M*N+S);
L[0]=x;
C[0]=y;
for(int i=1;i<M*N+S;i++)
{
x=x*u*(1-x);
y=cos(k*acos(y));
L[i]=x;
C[i]=y;
//cout<<C[i]<<endl;
}
waitKey(0);
//cvReleaseImage( &img ); //释放图像
return 0;
}