Eslint operator spacing config (#1109)

* Eslint operator spacing config

* consistent spacing after comma

* comma styling config

* Trailing spaces config
This commit is contained in:
aashna27
2019-06-14 02:29:43 +05:30
committed by Jeffrey Warren
parent 9eac21897a
commit 440c3e0ad0
64 changed files with 400 additions and 396 deletions

View File

@@ -5,7 +5,7 @@ const kernelx = [
[-1, 0, 1]
],
kernely = [
[-1,-2,-1],
[-1, -2, -1],
[ 0, 0, 0],
[ 1, 2, 1]
];
@@ -69,8 +69,8 @@ function sobelFilter(pixels, x, y) {
yn = y + b - 1;
if (isOutOfBounds(pixels, xn, yn)) {
gradX += pixels.get(xn+1, yn+1, 0) * kernelx[a][b];
gradY += pixels.get(xn+1, yn+1, 0) * kernely[a][b];
gradX += pixels.get(xn + 1, yn + 1, 0) * kernelx[a][b];
gradY += pixels.get(xn + 1, yn + 1, 0) * kernely[a][b];
}
else {
gradX += pixels.get(xn, yn, 0) * kernelx[a][b];
@@ -98,7 +98,7 @@ function categorizeAngle(angle){
* 2 => NE-SW
* 3 => N-S
* 4 => NW-SE
*/
*/
}
function isOutOfBounds(pixels, x, y){
@@ -107,7 +107,7 @@ function isOutOfBounds(pixels, x, y){
const removeElem = (arr = [], elem) => {
return arr = arr.filter((arrelem) => {
return arrelem !== elem;
return arrelem !== elem;
});
};
@@ -120,7 +120,7 @@ function nonMaxSupress(pixels, grads, angles) {
let angleCategory = categorizeAngle(angles[x][y]);
if (!isOutOfBounds(pixels, x - 1, y - 1) && !isOutOfBounds(pixels, x+1, y+1)){
if (!isOutOfBounds(pixels, x - 1, y - 1) && !isOutOfBounds(pixels, x + 1, y + 1)){
switch (angleCategory){
case 1:
if (!((grads[x][y] >= grads[x][y + 1]) && (grads[x][y] >= grads[x][y - 1]))) {
@@ -186,17 +186,17 @@ function hysteresis(strongEdgePixels, weakEdgePixels){
let x = pixel[0],
y = pixel[1];
if (weakEdgePixels.includes([x+1, y])) {
removeElem(weakEdgePixels, [x+1, y]);
}
else if (weakEdgePixels.includes([x-1, y])) {
removeElem(weakEdgePixels, [x-1, y]);
if (weakEdgePixels.includes([x + 1, y])) {
removeElem(weakEdgePixels, [x + 1, y]);
}
else if (weakEdgePixels.includes([x, y+1])) {
removeElem(weakEdgePixels, [x, y+1]);
}
else if(weakEdgePixels.includes([x, y-1])) {
removeElem(weakEdgePixels, [x, y-1]);
else if (weakEdgePixels.includes([x - 1, y])) {
removeElem(weakEdgePixels, [x - 1, y]);
}
else if (weakEdgePixels.includes([x, y + 1])) {
removeElem(weakEdgePixels, [x, y + 1]);
}
else if(weakEdgePixels.includes([x, y - 1])) {
removeElem(weakEdgePixels, [x, y - 1]);
}
});
}