dist/js/cropjs.js
function() {
            if (!this._image instanceof IMSoftcrop.Image || !this._image.ready) {
                return;
            }

            var _this = this,
                imageData = this.getImageData();

            this._waitForWorkers++;

            if (window.Worker) {
                // If workers are available, thread detection of faces
                var detectWorker = new Worker(this._detectWorkerUrl);

                detectWorker.postMessage([
                    'details',
                    imageData,
                    this._image.w,
                    this._image.h,
                    this._detectThreshold
                ]);

                detectWorker.onmessage = function(e) {
                    _this.addDetectedDetails(e.data);
                    _this._waitForWorkers--;
                    _this.autocropImages();
                };
            }
            else {
                // Fallback to non threaded
                var data = tracking.Fast.findCorners(
                    tracking.Image.grayscale(
                        imageData.data,
                        this._image.w,
                        this._image.h
                    ),
                    this._image.w,
                    this._image.h,
                    this._detectThreshold
                );

                this.addDetectedDetails(data);
                this._waitForWorkers--;
                this.autocropImages();
            }
        }
function() {
            if (!this._image instanceof IMSoftcrop.Image || !this._image.ready) {
                return;
            }

            var _this = this,
                imageData = this.getImageData();

            this._waitForWorkers++;

            if (window.Worker) {
                // If workers are available, thread detection of faces
                var detectWorker = new Worker(this._detectWorkerUrl);

                detectWorker.postMessage([
                    'details',
                    imageData,
                    this._image.w,
                    this._image.h,
                    this._detectThreshold
                ]);

                detectWorker.onmessage = function(e) {
                    _this.addDetectedDetails(e.data);
                    _this._waitForWorkers--;
                    _this.autocropImages();
                };
            }
            else {
                // Fallback to non threaded
                var data = tracking.Fast.findCorners(
                    tracking.Image.grayscale(
                        imageData.data,
                        this._image.w,
                        this._image.h
                    ),
                    this._image.w,
                    this._image.h,
                    this._detectThreshold
                );

                this.addDetectedDetails(data);
                this._waitForWorkers--;
                this.autocropImages();
            }
        }
function ( ) { if ( ! this . _image instanceof IMSoftcrop . Image || ! this . _image . ready ) { return ; } var _this = this , imageData = this . getImageData ( ) ; this . _waitForWorkers ++ ; if ( window . Worker ) { // If workers are available, thread detection of faces var detectWorker = new Worker ( this . _detectWorkerUrl ) ; detectWorker . postMessage ( [ 'details' , imageData , this . _image . w , this . _image . h , this . _detectThreshold ] ) ; detectWorker . onmessage = function ( e ) { _this . addDetectedDetails ( e . data ) ; _this . _waitForWorkers -- ; _this . autocropImages ( ) ; } ; } else { // Fallback to non threaded var data = tracking . Fast . findCorners ( tracking . Image . grayscale ( imageData . data , this . _image . w , this . _image . h ) , this . _image . w , this . _image . h , this . _detectThreshold ) ; this . addDetectedDetails ( data ) ; this . _waitForWorkers -- ; this . autocropImages ( ) ; } }
Detect features in image
Detect features in image