当前位置: 首页 > wzjs >正文

网站建设全攻略专业网站设计制作改版

网站建设全攻略,专业网站设计制作改版,域名的价格是多少,wordpress 排名计算机视觉之家看到快速圆检测Edge Drawing,其效果比霍夫要好,速度更快(具体效果可以参考视觉之家的文章),上面C代码不全,那么好的检测效果国内资料竟然那么少,后在opencv的开发文档中找到了C代…

计算机视觉之家看到快速圆检测Edge Drawing,其效果比霍夫要好,速度更快(具体效果可以参考视觉之家的文章),上面C++代码不全,那么好的检测效果国内资料竟然那么少,后在opencv的开发文档中找到了C++代码,在此分享学习交流。

实战 | OpenCV中更稳更快的找圆方法--EdgeDrawing使用演示(详细步骤 + 代码)_opencv 找圆_计算机视觉之家的博客-CSDN博客

OpenCV: EdgeDrawing

OpenCV: fld_lines.cpp

#include <iostream>#include "opencv2/imgproc.hpp"
#include "opencv2/ximgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"using namespace std;
using namespace cv;
using namespace cv::ximgproc;int main(int argc, char** argv)
{string in;CommandLineParser parser(argc, argv, "{@input|corridor.jpg|input image}{help h||show help message}");if (parser.has("help")){parser.printMessage();return 0;}in = samples::findFile(parser.get<string>("@input"));Mat image = imread(in, IMREAD_GRAYSCALE);if( image.empty() ){return -1;}// Create FLD detector// Param               Default value   Description// length_threshold    10            - Segments shorter than this will be discarded// distance_threshold  1.41421356    - A point placed from a hypothesis line//                                     segment farther than this will be//                                     regarded as an outlier// canny_th1           50            - First threshold for//                                     hysteresis procedure in Canny()// canny_th2           50            - Second threshold for//                                     hysteresis procedure in Canny()// canny_aperture_size 3            - Aperturesize for the sobel operator in Canny().//                                     If zero, Canny() is not applied and the input//                                     image is taken as an edge image.// do_merge            false         - If true, incremental merging of segments//                                     will be performedint length_threshold = 10;float distance_threshold = 1.41421356f;double canny_th1 = 50.0;double canny_th2 = 50.0;int canny_aperture_size = 3;bool do_merge = false;Ptr<FastLineDetector> fld = createFastLineDetector(length_threshold,distance_threshold, canny_th1, canny_th2, canny_aperture_size,do_merge);vector<Vec4f> lines;// Because of some CPU's power strategy, it seems that the first running of// an algorithm takes much longer. So here we run the algorithm 10 times// to see the algorithm's processing time with sufficiently warmed-up// CPU performance.for (int run_count = 0; run_count < 5; run_count++) {double freq = getTickFrequency();lines.clear();int64 start = getTickCount();// Detect the lines with FLDfld->detect(image, lines);double duration_ms = double(getTickCount() - start) * 1000 / freq;cout << "Elapsed time for FLD " << duration_ms << " ms." << endl;}// Show found lines with FLDMat line_image_fld(image);fld->drawSegments(line_image_fld, lines);imshow("FLD result", line_image_fld);waitKey(1);Ptr<EdgeDrawing> ed = createEdgeDrawing();ed->params.EdgeDetectionOperator = EdgeDrawing::SOBEL;ed->params.GradientThresholdValue = 38;ed->params.AnchorThresholdValue = 8;vector<Vec6d> ellipses;for (int run_count = 0; run_count < 5; run_count++) {double freq = getTickFrequency();lines.clear();int64 start = getTickCount();// Detect edges//you should call this before detectLines() and detectEllipses()ed->detectEdges(image);// Detect linesed->detectLines(lines);double duration_ms = double(getTickCount() - start) * 1000 / freq;cout << "Elapsed time for EdgeDrawing detectLines " << duration_ms << " ms." << endl;start = getTickCount();// Detect circles and ellipsesed->detectEllipses(ellipses);duration_ms = double(getTickCount() - start) * 1000 / freq;cout << "Elapsed time for EdgeDrawing detectEllipses " << duration_ms << " ms." << endl;}Mat edge_image_ed = Mat::zeros(image.size(), CV_8UC3);vector<vector<Point> > segments = ed->getSegments();for (size_t i = 0; i < segments.size(); i++){const Point* pts = &segments[i][0];int n = (int)segments[i].size();polylines(edge_image_ed, &pts, &n, 1, false, Scalar((rand() & 255), (rand() & 255), (rand() & 255)), 1);}imshow("EdgeDrawing detected edges", edge_image_ed);Mat line_image_ed(image);fld->drawSegments(line_image_ed, lines);// Draw circles and ellipsesfor (size_t i = 0; i < ellipses.size(); i++){Point center((int)ellipses[i][0], (int)ellipses[i][1]);Size axes((int)ellipses[i][2] + (int)ellipses[i][3], (int)ellipses[i][2] + (int)ellipses[i][4]);double angle(ellipses[i][5]);Scalar color = ellipses[i][2] == 0 ? Scalar(255, 255, 0) : Scalar(0, 255, 0);ellipse(line_image_ed, center, axes, angle, 0, 360, color, 2, LINE_AA);}imshow("EdgeDrawing result", line_image_ed);waitKey();return 0;
}

http://www.dtcms.com/wzjs/588415.html

相关文章:

  • 网站搭建怎么弄的网站外链查询
  • 宁波网站建设优化找哪家建设悦生活网站
  • 网站广告是文化事业建设费平台网站怎么做的好
  • 济南市历下区建设局官方网站学校网站建设栏目
  • 做一个私人网站需要多少钱wordpress搜索设置
  • 做网站建设分哪些类型帝国cms 做网站地图
  • 福州网站关键词推广竞价培训课程
  • 网站建设源代码上传wordpress 崩溃
  • 用手机可以做网站wordpress继续阅读
  • 渭南企业网站建设贵州中航建设集团网站
  • 网站开发直播常州平台网站建设
  • 山西网站建设推荐咨询wordpress 子主题插件
  • php做网站实例空间备案网站
  • 做企业网站都需要注意哪点高级软件工程师
  • 江西网站建设网络公司网站建设请示怎么写
  • 厦门海沧建设局网站品牌型网站的作用
  • 做网站公司怎么选让别人访问我的网站
  • 域名空间网站建设怎么优化网站加载速度
  • 最好的机票网站建设科技助手
  • 还有用的网站怎么把网站制作成安卓
  • 商城网站设计目标甘肃省级建设主管部门网站
  • 郑州网站推广公司咨询号码之家官网
  • 公司网站怎么规范管理的百度关键词推广帝搜软件
  • 陕西住房和城乡建设厅网站苏州个人网站制作
  • 网站做cdn做网站这么做
  • 漳州市住房与城乡建设部网站百度自媒体平台
  • 做汽车网站潍坊的网站开发公司
  • 网站如何做二级栏目自助建站申请
  • 正规品牌网站设计推荐怎么看网站是dede模板
  • 网站在百度上做推广怎样做详情页模板怎么做