Commit 72870a00 authored by Matija Obreza's avatar Matija Obreza
Browse files

Small updates

parent 578d9132
......@@ -74,9 +74,8 @@ export function filterSum(image) {
const B = data[p + 2];
const A = data[p + 3];
dataR[p + 0] = (R + G + B);
dataR[p + 1] = (R + G + B);
dataR[p + 2] = (R + G + B);
// dataR[p + 0] = dataR[p + 1] = dataR[p + 2] = (R * (1 - .2126) + G * (1 - .7152) + B * (1 - .0722));
dataR[p + 0] = dataR[p + 1] = dataR[p + 2] = R + G + B > 10 ? 255 : 0;
dataR[p + 3] = A;
}
}
......@@ -409,8 +408,8 @@ export function filterSobel(image) {
// adjusted for edges
const p = ((y - (y === 0 ? 0 : y === h - 1 ? 0 : j)) * w + (x - (x === 0 ? 0 : x === w - 1 ? 0 : i))) * 4;
const pixel = data[p + color] / 255;
Gx[pG] += mGx[i + 1][j + 1] * pixel;
Gy[pG] += mGy[i + 1][j + 1] * pixel;
Gx[pG] += mGx[j + 1][i + 1] * pixel;
Gy[pG] += mGy[j + 1][i + 1] * pixel;
// if (w < 20) {
// // console.log("mGx[" + i + "," + j +"]", mGx[i + 1], mGx[i + 1][j + 1]);
// // console.log("mGy[" + i + "," + j +"]", mGy[i + 1], mGy[i + 1][j + 1]);
......@@ -748,7 +747,7 @@ export function filterOutline(image) {
dataR[P(x, y, 3)] = 255; // full alpha
// TODO fill the outline or clear the src data
shapes++;
floodFill(dataR, w, h, x, y, color);
// floodFill(dataR, w, h, x, y, color);
go = false;
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment