随笔分类 - OpenCV代码片段
摘要:截取任意四边形区域的图像。 mask就是结果。 需要定义四边形区域,分别是 tl, tr, bl, br
阅读全文
摘要:Transform得到的是重MatFrom到MatTo的变换矩阵。inlier给一个空矩阵就可以。 MatFrom和MatTo都是点的矩阵,每一行就是一个点。 这个函数使用的是点对来估计变换矩阵。是三维的,所以需要XYZ坐标。优化方法是RANSAC。
阅读全文
摘要:代码 注意 xml中保存的节点超过4个就会打开失败,opencv的问题。
阅读全文
摘要:今天测试发现一个问题,cv::FileStorage读取中,xml文件的第一层节点不能超过4个。 在加一个test4的话,就会在 中挂掉。
阅读全文
摘要:一种推荐的做法是,使用opencv自己的时间函数作为随机数的种子。
阅读全文
摘要:#include /* @param o The customer origin @param x The customer x @Note The return matrix include translation */ cv::Mat ZRotationMatrix(const cv::Point2d o, const cv::Point2d x) { cv::Mat Rz = ...
阅读全文
摘要:std::vector> fillContour(const std::vector> & _contours) { // sort as x descent y descent. std::vector> contours(_contours); for(size_t i = 0; i sub(contours[i]); std::sort(sub.begin(), sub.end(...
阅读全文
摘要:cv::Mat left_image; right_image.push_back(cv::Mat((cv::Mat_(1, 3) << ori.x, ori.y, ori.z)));
阅读全文
摘要:cv::normalize(src, dst, 0.0, 255.0, cv::NORM_MINMAX);
阅读全文
摘要:#include using namespace cv; struct mouse_para { cv::Mat org; cv::Mat img; std::string winName = ""; // todo: you can add your own members here. }; void on_mouse(int event, int x, int y, i...
阅读全文