Skip to content

Commit

Permalink
fix: localisation algorithms for thermopile sensors
Browse files Browse the repository at this point in the history
Previously the coordinates order was flipped ([y, x] instead of [x, y])
and the clustering was too aggressive.
  • Loading branch information
mKeRix committed Feb 11, 2020
1 parent f451303 commit cc67cf1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/integrations/thermopile/cluster.ts
Expand Up @@ -17,8 +17,9 @@ export class Cluster {
return (
this.pixels.find(value => {
return (
(value.x >= pixel.x - 1 && value.x <= pixel.x + 1) ||
(value.y >= pixel.y - 1 && value.y <= pixel.y + 1)
value.x >= pixel.x - 1 &&
value.x <= pixel.x + 1 &&
value.y >= pixel.y - 1 && value.y <= pixel.y + 1
);
}) !== undefined
);
Expand Down
4 changes: 2 additions & 2 deletions src/integrations/thermopile/thermopile-occupancy.sensor.ts
Expand Up @@ -21,8 +21,8 @@ export abstract class ThermopileOccupancySensor {
const threshold = mean + deltaThreshold;

const relevantPixels: Pixel[] = [];
for (const [x, row] of data.entries()) {
for (const [y, value] of row.entries()) {
for (const [y, row] of data.entries()) {
for (const [x, value] of row.entries()) {
if (value >= threshold) {
relevantPixels.push(new Pixel(x, y, value));
}
Expand Down

0 comments on commit cc67cf1

Please sign in to comment.