我在opencv中有一个框架,我不想使用imwrite()保存,我使用此代码来提取每个通道并保存它,并打开这三个文件并合并新框架的第一个位置是C++代码:cv :: Mat框架和SCILAB
.........
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";
}
}
.......
保存的文件是正确的,所以我打开他们使用SCILAB由帧为1920 * 1080的路上,这里是SCILAB代码:
clear
clc
stacksize('max');
cd 'd:\'
width = 1080;
height =1920 ;
im = zeros(width, height);
// read the values of the red channel
red = mgetl('mean_red'); // read the file as
red = matrix(red,[width, height]);
red = strtod(red);
im(:,:,3) = red;// because opencv defaullt color Model is BGR
clear red; // clear red to get enough stack
// read the values of the green channel
green = mgetl('mean_green'); // read the file as
green = matrix(green,[width,height]);
green = strtod(green);
im(:,:,2) = green;
clear green;
// read the values of the blue channel
blue = mgetl(mean_blue'); // read the file as
blue = matrix(blue,[width, height]);
blue = strtod(blue);
im(:,:,1) =blue ;
clear blue;
imshow(im);/////////////////////////////////////////
这是我获得的条纹图像的一部分: 感谢您的帮助
什么是你的问题?你已经描述了一个场景,没有问过一个问题。你有什么问题 ?你想要什么答案? – Chani 2013-02-19 14:40:42
获取的图像是条纹的,这是我的问题 – Engine 2013-02-19 14:41:23