Skip to content

Instantly share code, notes, and snippets.

View bemoregt's full-sized avatar
🎯
Focusing

Gromit Park bemoregt

🎯
Focusing
View GitHub Profile
def left_right_crop(img, size):
if isinstance(size, numbers.Number):
size = (int(size), int(size))
else:
assert len(size) == 2, "Please provide only two dimensions (h, w) for size."
w, h = img.size
crop_h, crop_w = size
if crop_w > w or crop_h > h:
raise ValueError("Requested crop size {} is bigger than input size {}".format(size, (h, w)))
@dusty-nv
dusty-nv / pytorch_jetson_install.sh
Last active October 21, 2021 01:28
Install procedure for pyTorch on NVIDIA Jetson TX1/TX2 with JetPack <= 3.2.1. For JetPack 4.2 and Xavier/Nano/TX2, see https://devtalk.nvidia.com/default/topic/1049071/jetson-nano/pytorch-for-jetson-nano/
#!/bin/bash
#
# EDIT: this script is outdated, please see https://forums.developer.nvidia.com/t/pytorch-for-jetson-nano-version-1-6-0-now-available
#
sudo apt-get install python-pip
# upgrade pip
pip install -U pip
pip --version
# pip 9.0.1 from /home/ubuntu/.local/lib/python2.7/site-packages (python 2.7)
@bemoregt
bemoregt / 1dPoc.cpp
Created August 10, 2016 07:47
my own gist test
// 1D POC ---------------------------------------------------------------------------------------
cv::Point2d phaseCorrelate1D(InputArray _src1, InputArray _src2, InputArray _window, int k=65535, int flag_pixel = false)
{
Mat src1 = _src1.getMat();
Mat src2 = _src2.getMat();
Mat window = _window.getMat();
CV_Assert( src1.type() == src2.type());
CV_Assert( src1.type() == CV_32FC1 || src1.type() == CV_64FC1 );
CV_Assert( src1.size == src2.size);
@neilslater
neilslater / brix.py
Created August 9, 2016 07:58
Keras example image regression, extract texture height param
# -*- coding: utf-8 -*-
import numpy as np
import os
import cv2
import pandas as pd
from sklearn.cross_validation import train_test_split
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D
@jetsonhacks
jetsonhacks / installiTorch.sh
Last active August 31, 2019 04:42
Install iTorch and prerequisites
#!/bin/sh
# Install Python prerequisites on NVIDIA Jetson TK1 for iTorch
# This is for https://github.com/facebook/iTorch
# L4T 21.3, Torch 7 (http://torch.ch)
# Python 2.7 or greater must be installed before running this script
# Torch 7 should already be installed before running this script
# iPython is loaded using pip, as repository version is 1.x version, > 2.0 is needed
# Need to compile from source as repository version libzmq3-dev is not the correct revision
wget http://download.zeromq.org/zeromq-4.0.5.tar.gz
tar xzvf zeromq-4.0.5.tar.gz
#include "opencv2/opencv.hpp"
#include <omp.h>
using namespace cv;
#if _DEBUG
#pragma comment(lib, "opencv_core248d.lib")
#pragma comment(lib, "opencv_highgui248d.lib")
#pragma comment(lib, "opencv_imgproc248d.lib")
#pragma comment(lib, "opencv_contrib248d.lib")
#else
@daisukekobayashi
daisukekobayashi / ripoc.py
Created January 22, 2014 14:26
Rotation invariant phase-only correlation in python
#! /usr/bin/env python
# -*- coding: utf-8
import sys
import numpy
from numpy import pi, sin, cos
from scipy.optimize import leastsq
import scipy, scipy.fftpack
import cv2
@demun
demun / index.html
Created November 7, 2013 05:12
서브라임텍스트 관련 팁
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>sublime text tip</title>
</head>
<body>
<h3>Less.sublime-build</h3>
<code>
{