I would like to achieve this kind of image processing effect in Canvas :
WebGL image processing
What i need is an edge detection algorithm or explanation to draw only black pixels or border element ( such as a face for example ) of the image that an user can submit.
cheers
Following your idea, the first step is the Edge detection. The example below shows hot to detect edges using MarvinJ. Having the edges, you might get the object contour.
Input Image:
Edge Detection:
var canvas = document.getElementById("canvas");
image = new MarvinImage();
image.load("https://i.imgur.com/ZHgkM9w.jpg", imageLoaded);
function imageLoaded(){
var imageOut = new MarvinImage(image.getWidth(), image.getHeight());
// Edge Detection (Prewitt approach)
Marvin.prewitt(image, imageOut);
// Invert color
Marvin.invertColors(imageOut, imageOut);
// Threshold
Marvin.thresholding(imageOut, imageOut, 220);
imageOut.draw(canvas);
}
<script src="https://www.marvinj.org/releases/marvinj-0.7.js"></script>
<canvas id="canvas" width="500" height="344"></canvas>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With