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, |
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 | |
from collections import deque | |
from operator import itemgetter | |
class BackGroundSubtractor: | |
# When constructing background subtractor, we | |
# take in two arguments: | |
# 1) alpha: The background learning factor, its value should |
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 script does a perspective transformation with an A4 paper | |
# Get an A4 sheet, put it on a table in front of your webcam | |
# just close enough so that all its corners are visible. | |
# Run this script, you will be given a frame from the webcam. | |
# Pick the corners of the A4 sheet for the software, by double clicking on its corners | |
# one by one in the following order: top left, top right, bottom left, bottom right. | |
# Just as you select the last corner, a live feed without the perspective distortion | |
# shows up and now you can write something on it, and have a view of it as if | |
# the camera was right on top of it. Cheers! | |
# visit: |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<!-- Include jquery --> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script> | |
<!-- Include jquery mark ( for highlighting text )--> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/6.1.0/jquery.mark.min.js"></script> |
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
package foo.foo.foo.foo; | |
import android.content.Intent; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.view.View; | |
public class MainActivity extends AppCompatActivity { | |
@Override |
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
using System; | |
using System.IO; | |
using System.IO.Compression; | |
using System.Text; | |
class Program { | |
private static string Compress(string text) | |
{ | |
byte[] buffer = Encoding.UTF8.GetBytes(text); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script | |
src="https://code.jquery.com/jquery-3.1.1.min.js" | |
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" | |
crossorigin="anonymous"></script> | |
<script src='https://maps.googleapis.com/maps/api/js?v=3.exp'></script> | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="js/jquery-1.10.2.min.js"></script> | |
<!-- be careful to include the parameter "libraries=places" --> | |
<script type="text/javascript" src='http://maps.google.com/maps/api/js?sensor=false&libraries=places'></script> | |
<script src="js/locationpicker.jquery.js"></script> | |
</head> | |
<body> | |
<div id="somecomponent" style="width: 500px; height: 400px;"></div> |
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 getUserMediaPermission() { | |
return new Promise((resolve,reject) => { | |
navigator.mediaDevices.getUserMedia({ video: true, audio: true }) | |
.then(stream => { stream.getTracks().forEach(t => t.stop()); resolve(true) }) | |
.catch(() => { resolve(false) }); | |
}); | |
} | |
// usage | |
getUserMediaPermission().then((granted) => { console.log(granted) }); |
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
const jsonMiddleware = json({ limit: "10mb", inflate: true }); | |
app.use((req,res,next)=>{ | |
jsonMiddleware(req,res,(err)=>{ | |
if(err){ | |
console.log(err); | |
res.status(400).json({ | |
status: 400, | |
message: "Invalid JSON or request too large" | |
}); | |
} else{ |
OlderNewer