当前位置:网站首页>Opencv learning log 24 -- Hough transform 2 (maximum interval and minimum length can be limited)
Opencv learning log 24 -- Hough transform 2 (maximum interval and minimum length can be limited)
2022-07-06 16:07:00 【@Spring sauce】
Preface
This article focuses on opencv Use of Hough transform in .
One 、 Hough transform 2
// Third question Hough dash ( Maximum interval can be limited , The shortest length )
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
cv::Mat dst;
cv::Mat src = imread("C://Users//john//Desktop//1.jpg", 0);
std::vector<cv::Vec4i>lines;
Canny(src, dst, 75, 80, 3, false);
//cv::imshow("src", src);
//cv::imshow("dstMat", dst);
cv::HoughLinesP(dst, lines, 5, CV_PI / 180, 90, 20, 35);
std::vector<cv::Vec4i>::iterator it = lines.begin();
for (int i = 0; it != lines.end(); it++, i++)
{
//float rho = (*it)[0], theta = (*it)[1];
//cv::Point pt1, pt2;
//double a = cos(theta);
//double b = sin(theta);
//double x0 = a*rho;
//double y0 = b*rho;
//pt1.x = cv::saturate_cast<int>(x0 + 1000 * (-b));
//pt1.y = cv::saturate_cast<int>(y0 + 1000 * (a));
//pt2.x = cv::saturate_cast<int>(x0 - 1000 * (-b));
//pt2.y = cv::saturate_cast<int>(y0 - 1000 * (a));
cv::Point pt1, pt2;
pt1.x = lines[i][0];
pt1.y = lines[i][1];
pt2.x = lines[i][2];
pt2.y = lines[i][3];
//float k = (pt2.y - pt1.y) / (pt2.x - pt1.x);
//float b = pt1.y - pt1.x*k;
//pt1.x = 1000;
//pt1.y = k*pt1.x + b;
cv::line(src, pt1, pt2, cv::Scalar(255, 255, 255), 1, CV_AA);
}
cv::imshow("src", src);
waitKey(0);
}
summary
1. The code can run directly , If you don't understand, please leave a message .
边栏推荐
- 【练习-4】(Uva 11988)Broken Keyboard(破损的键盘) ==(链表)
- Opencv learning log 16 paperclip count
- China's earthwork equipment market trend report, technical dynamic innovation and market forecast
- F - Birthday Cake(山东省赛)
- Nodejs+vue online fresh flower shop sales information system express+mysql
- Record of brushing questions with force deduction -- complete knapsack problem (I)
- 快速转 TypeScript 指南
- Perform general operations on iptables
- 渗透测试 ( 4 ) --- Meterpreter 命令详解
- Determine the Photo Position
猜你喜欢

PySide6 信号、槽

Analysis of protobuf format of real-time barrage and historical barrage at station B

Ball Dropping

Penetration test (4) -- detailed explanation of meterpreter command

STM32 how to use stlink download program: light LED running light (Library version)
![MySQL import database error [err] 1273 - unknown collation: 'utf8mb4_ 0900_ ai_ ci’](/img/e6/f4a696179282fe1f4193410c5a493a.png)
MySQL import database error [err] 1273 - unknown collation: 'utf8mb4_ 0900_ ai_ ci’
Frida hook so layer, protobuf data analysis
![[teacher Gao UML software modeling foundation] collection of exercises and answers for level 20 cloud class](/img/57/bc6eda91f7263acda38b9ee8732318.png)
[teacher Gao UML software modeling foundation] collection of exercises and answers for level 20 cloud class

Borg maze (bfs+ minimum spanning tree) (problem solving report)

Data storage in memory & loading into memory to make the program run
随机推荐
【练习-10】 Unread Messages(未读消息)
Flink 使用之 CEP
STM32 learning record: LED light flashes (register version)
Programmers, what are your skills in code writing?
Research Report on surgical fluid treatment industry - market status analysis and development prospect prediction
JS call camera
MySQL授予用户指定内容的操作权限
[exercise-6] (PTA) divide and conquer
Penetration test 2 --- XSS, CSRF, file upload, file inclusion, deserialization vulnerability
China's earthwork tire market trend report, technical dynamic innovation and market forecast
CS zero foundation introductory learning record
Research Report on market supply and demand and strategy of China's earth drilling industry
E. Breaking the Wall
对iptables进行常规操作
【练习-3】(Uva 442)Matrix Chain Multiplication(矩阵链乘)
Perform general operations on iptables
HDU-6025-Coprime Sequence(女生赛)
渗透测试 ( 4 ) --- Meterpreter 命令详解
信息安全-威胁检测-NAT日志接入威胁检测平台详细设计
China exterior wall cladding (EWC) market trend report, technical dynamic innovation and market forecast