cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Load Module and Use Functions

NA_nur
11-Garnet

Load Module and Use Functions

Hi,

 

I would like to use this data matrix decoder library  to get data matrix value from image. Since HoloLens has no support for data matrix scanning, I'm using camera to captured data matrix image and have the library to decode it, then return the data matrix value. Somehow I manage to make it work in Vuforia Studio preview, however, it's not work when tested with HoloLens.

 

My goal is to get the data matrix value.

 

Below is my code:

 

I refer here to load module:

 

// Load Script
$scope.asyncLoadScript = function (fname) {
  return new Promise((resolve, reject) => {
    if(fname) {
      var head = document.head || document.getElementsByTagName('head')[0],
          script = document.createElement('script');
      script.async = true;
      script.onload = resolve;
      script.onerror = reject;
      script.type = 'text/javascript';
      script.src=fname;
      head.appendChild(script);
    }
  }
                    );
}

// Decode data matrix 
$scope.loadScript = function() {
  $scope.asyncLoadScript('https://unpkg.com/@zxing/library@0.18.5/umd/index.js')
  .then(function () {
    const imgsrc='app/resources/Uploaded/sg1.jpg'
    const codeReader = new ZXing.BrowserDatamatrixCodeReader()
    codeReader
      .decodeFromImage(undefined, imgSrc)
      .then(result => console.log(result.text))
      .catch(err => console.error(err))} 
)}

 

 

Could it be compatibility support issues? Link here contain the module usage with JS type in various browser platform.

 

Thanks.

0 REPLIES 0
Announcements
Topics available:
AR/VR for Data Optimization AR/VR for Security and Control AR/VR for Inspection