2

First question here, feel free to edit / close / suggest.

I need to do some simple computations on images in JS. The results are not to be displayed in a browser, so I don't need canvas utilities or any other browser-oriented stuff. I'm just forced to use JS as my processing environment, as I would do with MATLAB for example.

I am going to do pretty simple things, but I have failed to find them all in a library:

  • read png / jpgs from a buffer or from URL in some matrix-like structure;
  • convert from RGB to greyscale (should be easy also with a simple math library);
  • define new binary matrices / images using boolean conditions. E.g., in MATLAB it would be:

    img = imread('filepath.jpg');
    lights = img > 200; // get a new image with 1 and 0
    
  • find indices (or any similar parameter) of some conditions, e.g. in MATLAB find(img > 200), and do some computations with them.

What I have found:

  • jimp: pretty simple, OK for the first two requirements, but I fail to see how to satisfy the others. Seems UI-oriented.
  • jsfeat: you'll agree it's much more than I need, seems to require a long time to make the first steps, and I'm not sure that my simple tasks are still simple (nor even possible) with this library;
  • math.js: in fact I don't need much more than this. I'd still have to find a way to read images and convert them to Matrix, and I don't know if it satisfies the other requirements.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.