This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mat img_hlines = img_crop.clone(); | |
//Standard Hough Line Transform | |
vector<Vec4i> lines; //will hold the results of the detection | |
HoughLinesP(detected_edges, lines, 1, CV_PI / 180, 50, 30, 10); //runs the actual detection | |
//Draw the lines | |
for (size_t i = 0; i < lines.size(); i++){ | |
Vec4i l = lines[i]; | |
line(img_hlines, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(0, 255, 255), 2, CV_AA); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mat detected_edges, img_mask; | |
int const max_lowThreshold = 255; | |
int lowThreshold = 210, ratio = 3, kernel_size = 3; | |
char* window_name = "Edge Map"; | |
//CannyThreshold: Trackbar callback - Canny thresholds input with a ratio 1:3 | |
void CannyThreshold(int, void*){ | |
blur(img_mask, detected_edges, Size(3, 3)); //Reduce noise with a kernel 3x3 | |
Canny(detected_edges, detected_edges, lowThreshold, lowThreshold * ratio, kernel_size); //Canny detector | |
imshow(window_name, detected_edges); //Using Canny's output as a mask, and display our result | |
} |
OlderNewer