title: Edge detection combined with floodfill algorithm image processing
body: <p>Ok, I'm looking to write an area fill tool for image manipulation that I want to combine edge detection and for example a flood fill algorithm.  I have looked at different types of algorithms (canny, laplace sobel etc.) but don't understand how to implement them and adapt them to suit my circumstances.</p>
  
  <p>I have been able to use the html5rocks example from :-</p>
  
  <p><a href="http://www.html5rocks.com/en/tutorials/canvas/imagefilters/" rel="nofollow">http://www.html5rocks.com/en/tutorials/canvas/imagefilters/</a></p>
  
  <p>and can apply it to my image data.  I can also apply a new colour into my selected image but I  am not sure how I can combine the 2 so that I can do the following -</p>
  
  <p>mousclick on area within image and replace old colour with new colour, within area an defined by edges defined by edge detection filter around mouseclick and the original colour (I intend to try using the original colours HSL values within a given tolerance)</p>
  
  <p>So effectively like a intelligent area fill.</p>
  
  <p>It is using the HTML5 canvas and javascript.</p>
  
  <p>Hope this makes sense...</p>