This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Author Ben McDonald. Adapted from python scikit-learn | |
/// | |
/// Naive bayes is a machine learning classifier. It uses bayes formula to classify data | |
/// based on how well data fits into normal distributions modeled from training data | |
use rulinalg::matrix::BaseMatrix; | |
use rulinalg::matrix::BaseMatrixMut; | |
use rulinalg::matrix::{Axes, Matrix}; | |
use std::collections::HashMap; | |
use std::error::Error; | |
use std::f64::consts::PI; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import time | |
_MAX_AREA_FLUCTUATION = 0.6 #percent | |
_STONG_FRAME_COUNT = 20 | |
_OBJECT_TIMEOUT = 3 #seconds | |
class TrackedObject(object): | |
""" | |
A class to track objects detected in a frame. The class logs frame | |
locations an object is detected and calculates an area the object is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
This program is free software: you can redistribute it and/or modify | |
it under the terms of the GNU General Public License as published by | |
the Free Software Foundation, either version 3 of the License, or | |
(at your option) any later version. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANy WARRANTy; without even the implied warranty of | |
MERCHANTABILITy or FITNESS FOR A PARTICULAR PURPOSE. See the | |
GNU General Public License for more details. | |
you should have received a copy of the GNU General Public License |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isDataURL(s) { | |
var commaIndex = s.indexOf(','); | |
if (commaIndex === -1) { | |
return false; | |
} else { | |
try { | |
window.atob(s.slice(commaIndex + 1)); | |
return true; |