How do I use export and import for legacy javascript?

0 favourites
  • 1 posts
From the Asset Store
Create an awesome world for your RPG top-down game with this Tileset
  • Hi all,

    I'm looking to build an app based on a pure javascript implementation of OpenCV. I am looking to import a legacy javascript file called "cv.js" into main.js.

    What do I need to do in cv.js and what do I need to add in main.js to get this working correctly?

    Thank you for your help!

    Here are the first few lines of the legacy script:

    /* References: - "OpenCV: Open Computer Vision Library" http://sourceforge.net/projects/opencvlibrary/ - "Stack Blur: Fast But Goodlooking" http://incubator.quasimondo.com/processing/fast_blur_deluxe.php */

    var CV = CV || {};

    this.CV = CV;

    CV.Image = function(width, height, data){ this.width = width || 0; this.height = height || 0; this.data = data || []; };

    CV.grayscale = function(imageSrc, imageDst){ var src = imageSrc.data, dst = imageDst.data, len = src.length, i = 0, j = 0;

    for (; i < len; i += 4){ dst[j ++] = (src * 0.299 + src[i + 1] * 0.587 + src[i + 2] * 0.114 + 0.5) & 0xff; }

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)