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
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 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 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 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; |
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
# 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) |
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 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 json | |
import subprocess | |
new_cdata='{"input": {"data": {"SensorMetaInfo": {"CameraDescription": "cisco_cam_type_1", "Ly": "20.98S", "Lx": "10.233N", "FeatureId": "9", "ServerId": "vijaywada_PC_01", "ProductCategoryId": "2", "CameraID": "akashwani_east", "LongDescription": "high range camera"}, "Data": {"CongressionThreshold": "20.0%", "ImageURL": "/home/anuj/git/work/end-to-end-api/hyderabad/deputy-01/vehicle-counter/output/2018-10-17/images/vehicle_counter_08:36:58.jpg", "Vehicles": {"AreaOccupied": "34.0%", "BikeCount": 2, "MiniBusCount": 0, "CarCount": 1, "ReportedTime": "2018-02-26t10:23:51", "HeavyVehicleCount": 0}, "VideoURL": "http://<ip-address>/video-analytics/hyderabad/akashwani_east/vehicle_counter/output/videos/2018_02_26_10_23_11_video.mp4", "CapturedTime": "2018-10-17 08:36:58.041400"}, "Event": {"EventID": 11, "EventDescription": "Threshold Congestion Exceeded"}}}, "configName": "Congestion", "groupName": "TrafficAnalytics", "tenantId": "vijayawada.com"}' | |
subprocess.call(["curl", "-X", " |
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
# 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 |
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
# convert-mp4-to-webm-for-rtsp | |
ffmpeg -i input-file.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output-file.webm |
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
import numpy as np | |
import cv2 | |
class BackGroundSubtractor: | |
# When constructing background subtractor, we | |
# take in two arguments: | |
# 1) alpha: The background learning factor, its value should | |
# be between 0 and 1. The higher the value, the more quickly | |
# your program learns the changes in the background. Therefore, |
OlderNewer