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
// Simple vertex shader | |
private static final String VERTEX_SHADER = | |
"uniform mat4 uMVPMatrix;\n" + | |
"uniform mat4 uTexMatrix;\n" + | |
"attribute vec4 aPosition;\n" + | |
"attribute vec4 aTextureCoord;\n" + | |
"varying vec2 vTextureCoord;\n" + | |
"void main() {\n" + | |
" gl_Position = uMVPMatrix * aPosition;\n" + | |
" vTextureCoord = (uTexMatrix * aTextureCoord).xy;\n" + |
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
/** | |
* It took me a whole 6 hours to finally get the color conversion right. | |
* I have a fairly good understanding of the various color formats (YUV420P, SP, 422, etc etc), | |
* and how to access individual Y, U, and V components. | |
* I however struggled because of a very simple yet hair-pulling gotcha. | |
* All primitives in Java are signed! If you come from a Python-like world where 0xFF prints 255, | |
* you see yourself struggle just the same. I am however embarrassed at spending 6 hours on this. | |
* | |
* @author rish | |
*/ |
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 | |
import cv2 | |
from imutils.object_detection import non_max_suppression | |
from imutils import paths | |
import argparse | |
import imutils | |
""" | |
The parameters passed to the hog detector need to be played around | |
with to get optimum speed vs accuracy. This will always be a tradeoff. |
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
''' | |
Performs software stabilization using optical flow + linear smoothing. | |
Vision algos used : | |
- KLT for flow tracking | |
- Harris corner detection to detect points to be tracked in each frame | |
This is the Python translation I wrote of the original .cpp code written by nghiaho.com/?p=2093 | |
''' | |
import cv2 | |
import numpy as np |
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
package com.rish.imagestab.utils; | |
import java.io.BufferedWriter; | |
import java.io.File; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
import java.util.HashMap; | |
/** | |
* Created by rish on 14/6/17. |
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
''' | |
A small script to play videos of the same dimensions side by side. | |
I needed this while showing two videos side by side; one stabilized and one not stabilized during my | |
works on video stabilization. | |
''' | |
import cv2, sys | |
import numpy as np | |
if len(sys.argv) < 3: |
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
package com.tonbo.streamer.network; | |
import android.content.Context; | |
import android.content.IntentFilter; | |
import android.net.NetworkInfo; | |
import android.net.wifi.ScanResult; | |
import android.net.wifi.WifiConfiguration; | |
import android.net.wifi.WifiInfo; | |
import android.net.wifi.WifiManager; | |
import android.support.annotation.CheckResult; |
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
/** A fragment shader to convert YUV420P to RGB. | |
* Input textures Y - is a block of size w*h. | |
* texture U is of size w/2*h/2. | |
* texture V is of size w/2*h/2. | |
* In this case, the layout looks like the following : | |
* __________ | |
* | | | |
* | Y | size = w*h | |
* | | | |
* |________| |
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
/** A fragment shader to convert NV12 to RGB. | |
* Input textures Y - is a block of size w*h. | |
* texture UV is of size w*h/2. | |
* Remember, both U and V are individually of size w/2*h/2, but they are interleaved. | |
* The layout looks like this : | |
* ---------- | |
* | | | |
* | Y | size = w*h | |
* | | | |
* |________| |
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
package rish.crearo.imagestabv2; | |
/** | |
* Original author unknown. | |
* | |
* Modified by rish on 10/7/17. | |
* [email protected] | |
*/ | |
import android.content.Context; |