Skip to content

Instantly share code, notes, and snippets.

View jkjung-avt's full-sized avatar

JK Jung jkjung-avt

View GitHub Profile
@jkjung-avt
jkjung-avt / .vimrc
Last active June 19, 2021 03:25
My .vimrc file
" JK Jung's .vmirc
"
" Reference:
"
" 1. Sample .vimrc by Martin Brochhaus, presented at PyCon APAC 2012
" https://github.com/mbrochh/vim-as-a-python-ide
" 2. https://realpython.com/vim-and-python-a-match-made-in-heaven/
" 3. https://github.com/fisadev/fisa-vim-config
" 4. https://github.com/thesheff17/youtube/blob/master/vim/vimrc
" 5. https://github.com/amix/vimrc
@jkjung-avt
jkjung-avt / tegra-cam-rec.py
Last active August 20, 2021 03:10
A Tegra X2/X1 camera recorder, implemented in python
# --------------------------------------------------------
# Camera Recorder for Tegra X2/X1
#
# This program captures video from IP CAM, USB webcam,
# or the Tegra onboard camera, adds some watermark on
# the video frames and then records it into a TS file.
# The code demonstrates how to use cv2.VideoWriter()
# while taking advantage of TX2/TX1's H.264 H/W encoder
# capabilities.
#
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jkjung-avt
jkjung-avt / openalpr_camera.py
Last active December 20, 2023 20:36
Real-time license plate recognition with 'openalpr' using a video file as input. Please check out my "Building and Testing 'openalpr' on Jetson TX2" post for more information: https://jkjung-avt.github.io/openalpr-on-tx2/
# test_camera.py
#
# Open an RTSP stream and feed image frames to 'openalpr'
# for real-time license plate recognition.
import numpy as np
import cv2
from openalpr import Alpr
@jkjung-avt
jkjung-avt / extract_features.py
Created February 25, 2018 02:31
Example OpenCV feature extracteor
# Feature extractor
def extract_features(image_path, vector_size=32):
image = imread(image_path, mode="RGB")
try:
# Using KAZE, cause SIFT, ORB and other was moved to additional module
# which is adding addtional pain during install
alg = cv2.KAZE_create()
# Dinding image keypoints
kps = alg.detect(image)
# Getting first 32 of them.
@jkjung-avt
jkjung-avt / tegra-cam-caffe-threaded.py
Last active May 21, 2023 05:00
Capture live video from camera and do Caffe image classification on Jetson TX2/TX1.
# --------------------------------------------------------
# Camera Caffe sample code for Tegra X2/X1
#
# This program captures and displays video from IP CAM,
# USB webcam, or the Tegra onboard camera, and do real-time
# image classification (inference) with Caffe. Refer to the
# following blog post for how to set up and run the code:
#
# https://jkjung-avt.github.io/camera-caffe-threaded/
#
@jkjung-avt
jkjung-avt / tegra-cam.py
Last active October 11, 2023 08:20
Capture and display video from either IP CAM, USB webcam, or the Tegra X2/X1 onboard camera.
# --------------------------------------------------------
# Camera sample code for Tegra X2/X1
#
# This program could capture and display video from
# IP CAM, USB webcam, or the Tegra onboard camera.
# Refer to the following blog post for how to set up
# and run the code:
# https://jkjung-avt.github.io/tx2-camera-with-python/
#
# Written by JK Jung <jkjung13@gmail.com>
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
#import cPickle as pickle
import _pickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4