Skip to content

Instantly share code, notes, and snippets.

View ithmz's full-sized avatar
🏹
Focusing

Thomas Trinh ithmz

🏹
Focusing
  • Taipei
View GitHub Profile
@ithmz
ithmz / fragment.glsl
Created February 19, 2020 02:25
Fragment shader to convert YUV420SP (a.k.a NV12 or NV21) to RGB
#version 330 core
out vec4 FragColor;
in vec2 texCoord;
uniform sampler2D textureY;
uniform sampler2D textureVU;
void main()
{
vec3 yuv, rgb;
vec3 yuv2r = vec3(1.164, 0.0, 1.596);
vec3 yuv2g = vec3(1.164, -0.391, -0.813);
@ithmz
ithmz / yuv.cpp
Last active October 30, 2023 03:10
Upload YUV texture to OpenGL
// Get texture location in fragment shader
GLint locTexY = glGetUniformLocation(program, "textureY");
GLint locTexVU = glGetUniformLocation(program, "textureVU");
// Upload YUV data to texture buffer
GLuint textureID[2];
glGenTextures(1, &textureID[0]);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textureID[0]);
import matplotlib.pyplot as plt
f, axarr = plt.subplots(3,4)
FIRST_IMAGE=0
SECOND_IMAGE=7
THIRD_IMAGE=26
CONVOLUTION_NUMBER = 1
from tensorflow.keras import models
layer_outputs = [layer.output for layer in model.layers]
activation_model = tf.keras.models.Model(inputs = model.input, outputs = layer_outputs)
for x in range(0,4):