我想将矩阵转换为图像,因为它在标题中称矩阵称为B,所以我可以在for循环中对它进行一些修改 这是我的代码:
Mat image1 = imread("C://images//IntImage300915163313.bmp");
//allocate new image
int dim1[3] = {1000,1000,3};
Mat B(3,dim1, CV_64F, Scalar::all(-1));
for (int j1 = 0; j1 < 800; j1++)
{
for (int j2 = 0; j2 < 600; j2++)
{
// compute indeces for corresponding pixels
jj1 = round( ((double)phi/stepphi)+700.0);
jj2 = round( ((double)theta/steptetha)+500.0);
B.at<double>(1200-jj1,jj2,0) = image1.at<double>(j1,j2);
B.at<double>(1200-jj1,jj2,1) = image1.at<double>(j1,j2);
B.at<double>(1200-jj1,jj2,2) = image1.at<double>(j1,j2);
}
}
目前循环停在j1 = 799且j2 = 443因此我认为存在问题导致我影响图像类型为矩阵类型