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
namespace cv { | |
// calculates the median value of a single channel | |
// based on https://github.com/arnaudgelas/OpenCVExamples/blob/master/cvMat/Statistics/Median/Median.cpp | |
double median( cv::Mat channel ) | |
{ | |
double m = (channel.rows*channel.cols) / 2; | |
int bin = 0; | |
double med = -1.0; | |
int histSize = 256; |
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 imports | |
#include <opencv2/imgproc/imgproc.hpp> | |
#include <opencv2/highgui/highgui.hpp> | |
// C++ imports | |
#include <iostream> | |
// namespaces | |
using namespace std; | |
using namespace cv; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
// takes the form field value and returns true on valid number | |
function valid_credit_card(value) { | |
// accept only digits, dashes or spaces | |
if (/[^0-9-\s]+/.test(value)) return false; | |
// The Luhn Algorithm. It's so pretty. | |
var nCheck = 0, nDigit = 0, bEven = false; | |
value = value.replace(/\D/g, ""); | |
for (var n = value.length - 1; n >= 0; n--) { |
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
CAP_PROP_POS_MSEC =0, //!< Current position of the video file in milliseconds. | |
CAP_PROP_POS_FRAMES =1, //!< 0-based index of the frame to be decoded/captured next. | |
CAP_PROP_POS_AVI_RATIO =2, //!< Relative position of the video file: 0=start of the film, 1=end of the film. | |
CAP_PROP_FRAME_WIDTH =3, //!< Width of the frames in the video stream. | |
CAP_PROP_FRAME_HEIGHT =4, //!< Height of the frames in the video stream. | |
CAP_PROP_FPS =5, //!< Frame rate. | |
CAP_PROP_FOURCC =6, //!< 4-character code of codec. see VideoWriter::fourcc . | |
CAP_PROP_FRAME_COUNT =7, //!< Number of frames in the video file. | |
CAP_PROP_FORMAT =8, //!< Format of the %Mat objects returned by VideoCapture::retrieve(). | |
CAP_PROP_MODE =9, //!< Backend-specific value indicating the current capture mode. |
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 tensorflow as tf | |
x = tf.Variable(2, name='x', dtype=tf.float32) | |
log_x = tf.log(x) | |
log_x_squared = tf.square(log_x) | |
optimizer = tf.train.GradientDescentOptimizer(0.5) | |
train = optimizer.minimize(log_x_squared) | |
init = tf.initialize_all_variables() |
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
# Commands to install virtual environments | |
# With this setup, all your virtual environments will be placed | |
# at one place inside .virtualenvs folder under home directory in Linux | |
sudo apt update | |
sudo pip install virtualenv virtualenvwrapper | |
# open .bashrc file and copy paste the following lines below: | |
# virtualenv and virtualenvwrapper |
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
export CUDA_HOME=/usr/local/cuda | |
export PATH=/usr/local/cuda/bin:$PATH | |
export CPATH=/usr/local/cuda/include:$CPATH | |
export LIBRARY_PATH=/usr/local/cuda/lib64:$LIBRARY_PATH | |
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH |
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
# add jupyter kernel | |
# if you are working inside a virtual environment, activate it and run the following command (change the names accordingly, of course!) | |
python -m ipykernel install --user --name video-analytics --display-name "Python2 (video-analytics)" | |
# list all available kernels | |
jupyter kernelspec list | |
# remove a kernel | |
jupyter kernelspec remove "kernel-name" (without quotes) |
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
# taken entirely from: https://dzone.com/articles/password-less-ssh-access-for-automation | |
## Proxy ## | |
## Forward all local port 8888 traffic to port 8888 on the remote server ## | |
Host <your host name> | |
HostName <your IP> | |
ForwardX11 yes | |
User <your username> | |
IdentityFile /path/to/<your pem file>.pem | |
LocalForward localhost <or some of your IP>:8888 <server IP address>:8888 |
OlderNewer