I have e single live webcam camera. I have displayed one color image, black and white image and canny edge image. Do you think I should put a scrollbar for the canny edge detection amount to make it a standard program or current threshold is fine?

import cv2
import cv
import numpy as np
import matplotlib.image as mpimg
from matplotlib import pyplot as plt

cam = cv2.VideoCapture(0)

img_counter = 0

while True:
    ret, color = cam.read()

    edges = cv2.Canny(color, 50,500)
    gray = cv2.cvtColor(color,cv2.COLOR_RGB2GRAY)
    grey_3_channel = cv2.cvtColor(gray, cv2.COLOR_GRAY2BGR)
    edges_3_channel = cv2.cvtColor(edges, cv2.COLOR_GRAY2BGR)
    #blank_image = np.zeros((color.height*3,color.width*3,3), np.uint8)

    horiz = np.hstack((color, grey_3_channel,edges_3_channel))

    cv2.imshow('HORIZONTAL', horiz)

    if not ret:
    k = cv2.waitKey(1)

    if k%256 == 27:
        # ESC pressed
        print("Escape hit, closing...")



enter image description here

  • 4
    \$\begingroup\$ I see you've posted three questions in under three hours. While it's not really a problem, don't you think it would be better if you waited to have answers for a question in order not to redo the same mistakes in every questions? :) \$\endgroup\$
    – IEatBagels
    Dec 3, 2019 at 16:56
  • 1
    \$\begingroup\$ @IEatBagels: While the first question seems independent enough (it is about the underlying C++ code that performs the edge detection used here), the second question is certainly similar enough to this one that getting (more) feedback on that one first might make sense. \$\endgroup\$
    – Graipher
    Dec 3, 2019 at 17:28


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.