Giter Club home page Giter Club logo

canny-algorithm-scilab's Introduction

Canny's algorithm: detect edges on a picture

Scilab implementation of the famous Canny's algorithm.

The purpose of this project is to treat a given image to find its edges, and to create a new image to display them.

Steps

  1. Normalize given image: application of a Gaussian filter.
  2. Compute gradient and gradient norm (E_s_,E_o_).
  3. Delete non-maximum values from the image.
  4. Hysteresis thresholding.
  5. Display result (concat given image and result image).

Note that the hysteresis threshold can be changed: for a good value, pick something between 70% and 85%.

Main functions

  1. applyMask(imgMatrix,mask) : apply a given mask to a given image. Mask can look like [1,2,1;2,4,2;1,2,1].
  2. hysteresisThreshold(image,Eo,Es,95); : compute hysteresis threshold for the given image, last parameter is the threshold you want to pick.

Warning

  • Possible issues if you use Scilab x64 (Scilab x32 preferred).
  • Don't forget to increase the stack size! stack size('max');

How to use this code?

  • Clone project.
  • Run script.
    • img = loadImage('./img3.jpg',1); l.372: Choose image to load.
    • mask = [2,4,5,4,2;4,9,12,9,4;5,12,15,12,5;4,9,12,9,4;2,4,5,4,2]; l.375: init your mask.
    • writeImage(uint8(resultImage),'./tests/img3_res_95.jpg'); l.395: write result of execution on disk.
  • Done!
  • Tests & results of previous executions provided in "./tests" folder.

Results & samples

Results of several execution can be found in "./tests" folder.

Result for image1, thresold 86%

canny-algorithm-scilab's People

Contributors

colinleverger avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.