Determine your Kinect model version. My model number is 1507 so the version number is 1,
which requires the libfreenect drivers.
yay -S libfreenect
| #include <iostream> | |
| #include <iomanip> | |
| #include <vector> | |
| #include <deque> | |
| #include <ctime> | |
| #include <cstdlib> | |
| #include <algorithm> | |
| #include <unordered_map> | |
| #include <cmath> | |
| #include <memory> | 
| #include <iostream> | |
| #include <vector> | |
| #include <assert.h> | |
| #include <cmath> | |
| #include <png++/png.hpp> | |
| using namespace std; | |
| typedef vector<double> Array; | |
| typedef vector<Array> Matrix; | 
| 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_script_path = os.path.abspath(__file__) | |
| this_script_folder = os.path.dirname(this_script_path) | 
| 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); | |
| } | 
| 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() | 
| # 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) | 
| #!/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) | 
| 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) |