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 root of the tree, a new node | |
| where the last parent will be written to, | |
| a counter passed as 0, and max = inf | |
| The recursions can be unwrapped in the | |
| following pseudocode, based on Depth | |
| First Search | |
| visited = {} |
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
| int count_spaces (FILE* f) { | |
| int spaces = 0; | |
| char chIn; | |
| for ( chIn = '\0'; chIn != '\n'; spaces += ( chIn = fgetc(f) ) == ' ' ); | |
| return spaces; | |
| } |
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 = cv2.VideoCapture('datasets/gesture/test_02.mp4') | |
| ret, old_frame = cap.read() | |
| frame1 = old_frame | |
| cropper = MouseRoi(frame1) | |
| cropper.crop() | |
| cropper.qimshow(cropper.get_cropped()) | |
| (c1,r1), (c0,r0) = cropper.clicks_xy | |
| mask_roi = np.zeros(cv2.cvtColor(frame1, cv2.COLOR_BGR2GRAY).shape, np.uint8) |
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
| #!/usr/bin/env python | |
| ### | |
| # Original: https://github.com/shantnu/Webcam-Face-Detect | |
| import cv2 | |
| import sys | |
| faceCascade = cv2.CascadeClassifier("../cascade/hand.xml") | |
| video_capture = cv2.VideoCapture(0) |
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
| # Based on: https://stackoverflow.com/a/36625937 | |
| cmake_minimum_required(VERSION 3.10) | |
| project(opencvTest) | |
| set(CMAKE_CXX_STANDARD 17) | |
| find_package(OpenCV REQUIRED) | |
| include_directories(${OpenCV_INCLUDE_DIRS}) | |
| add_executable(opencvTest opencv_test.cpp) |
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 cv2 | |
| cap = cv2.VideoCapture(0) | |
| # Check if the webcam is opened correctly | |
| if not cap.isOpened(): | |
| raise IOError("Cannot open webcam") | |
| while True: | |
| valid, frame = cap.read() |
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
| float gaussian(float x, float std, float ampl) { | |
| return ampl * 1/(std*sqrt(TWO_PI)) * exp(-1/2.0 * x/std * x/std); | |
| } | |
| float gaussianNonNrm(float x, float std, float ampl) { | |
| //println(x); | |
| return 1/(std*sqrt(TWO_PI)) * exp(-1/2.0 * x/std * x/std); | |
| } |
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
| this_script_path = os.path.abspath(__file__) | |
| this_script_folder = os.path.dirname(this_script_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
| import numpy as np | |
| from cv2 import cv2 | |
| from typing import List, Union | |
| import doctest | |
| def update_histogram(grad_magn: float, | |
| grad_angle: float, | |
| angle_bins: List, | |
| votes: Union[List, None] = None) -> List[float]: | |
| """update_histogram. Updates histogram of magnitudes (aka 'votes') vs |
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
| #include <iostream> | |
| #include <vector> | |
| #include <assert.h> | |
| #include <cmath> | |
| #include <png++/png.hpp> | |
| using namespace std; | |
| typedef vector<double> Array; | |
| typedef vector<Array> Matrix; |
OlderNewer