openCV: get lines from canny filter

edited May 2014 in Library Questions

Say I have a set of points (x,y) that describe a figure. Where can I read about how to connect those points in a smooth way?

Consider that there are regions where many points are next to each other.

Really, I'm trying to process webcam images in a way it seems that it's drawing with a pencil.

EDIT: now using openCV


  • edited May 2014

    Thanks, I got lazy and dove into OpenCV's Canny filter which does something similar 8-X

  • edited May 2014

    I've got the result. However I'm scaling it and I was wondering if there was a way to get the lines/edges from the Canny filtered PImage, so that I can draw them at any size without loosing quality.

    This is the resulting image at scale(2)

    image alt text

    After reading the OpenCV for Processing reference, I tried with findContours() to get the ArrayList<Contour>. That's what I would like to get but lines/edges instead of contours. Is it possible?

    import gab.opencv.*;
    Capture video;
    OpenCV opencv;
    ArrayList<Contour> contours;
    void setup() {
      size(640, 480);
      video = new Capture(this, 320, 240);
      opencv = new OpenCV(this, 320, 240);
    void draw() {
      opencv.findCannyEdges(30, 95);
      //scaled output
      //image(opencv.getOutput(), 0, 0 );
      contours = opencv.findContours(); //finding contours to the canny filtered one
      for (Contour contour : contours) {  
        stroke(255, 0, 0);
        for (PVector point : contour.getPoints()) {
          vertex(point.x, point.y);
    void captureEvent(Capture c) {;
  • any guess? 8-X

Sign In or Register to comment.