# Revision history [back]

### How to find the x,y coordinates, and center of a line using hough line transform using a live video feed

Hello, anyone got any ideas or tips on how to find the detected hough line transform coordinates and center if possible. I am at a lost here, is only moments/finding contours are the only solution or I don't understand much since I'm only following tutorials, stackoverflow, and other references.

here is sample my code

include "opencv2\highgui\highgui.hpp"

include "opencv2\imgproc\imgproc.hpp"

include <iostream>

include <stdio.h>

using namespace cv;

using namespace std;

Mat frame, frame_gray, edges, Dedges;

int main()
{
VideoCapture stream(0);

if(!stream.isOpened())
{
cout<<"ERROR: cannot open camera";
return -1;
}

while(true)
{
stream >> frame;
cvtColor(frame, frame_gray, CV_RGB2GRAY);
Canny(frame_gray, edges, 50, 200, 3);

vector<Vec4i> hline;
HoughLinesP(edges, hline, 1, CV_PI/180, 150, 50, 10);
cvtColor(edges, Dedges, CV_GRAY2RGB);

for(size_t i = 0; i < hline.size(); i++)
{
Vec4i D = hline[i];
line(Dedges, Point(D[0],D[1]), Point(D[2],D[3]), Scalar(0,0,255), 3, CV_AA);
cout<<"object detected"<<endl;
}

imshow("Camera View", Dedges);
if(waitKey(30) >= 0)
{
break;
}

}

return 0;
}


http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/hough_lines/hough_lines.html#hough-lines

### How to find the x,y coordinates, and center of a line using hough line transform using a live video feed

Hello, anyone got any ideas or tips on how to find the detected hough line transform coordinates and center if possible. I am at a lost here, is only moments/finding contours are the only solution or I don't understand much since I'm only following tutorials, stackoverflow, and other references.

here is my sample my code

include "opencv2\highgui\highgui.hpp"

include "opencv2\imgproc\imgproc.hpp"

include <iostream>

include <stdio.h>

using namespace cv;

using namespace std;

Mat frame, frame_gray, edges, Dedges;

int main()
{
VideoCapture stream(0);

if(!stream.isOpened())
{
cout<<"ERROR: cannot open camera";
return -1;
}

while(true)
{
stream >> frame;
cvtColor(frame, frame_gray, CV_RGB2GRAY);
Canny(frame_gray, edges, 50, 200, 3);

vector<Vec4i> hline;
HoughLinesP(edges, hline, 1, CV_PI/180, 150, 50, 10);
cvtColor(edges, Dedges, CV_GRAY2RGB);

for(size_t i = 0; i < hline.size(); i++)
{
Vec4i D = hline[i];
line(Dedges, Point(D[0],D[1]), Point(D[2],D[3]), Scalar(0,0,255), 3, CV_AA);
cout<<"object detected"<<endl;
}

imshow("Camera View", Dedges);
if(waitKey(30) >= 0)
{
break;
}

}

return 0;
}
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.2810826301574707, "perplexity": 17908.21193947539}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-31/segments/1627046154053.17/warc/CC-MAIN-20210731043043-20210731073043-00291.warc.gz"}