What's the best edge detection for solid color difference?

asked 2020-05-24 12:16:22 -0500

newBIE gravatar image

updated 2020-05-24 20:57:43 -0500

supra56 gravatar image

I am looking for ways to capture a marker-drawn empty shape on my camera. It is something like drawing a rectangle ( 2/3 the size of the card) on a blank postcard, with a marker of any color. I want to use openCV to "trace over" the exact lines when I switch on my camera. i.e. video capture.

What I have now is

  1. cvtColor to gray
  2. bilateral filter(5, 100, 100)
  3. Canny (lower: 50, max 255)
  4. findContours
  5. drawContours, onto my frame.

While this is working for now, I am guessing there might be a better way since what I'm detecting is quite clear. A solid color against a white background. Is there a better way to detect and trace over my lines? P.S. The above fails when my marker is thinner. I hope it works with pencils

edit retag flag offensive close merge delete

Comments

it would be helpful, to see an image or 2 ...

also, if it is about color, you could try to use inRange() to isolate it instead of cvtColor() / Canny()

berak gravatar imageberak ( 2020-05-25 01:42:13 -0500 )edit
newBIE gravatar imagenewBIE ( 2020-05-25 05:29:18 -0500 )edit