我试图创建一个代码,将像素从一个图像复制到另一个图像并以不同方式排列,但是我收到错误
OpenCV错误:断言失败0&& size.height大于0>在cv :: imshow中,文件C:\ builds \ 2_4_PackSlave-win64-vc12-shared \ opencv \ modules \ highgui \ src \ window.cpp,第261行
这是代码
int main(int argc, char** argv) {
Mat src = imread("srcImg.jpg", 1);
Mat dst = imread("dstImg.jpg", 1);
int srcH = src.rows; int srcW = src.cols;
int dstH = dst.rows; int dstW = src.cols;
double alpha;
int r = 50;
for (int i = 0; i < srcH; i++) {
for (int j = 0; j < srcW; j++) {
alpha = i / r;
dst.at<uchar>(dstW / 2 * cos(alpha),
(dstH / 2 + r) * sin(alpha)) = src.at<uchar>(i, j);
}
}
imshow("Source", src);
imshow("Result", dst);
return 0;
这里有什么问题?