OpenCV 矫揉造作
为什么我不能做这样的事情:
cv::Mat img = imread("path/to/image1");
cv::Mat img2 = imread("path/to/image2");
img.ptr<uchar>(0,0) = img2.ptr<uchar>(0,0);
我从 VS 收到这条消息:表达式必须是可修改的左值
所以我不得不采取这样的事情:
img.ptr<uchar>(0,0)[0] = img2.ptr<uchar>(0,0)[0];
并影响每个通道,它不会打扰我,但我会我想知道为什么我不能做另一件事。
Why can't I do something like this:
cv::Mat img = imread("path/to/image1");
cv::Mat img2 = imread("path/to/image2");
img.ptr<uchar>(0,0) = img2.ptr<uchar>(0,0);
I get this message from VS : expression must be a modifiable lvalue
So instead I had to resort to doing something like this:
img.ptr<uchar>(0,0)[0] = img2.ptr<uchar>(0,0)[0];
And affect each channel, it doesn't bother me but I'd like to know why I can't do the other one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
= 运算符需要知道它是什么类型的图像,并且需要针对平面图像类型的复杂代码。
您可以使用 CV_IMAGE_ELEM 宏
The = operator would need to know what kind of image it was and would need complicated code for planar image types.
You can use the CV_IMAGE_ELEM macro