有谁知道Opencv是否提供了一个函数来检查cv :: Point是否在cv :: Mat中?
基本上我在做:
int x = (current.x - offset);
int y = current.y;
if (x >= 0 && y >= 0 && x < mat.cols && y < mat.rows) && ((int)mat.at<uchar>(y, x) == 0)){
return cv::Point(x, y);
}
}
Run Code Online (Sandbox Code Playgroud)
我想知道是否有更快的东西?或者如果这样做不好?
为了清理我们的代码,我们想使用 astyle。问题是我们希望有人来完成这项工作,但责怪以前的提交者(代码的真正作者,而不是清理的人)。
有没有办法在 git 中安全地做到这一点?
我想知道如何修改gpu::GpuMat.事实上,我想知道是否有可能使用gpu::GpuMat像cv::Mat.
我想做那样的事情:
cv::namedWindow("Result");
cv::Mat src_host = cv::imread("lena.jpg", CV_LOAD_IMAGE_GRAYSCALE);
cv::gpu::GpuMat dst, src;
src.upload(src_host);
for (unsigned int y = 0; y < src.rows; y++){
for (unsigned int x = 0; x < src.cols; x++){
src.at<uchar>(y,x) = 0;
}
}
cv::Mat result_host;
dst.download(result_host);
cv::imshow("Result", result_host);
cv::waitKey();
}
catch(const cv::Exception& ex)
{
std::cout << "Error: " << ex.what() << std::endl;
}
return 0;
Run Code Online (Sandbox Code Playgroud)
这似乎是不可能的.有人知道另一种选择吗?难道我有我下载gpu::GpuMat到cv::Mat我想做出点每一次?提前致谢
编辑:我可能会使用gpu::PtrStepSz(必须测试...)