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

网站建设公司有多少家/网站备案查询官网

网站建设公司有多少家,网站备案查询官网,市场调研公司,北京比较靠谱的装修公司在网上看到基于opencv3.0之前的API实现不规则ROI的提取,我自己试了一下发现opencv3.0不行,第一想法是我写的有问题,最后发现是API的改版。原理很简单。 目标:提取黑线作为ROI 原理:先滤波-->>灰度化-->>二…

在网上看到基于opencv3.0之前的API实现不规则ROI的提取,我自己试了一下发现opencv3.0不行,第一想法是我写的有问题,最后发现是API的改版。原理很简单。

目标:提取黑线作为ROI

 

原理:先滤波-->>灰度化-->>二值化-->>边缘提取-->>寻找图像轮廓-->>轮廓画在一张空图像-->>水漫填充图像轮廓区域-->>两个图像与操作

 

灰度化:

二值化:

 边缘提取:

空白图像画轮廓:

水漫之后的图像:

与操作之后图像:

 

 为了效果明显,我画边界的时候用的是粗实线,而程序求解的是最大边,所以看起来边缘不是很理想,实际操作可以优化

 

程序:

 

 1 #include<iostream>
 2 #include <opencv2/opencv.hpp>
 3 #include <math.h>
 4 using namespace cv;
 5 using namespace std;
 6 
 7 int Threshold_Value = 50;
 8 const int Threshold_Max_value = 255;
 9 const int Threshold_type_value = 3;
10 double g_Area = 0;
11 
12 RNG rng(12345);
13 
14 Mat input_image, threshold_image, output_image, Middle_image;
15 
16 void Threshold_Image_Bar(int, void *);
17 
18 int main(int argc, char**argv)
19 {
20     input_image = imread("1.jpg");
21     if (input_image.data == NULL) {
22         return -1; cout << "can't open image.../";
23     }
24     imshow("Sourse Image", input_image);
25     blur(input_image, Middle_image, Size(3, 3), Point(-1, -1), 4);
26     imshow("Blur Image", Middle_image);
27     cvtColor(Middle_image, Middle_image, COLOR_RGB2GRAY);
28     imshow("Gray Image", Middle_image);
29     namedWindow("Threshold Image", 1);
30     createTrackbar("阈值调整", "Threshold Image", &Threshold_Value, 255, Threshold_Image_Bar);
31     Threshold_Image_Bar(0, 0);
32     waitKey(0);
33     return 0;
34 }
35 
36 void Threshold_Image_Bar(int, void *)
37 {
38     threshold(Middle_image, threshold_image, 90, 255, 3);
39     Canny(threshold_image, threshold_image, Threshold_Value, Threshold_Value * 3);
40     imshow("Threshold Image", threshold_image);
41 
42     vector<vector<Point>> contours;
43     vector<Vec4i> hireachy;
44     findContours(threshold_image, contours, hireachy, RETR_TREE, CHAIN_APPROX_SIMPLE, Point(-1, -1));
45     char flag_count = 0;
46     Mat Show_threImage = Mat::zeros(threshold_image.size(), CV_8UC3);
47     RotatedRect MinRect;
48     for (size_t i = 0; i < contours.size(); i++)
49     {
50         const Scalar color = Scalar(rng.uniform(0, 255), rng.uniform(0, 255), rng.uniform(0, 255));
51         drawContours(Show_threImage, contours, static_cast<int>(i), color, 2, 8, hireachy, 0, Point());
52         //----利用面积进行判断是否为最大区域------//
53         double area = contourArea(contours[i]);
54         g_Area = g_Area > area ? g_Area : area;
55         flag_count = (area == g_Area) ? static_cast<int>(i) : flag_count;//记录最大边界
56     }
57     imshow("Draw_Image_Contours", Show_threImage);
58 
59     Mat gray, Change_image = Mat::zeros(input_image.size(), input_image.type());
60     gray.create(input_image.size(), input_image.type());
61     drawContours(gray, contours, flag_count, Scalar(255, 255, 255), 2, 8, hireachy, 0, Point());
62     Rect s = boundingRect(contours[flag_count]);//为了找内部的一个种子点,自己随便定义也可以
63     floodFill(gray, Point(s.x + s.width / 2, s.y + s.height / 2), Scalar(255, 255, 255));//黑色区域变成白色,遇到白色区域停止
64     imshow("123", gray);
65     bitwise_and(input_image, gray, gray);
66     imshow("wjy", gray);
67 
68 }

 

转载于:https://www.cnblogs.com/wjy-lulu/p/6759974.html

http://www.lbrq.cn/news/811081.html

相关文章:

  • 一级av做爰片不卡免费网站/有没有免费的写文案的软件
  • 深圳做营销型网站/个人免费开发网站
  • 学网站建设需要什么/免费引流app下载
  • 如何做色情网站/百度搜索指数1000是什么
  • 怎么在百度首页做网站/百度总部地址
  • wordpress查看版本/百度seo优化服务
  • 响应网站和模板网站有哪些/营销的方法手段有哪些
  • 一般使用的分辨率的显示密度是多少dpi )/搜索seo
  • 众包网站开发/解封后中国死了多少人
  • do_action wordpress 模板/处理事件seo软件
  • 报名网站辽宁省建设银行/治疗腰椎间盘突出的特效药
  • 武汉营销网站建设/沈阳今日新闻头条
  • wordpress本地环境搭建实操步骤/北京关键词优化平台
  • 网站建设项目需求/看seo
  • jsp网站开发视频教程/足球比赛统计数据
  • 绵阳阡陌网站建设/好的推广方式
  • 昆明专业做网站多少钱/营销案例100例小故事
  • 电子商务网站建设如何策划与实施/什么是网络推广营销
  • 临沂网站制作加速企业发展/中央突然宣布一个大消息
  • 网站初期吸引用户注册/网络公司品牌推广
  • 新乡做网站哪家好/seo关键词排优化软件
  • 网站推广其他方案内容/seo网站推广多少钱
  • 有什么做h5的网站/中国网新山东
  • 云南网站建设c3sales/买转发链接
  • 繁体网站怎么做/搜狗seo查询
  • wordpress 去掉图片链接/公司官网优化方案
  • 遵义网站建设服务/成人电脑培训班办公软件
  • 机加工如何用网站开发客户/一站式网络推广服务
  • 网站seo外链怎么做/广州网站优化价格
  • 青岛响应式网站开发/百度网盘搜索引擎官方入口
  • rapidocr v3.3.0发布了
  • Leetcode 3629. Minimum Jumps to Reach End via Prime Teleportation
  • 29.【.NET8 实战--孢子记账--从单体到微服务--转向微服务】--单体转微服务--用户配置服务
  • solidity从入门到精通 第六章:安全第一
  • C++算法竞赛篇(六)一维数组题型讲解
  • 【CTF-WEB-反序列化】利用__toString魔术方法读取flag.php