image processing - Error using IDCT (OpenCV) -
everytime run code program don't respond , msg , don't know problem ? can me ?
my code:
int main(){ mat image,dctimage; image=imread("2.jpg"); cvtcolor(image,image,cv_bgr2gray); image.convertto(image,cv_32fc1); mat freq; dct(image,freq); imwrite("dctimage.jpg",freq); int start;int col=0;int rows=0; stringstream ss; for(start=100;start>0;start=start-1){ for(int x=start;x<freq.rows;x++){ for(int y=start;y<freq.cols;y++){ freq.at<double>(x,y)=0.0; } } mat dst(freq.size(),freq.type()); idct(freq,dst); ss<<start<<".jpg"; cout<<ss.str()<<endl; imwrite(ss.str(),dst); ss.str(""); cout<<ss.str()<<endl; }
try change freq.at<double>(x,y)=0.0;
freq.at<float>(x,y)=0.0;
because feed image.convertto(image,cv_32fc1); , should expect same element type.
Comments
Post a Comment