C++ cv::垫架和SCILAB

C++ cv::垫架和SCILAB,c++,opencv,image-processing,scilab,C++,Opencv,Image Processing,Scilab,我在OpenCV中有一个框架,我不想用imWrimee()保存,我用这个代码来提取每个通道并保存它,并且打开三个文件,并结合一个新的框架,这里首先是C++代码: ......... mean_fb.open("d:\\mean_blue",ios::out); ostream osb(&mean_fb); mean_fg.open("d:\\mean_green",ios::out); ostream osg(&mean_fg); mean_fr.open("d:\\me

我在OpenCV中有一个框架,我不想用imWrimee()保存,我用这个代码来提取每个通道并保存它,并且打开三个文件,并结合一个新的框架,这里首先是C++代码:

  .........
  mean_fb.open("d:\\mean_blue",ios::out);
ostream osb(&mean_fb);
mean_fg.open("d:\\mean_green",ios::out);
ostream osg(&mean_fg);
mean_fr.open("d:\\mean_red",ios::out);
ostream  osr(&mean_fr);
resultframe *= 1.0/255.0; // adjusting the colors of the mean value 
for(int row = 0; row < resultframe.rows; row++) {
    for (int col = 0; col < resultframe.cols; col++) {
    //  std::cout << resultframe.at<cv::Vec3f>(row, col)[1] <<std::endl;
        std::cout << resultframe.at<cv::Vec3f>(row, col)[2] <<std::endl;

        //fwrite(&resultframe.at<cv::Vec3f>(row,col )[0],sizeof(float),1,inpR);
        osr<< resultframe.at<cv::Vec3f>(row, col)[0]<<"\n";
        osg<< resultframe.at<cv::Vec3f>(row, col)[1]<<"\n";
        osb<< resultframe.at<cv::Vec3f>(row, col)[2]<<"\n";
    }
}
 .......
这是我得到的条纹图像的一部分:
感谢您的帮助

看来您的宽度和高度参数颠倒了。图像可能会被转置。

< P>在TED W建议之后,我想也许我必须切换宽度和高度不是在SCILAB,而是在C++中,这样做了,如果需要的话,这里是代码:

mean_fb.open("d:\\mean_blue",ios::out);
ostream osb(&mean_fb);
mean_fg.open("d:\\mean_green",ios::out);
ostream osg(&mean_fg);
mean_fr.open("d:\\mean_red",ios::out);
ostream  osr(&mean_fr);
  adjusting the colors of the mean value 
for (int col = 0; col < resultframe.cols; col++) {
    for(int row = 0; row < resultframe.rows; row++) {
    //  std::cout << resultframe.at<cv::Vec3f>(row, col)[1] <<std::endl;
        std::cout << resultframe.at<cv::Vec3f>(row, col)[2] <<std::endl;

        //fwrite(&resultframe.at<cv::Vec3f>(row,col )[0],sizeof(float),1,inpR);
        osb<< resultframe.at<cv::Vec3f>(row, col)[0]<<"\n";
        osg<< resultframe.at<cv::Vec3f>(row, col)[1]<<"\n";
        osr<< resultframe.at<cv::Vec3f>(row, col)[2]<<"\n";
    }
}
mean_fb.close();
mean_fr.close();
mean_fg.close();


std_fb.open("d:\\std_blue",ios::out);
ostream std_osb(&std_fb);
std_fg.open("d:\\std_green",ios::out);
ostream std_osg(&std_fg);
std_fr.open("d:\\std_red",ios::out);
ostream  std_osr(&std_fr);

for (int col = 0; col < deviationframe.cols; col++)   {
    for(int row = 0; row < deviationframe.rows; row++) {

        std::cout << deviationframe.at<cv::Vec3f>(row, col)[2] <<std::endl;
        std_osb<< deviationframe.at<cv::Vec3f>(row, col)[0]<<"\n";
        std_osg<< deviationframe.at<cv::Vec3f>(row, col)[1]<<"\n";
        std_osr<< deviationframe.at<cv::Vec3f>(row, col)[2]<<"\n";
    }
}
std_fb.close();
std_fr.close();
std_fg.close();
mean\u fb.open(“d:\\mean\u blue”,ios::out);
ostream osb(平均值);
平均打开(“d:\\平均绿色”,ios::out);
ostream osg(平均值);
平均开放时间(“d:\\mean\U red”,ios::out);
ostream osr(平均值);
调整平均值的颜色
for(int col=0;col//你的问题是什么?你已经描述了一个场景,没有问过一个问题。你的问题是什么?你想要什么答案?得到的图像是条纹的,这是我的问题。当切换宽度和高度时,我得到了正确的分辨率,只是图像的一部分?你也计算了3个颜色通道和poss的大小吗阿尔法通道?我没有,我不明白为什么我要通过切换高度和宽度来获得图片部分的正确分辨率
mean_fb.open("d:\\mean_blue",ios::out);
ostream osb(&mean_fb);
mean_fg.open("d:\\mean_green",ios::out);
ostream osg(&mean_fg);
mean_fr.open("d:\\mean_red",ios::out);
ostream  osr(&mean_fr);
  adjusting the colors of the mean value 
for (int col = 0; col < resultframe.cols; col++) {
    for(int row = 0; row < resultframe.rows; row++) {
    //  std::cout << resultframe.at<cv::Vec3f>(row, col)[1] <<std::endl;
        std::cout << resultframe.at<cv::Vec3f>(row, col)[2] <<std::endl;

        //fwrite(&resultframe.at<cv::Vec3f>(row,col )[0],sizeof(float),1,inpR);
        osb<< resultframe.at<cv::Vec3f>(row, col)[0]<<"\n";
        osg<< resultframe.at<cv::Vec3f>(row, col)[1]<<"\n";
        osr<< resultframe.at<cv::Vec3f>(row, col)[2]<<"\n";
    }
}
mean_fb.close();
mean_fr.close();
mean_fg.close();


std_fb.open("d:\\std_blue",ios::out);
ostream std_osb(&std_fb);
std_fg.open("d:\\std_green",ios::out);
ostream std_osg(&std_fg);
std_fr.open("d:\\std_red",ios::out);
ostream  std_osr(&std_fr);

for (int col = 0; col < deviationframe.cols; col++)   {
    for(int row = 0; row < deviationframe.rows; row++) {

        std::cout << deviationframe.at<cv::Vec3f>(row, col)[2] <<std::endl;
        std_osb<< deviationframe.at<cv::Vec3f>(row, col)[0]<<"\n";
        std_osg<< deviationframe.at<cv::Vec3f>(row, col)[1]<<"\n";
        std_osr<< deviationframe.at<cv::Vec3f>(row, col)[2]<<"\n";
    }
}
std_fb.close();
std_fr.close();
std_fg.close();