Convert to grayscale before doing edge detection
This commit is contained in:
parent
5f5eae7443
commit
54d82711eb
|
@ -20,11 +20,12 @@ int main(int argc, char** argv ) {
|
|||
cv::createTrackbar(LOWER_THRESHOLD_TRACKBAR_NAME, WINDOW_NAME, &g_Canny_lower_threshold, 1000, NULL);
|
||||
cv::createTrackbar(UPPER_THRESHOLD_TRACKBAR_NAME, WINDOW_NAME, &g_Canny_upper_threshold, 1000, NULL);
|
||||
|
||||
cv::Mat frame, cannyFrame;
|
||||
cv::Mat frame, grayscaleFrame, cannyFrame;
|
||||
while (true) {
|
||||
cap >> frame;
|
||||
|
||||
cv::Canny(frame, cannyFrame, g_Canny_lower_threshold, g_Canny_upper_threshold);
|
||||
cv::cvtColor(frame, grayscaleFrame, cv::COLOR_BGR2GRAY);
|
||||
cv::Canny(grayscaleFrame, cannyFrame, g_Canny_lower_threshold, g_Canny_upper_threshold);
|
||||
|
||||
cv::imshow(WINDOW_NAME, cannyFrame);
|
||||
|
||||
|
|
Loading…
Reference in New Issue