Automation Techs For Productivity And Fun

How To Convert Photo Images To Fantastic Line-Drawings With Node.js


Last day I wrote an article about converting images to line-drawings using Python and OpenCV.

https://blog.pyrospect.com/2019/01/how-to-convert-photo-images-to.html

I like Python as a programming language and I believe OpenCV matches best with Python, though the main language for my personal projects is Javascript, I was looking for a way to do the same thing using Javascript and Node.js.

First I've tried OpenCV.js, the officially supported Javascript bindings for OpenCV,
but somehow it didn't work on my machine.

https://docs.opencv.org/3.4.5/d5/d10/tutorial_js_root.html

I found other image processing libraries not using OpenCV, and they looked useful for other purposes, but for the purpose this time, it seemed using OpenCV is the best.

https://github.com/oliver-moran/jimp

https://github.com/lovell/sharp

http://aheckmann.github.io/gm/

I finally chose "opencv4nodejs", a Node.js module that works as Javascript binding for OpenCV alternative. And this worked perfectly well.

https://www.npmjs.com/package/opencv4nodejs

This library provides OpenCV functions as Javascript functions with more Object Oriented style to make it easy to use in Javascript programs.

Here is the source code for Node.js, which I rewrote from my Python program in the article above:

The "opencv4nodejs" module downloads OpenCV when installing from NPM, so you don't have to install Python and OpenCV.

npm install --save opencv4nodejs

Share:

Search This Blog

Labels

Generate Data For Testing With PostgreSQL

When developing a software using PostgreSQL database as storage, the function "generated_series" is very useful to create data ...

Powered by Blogger.

Labels

Recent Posts