This file contains hidden or 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
| // Initialize detector vector | |
| if (targetDetectors.size() == 0) | |
| { | |
| for (unsigned iter = 0; iter < inputImages.size(); iter++) targetDetectors.push_back(CalibTargetDetector()); | |
| } | |
| // Create Output vector | |
| for (unsigned iter = 0; iter < inputImages.size(); iter++) targetImages.push_back(TypedObject<cv::Mat>(cv::Mat())); | |
| std::vector<std::thread*> threads(inputImages.size()); |
This file contains hidden or 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
| <figure class="video-player"> | |
| <video preload="none" width="1280" height="720" poster="video.jpg"> | |
| <source src="video.webm" type="video/webm" /> | |
| <source src="video.mp4" type="video/mp4" /> | |
| </video> | |
| <button class="play-toggle">Toggle play</button> | |
| <button class="mute-toggle">Toggle mute</button> | |
| </figure> | |
| <script> | |
| // Initialize video player |
This file contains hidden or 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
| /** | |
| * OpenCV video streaming over TCP/IP | |
| * Client: Receives video from server and display it | |
| * by Steve Tuenkam | |
| */ | |
| #include "opencv2/opencv.hpp" | |
| #include <sys/socket.h> | |
| #include <arpa/inet.h> | |
| #include <unistd.h> |
This file contains hidden or 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
| /*M/////////////////////////////////////////////////////////////////////////////////////// | |
| // | |
| // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. | |
| // | |
| // By downloading, copying, installing or using the software you agree to this license. | |
| // If you do not agree to this license, do not download, install, | |
| // copy or use the software. | |
| // | |
| // | |
| // License Agreement |
This file contains hidden or 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
| # To be reminded | |
| # 1) Classifying a single point can result in a true positive (truth = 1, guess = 1), a true negative (truth = 0, guess = 0), a false positive (truth = 0, guess = 1), or a false negative (truth = 1, guess = 0). | |
| # 2) Accuracy measures how many classifications your algorithm got correct out of every classification it made. | |
| # 3) Recall measures the percentage of the relevant items your classifier was able to successfully find. | |
| # 4) Precision measures the percentage of items your classifier found that were actually relevant. | |
| # 5) Precision and recall are tied to each other. As one goes up, the other will go down. | |
| # 6) F1 score is a combination of precision and recall. | |
| # 7) F1 score will be low if either precision or recall is low. | |
| from sklearn.metrics import accuracy_score, recall_score, precision_score, f1_score |
This file contains hidden or 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
| Clc | |
| I=imread('cameraman.tif'); | |
| [m n]=size(I); | |
| a=im2double(I); | |
| for i=1:m-2 | |
| for j=1:n-2 | |
| v(i,j) = [a(i,j) + a(i,j+1) + a(i,j+2) + a(i+1,j) + a(i+1,j+1) + a(i+1,j+2) + a(i+2,j) + a(i+2,j+1) + a(i+2,j+2)]./9; %smoothing filter | |
| x(i,j) = [0*a(i,j) + 1*a(i,j+1) + 0*a(i,j+2) + 1*a(i+1,j) + -4*a(i+1,j+1) + 1*a(i+1,j+2) + 0*a(i+2,j) + 1*a(i+2,j+1) + 0*a(i+2,j+2)]; %high pass filter | |
This file contains hidden or 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
| import argparse, os | |
| import numpy as np | |
| from scipy.misc import imread, imsave | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('--template_dir', required=True) # Low-res images | |
| parser.add_argument('--source_dir', required=True) # Outputs from CNN | |
| parser.add_argument('--output_dir', required=True) | |
| args = parser.parse_args() |
This file contains hidden or 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
| /* | |
| http://benjithian.sg/2012/12/simple-background-subtraction/ | |
| Simple Background Subtraction. Simple stuff. | |
| */ | |
| #include <stdio.h> | |
| #include <curl/curl.h> | |
| #include <sstream> | |
| #include <iostream> | |
| #include <vector> | |
| #include <opencv2/opencv.hpp> |
This file contains hidden or 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
| def PLfit(p0,blin,x,data,model,engine=optimize.fmin_powell,err=1): | |
| """ | |
| Partial Linear Model Fitting. | |
| Parameters | |
| ---------- | |
| p0 : Initial parameters | |
| blin : Boolean array specifying which model parameters are fixed | |
| """ |
This file contains hidden or 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
| def f1_loss(y_true:torch.Tensor, y_pred:torch.Tensor, is_training=False) -> torch.Tensor: | |
| '''Calculate F1 score. Can work with gpu tensors | |
| The original implmentation is written by Michal Haltuf on Kaggle. | |
| Returns | |
| ------- | |
| torch.Tensor | |
| `ndim` == 1. 0 <= val <= 1 | |
NewerOlder