Skip to content

Instantly share code, notes, and snippets.

This file has been truncated, but you can view the full file.
@kiding
kiding / HDRGainMap.swift
Last active June 10, 2025 14:04
Extracting HDR Gain Map from iOS 14.1+ (iPhone 12+) photos
import UIKit
import MobileCoreServices.UTCoreTypes
if #available(iOS 14.1, *) {
let input = Bundle.main.url(forResource: "IMG_0037", withExtension: "HEIC")!
let output = FileManager().temporaryDirectory.appendingPathComponent("IMG_0037.GAIN_MAP.BMP")
let source = CGImageSourceCreateWithURL(input as CFURL, nil)!
// urn:com:apple:photo:2020:aux:hdrgainmap
let dataInfo = CGImageSourceCopyAuxiliaryDataInfoAtIndex(source, 0, kCGImageAuxiliaryDataTypeHDRGainMap)! as Dictionary
@MrLixm
MrLixm / maxrgb_lottes.py
Last active November 21, 2020 17:00
Implementation of Lottes(2016) Tonemapping.
import logging
import colour
import numpy as np
from oiio import OpenImageIO as oiio
# ---------------------------------------------------------
def lerp(x, y, a):
@zachlewis
zachlewis / build_test_ocio2_config.py
Last active July 17, 2021 23:00
OCIO 2.0 test config
import PyOpenColorIO as ocio
import numpy as np
import colour as colour
from six import string_types
__version__ = "2020.11.08.0"
OUTPUT = "/tmp/test_config.ocio2"
@sobotka
sobotka / stuffs.py
Created July 12, 2020 21:09
Film Like Curve Bezier Stuffs
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy
import math
# Return value as scalar or array. Shamelessly borrowed from
# Colour-science.org.
def as_numeric(obj, as_type=numpy.float64):
@alexjc
alexjc / reading-list.rst
Last active April 26, 2025 07:01
Reading List on Texture Synthesis
@sobotka
sobotka / bare-bones-ocio-configuration.py
Created March 23, 2020 16:33
Bare Bones OpenColorIO Configuration Generation via Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import PyOpenColorIO
import numpy
import colour
from colour import (
io,
adaptation,
models
@AmericanEnglish
AmericanEnglish / README.md
Last active May 26, 2020 22:56
How to compile TensorFlow 2.0 from source in an HPC environment that uses EasyBuild for CentOS 7.x

How to compile TensorFlow 2.0 from source in an HPC environment that uses EasyBuild for CentOS7

Some background about why another Gist on compiling tensorflow without root

If you're like me and you don't have root access to a HPC system and your system adminstrators use EasyBuild combined with Lmod you are going to be in for a bad time. Our CentOS7 did not ship out of the box capable of compiling tensorflow 2.0 from source with no problems. I scoured several closed and recently opened issues to write a script that enables the creation of a fully functional .whl for tensorflow 2.0. Note that on our cluster we have only two different sets of GPUs. One set has compute capability 7.0 (V100) and compute capability 3.5 (K20m). So many issues came up

  1. because Bazel can't handle symlinks for gcc leading to errors like
@tvst
tvst / SessionState.py
Last active September 30, 2024 07:47
DO NOT USE!!! Try st.session_state instead.
"""Hack to add per-session state to Streamlit.
Usage
-----
>>> import SessionState
>>>
>>> session_state = SessionState.get(user_name='', favorite_color='black')
>>> session_state.user_name
''
import numpy as np
import cv2
import face_alignment
# Initialize the chip resolution
chipSize = 300
chipCorners = np.float32([[0,0],
[chipSize,0],
[0,chipSize],
[chipSize,chipSize]])