GPU Acceleration achieved! (#1038)

* add gpu.js 2.0.0-rc.7

* add gpuUtils

* add gpuUtil convolve

* add convolution to edgeDetect

* bench it

* bench change

* newline

* pipeline

* revert edge-detect

* gpu accelerate gaussian blur

* edgeDetect use blur

* tweak values

* remove ndarray-gaussian-filter

* audit

* turn on previews

* remove oldPix

* fix travis

* Travis fix

* Try fixing travis

* Fix

* Retry

* tweaks

* convolution module on GPU

* use babelify

* trial

* remove logs

* Update .travis.yml

* Update .travis.yml

* bump version

* bump to rc.9

* rc.10

* rc.11

* Update package.json

* convolution fix

* unit test gpuUtils

* tests changed, fixed

* new fix

* more obvious parseFloat

* remove old commented code
This commit is contained in:
Harsh Khandeparkar
2019-05-02 22:23:58 +05:30
committed by Jeffrey Warren
parent 43a8d0f2c1
commit b0096a13f4
14 changed files with 1258 additions and 997 deletions

View File

@@ -12,8 +12,9 @@ kernely = [
let pixelsToBeSupressed = [];
module.exports = function(pixels, highThresholdRatio, lowThresholdRatio, hysteresis) {
module.exports = function(pixels, highThresholdRatio, lowThresholdRatio, useHysteresis) {
let angles = [], grads = [], strongEdgePixels = [], weakEdgePixels = [];
for (var x = 0; x < pixels.shape[0]; x++) {
grads.push([]);
angles.push([]);
@@ -31,7 +32,7 @@ module.exports = function(pixels, highThresholdRatio, lowThresholdRatio, hystere
}
nonMaxSupress(pixels, grads, angles);
doubleThreshold(pixels, highThresholdRatio, lowThresholdRatio, grads, strongEdgePixels, weakEdgePixels);
if(hysteresis.toLowerCase() == 'true') hysteresis(strongEdgePixels, weakEdgePixels);
if(useHysteresis.toLowerCase() == 'true') hysteresis(strongEdgePixels, weakEdgePixels);
strongEdgePixels.forEach(pixel => preserve(pixels, pixel));
weakEdgePixels.forEach(pixel => supress(pixels, pixel));
@@ -83,7 +84,7 @@ function sobelFilter(pixels, x, y) {
return {
pixel: [val, val, val, grad],
angle: angle
};
}
}
function categorizeAngle(angle){