Skip to content

Instantly share code, notes, and snippets.

View arissa34's full-sized avatar

Rami Martin arissa34

View GitHub Profile
@aviadmini
aviadmini / ExifToMat.java
Created September 9, 2016 21:21
Android snippet: EXIF orientation to Bitmap transformation Matrix
import android.graphics.Matrix;
import android.media.ExifInterface;
// Some reference: https://msdn.microsoft.com/library/windows/apps/windows.storage.fileproperties.photoorientation
public class ExifToMat {
public static Matrix fromOrientation(final int pExifOrientation) {
Matrix matrix = new Matrix();
switch (pExifOrientation) {
@zhangzhensong
zhangzhensong / cvgltexture.cpp
Last active October 11, 2022 20:52
Converting OpenCV Mat to OpenGL texture
// don't forget to include related head files
void BindCVMat2GLTexture(cv::Mat& image, GLuint& imageTexture)
{
if(image.empty()){
std::cout << "image empty" << std::endl;
}else{
//glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glGenTextures(1, &imageTexture1);
glBindTexture(GL_TEXTURE_2D, imageTexture1);
package mdesl.line2dx.test;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
@indy
indy / improved-perlin-noise.java
Created February 6, 2010 12:22
Perlin noise - Java implementation
// JAVA REFERENCE IMPLEMENTATION OF IMPROVED NOISE - COPYRIGHT 2002 KEN PERLIN.
public final class ImprovedNoise {
static public double noise(double x, double y, double z) {
int X = (int)Math.floor(x) & 255, // FIND UNIT CUBE THAT
Y = (int)Math.floor(y) & 255, // CONTAINS POINT.
Z = (int)Math.floor(z) & 255;
x -= Math.floor(x); // FIND RELATIVE X,Y,Z
y -= Math.floor(y); // OF POINT IN CUBE.
z -= Math.floor(z);