0
ppmファイルを読み込んで保存しようとしていますが、モジュールの読み込みと保存の正確さを確認しています。しかし、私は貯蓄に関する別の結果を得ることになります。 ピクセル値をMATLABでチェックしたので、ロードモジュールがうまく動作していることを確認しました。 保存モジュールは以下の通りです:PPMファイル、C++で読み書きする
ofstream ofs;
ofs.open("output.ppm", ofstream::out);
ofs<<"P6"<<endl;
ofs<<"# File after convolution"<<endl;
ofs<<img_wd<<" "<<img_ht<<endl; //check if ASCII conversion is needed
ofs<<max_val<<endl;
for(int j=0; j <img_ht;j++)
{
for (int i=0; i<img_wd;i++)
{
ofs<<static_cast<char>(Pixel[j][i].r)<<static_cast<char>(Pixel[j][i].g)<<static_cast<char>(Pixel[j][i].b); //write as ascii
}
ofs<<endl;
}
私はここで、実際のファイル(https://github.com/aditisingh/Image_convolution_2D/blob/master/start_1.ppm)と、保存したファイル(https://github.com/aditisingh/Image_convolution_2D/blob/master/output.ppm)をリンクしています。任意の提案、入力は参考になります。ありがとう!
http://stackoverflow.com/a/39808791/2836621 –