Solved Mac using CLang instead of gcc
parent
4b29cd4f17
commit
892d511525
|
@ -1,6 +1,6 @@
|
|||
# openlut
|
||||
# openlut - Open-source tools for practical color management.
|
||||
|
||||
## Open-source tools for practical color management.
|
||||
**Main development happens at https://git.sofusrose.com/so-rose/openlut - take a look!
|
||||
|
||||
What is it?
|
||||
-----
|
||||
|
|
|
@ -25,12 +25,23 @@ from .LUT import LUT
|
|||
from .Viewer import Viewer
|
||||
|
||||
class ColMap :
|
||||
def __init__(self, rgbArr) :
|
||||
def __init__(self, resX, resY, depth = 16) :
|
||||
self.depth = depth
|
||||
self.rgbArr =
|
||||
|
||||
@staticmethod
|
||||
def fromArray(imgArr, depth = 16) :
|
||||
self.depth = depth
|
||||
|
||||
self.rgbArr = np.array(rgbArr, dtype=np.float32) #Enforce 32 bit floats. Save memory.
|
||||
|
||||
@staticmethod
|
||||
def fromIntArray(imgArr) :
|
||||
bitDepth = int(''.join([i for i in str(imgArr.dtype) if i.isdigit()]))
|
||||
return ColMap(np.divide(imgArr.astype(np.float64), 2 ** bitDepth - 1))
|
||||
|
||||
self.depth = bitDepth
|
||||
|
||||
return ColMap(np.divide(imgArr.astype(np.float32), 2 ** bitDepth - 1))
|
||||
|
||||
#Operations - returns new ColMaps.
|
||||
def apply(self, transform) :
|
||||
|
@ -38,7 +49,7 @@ class ColMap :
|
|||
Applies a Transform object by running its apply method.
|
||||
'''
|
||||
#~ return transform.apply(self)
|
||||
return ColMap(transform.sample(self.asarray()))
|
||||
return ColMap.fromArray(transform.sample(self.asarray()))
|
||||
|
||||
#IO Functions
|
||||
@staticmethod
|
||||
|
@ -186,4 +197,4 @@ class ColMap :
|
|||
|
||||
#Overloads
|
||||
def __repr__(self) :
|
||||
return 'ColMap( \n\trgbArr = {0}\n)'.format('\n\t\t'.join([line.strip() for line in repr(self.rgbArr).split('\n')]))
|
||||
return 'ColMap.fromArray( \n\trgbArr = {0}\n)'.format('\n\t\t'.join([line.strip() for line in repr(self.rgbArr).split('\n')]))
|
||||
|
|
|
@ -4,6 +4,7 @@ import types
|
|||
|
||||
import numpy as np
|
||||
|
||||
#scipy is an optional dependency.
|
||||
MOD_SCIPY = False
|
||||
try :
|
||||
from scipy.interpolate import splrep, splev
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import multiprocessing as mp
|
||||
|
||||
#Future: Use GLFW
|
||||
#Future: Use GLFW!
|
||||
import pygame
|
||||
from pygame.locals import *
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import multiprocessing as mp
|
|||
|
||||
import numpy as np
|
||||
|
||||
#Matplotlib is optional.
|
||||
MOD_MATPLOTLIB = False
|
||||
try:
|
||||
import matplotlib.pyplot as plt
|
||||
|
|
|
@ -152,17 +152,25 @@ PYBIND11_PLUGIN(olOpt) {
|
|||
|
||||
mod.def( "gam",
|
||||
&gam,
|
||||
"Apply any one-argument C++ function to a flattened numpy array; vectorized & parallel."
|
||||
"Apply any one-argument C++ function to a flattened numpy array; vectorized & parallel.",
|
||||
py::arg("arr"),
|
||||
py::arg("g_func")
|
||||
);
|
||||
|
||||
mod.def( "matr",
|
||||
&matr,
|
||||
"Apply any flattened color matrix to a flattened numpy image array; vectorized & parallel."
|
||||
"Apply any flattened color matrix to a flattened numpy image array; vectorized & parallel.",
|
||||
py::arg("img"),
|
||||
py::arg("mat")
|
||||
);
|
||||
|
||||
mod.def( "lut1dlin",
|
||||
&lut1dlin,
|
||||
"Apply any 1D LUT to a flattened numpy image array; vectorized & parallel."
|
||||
"Apply any 1D LUT to a flattened numpy image array; vectorized & parallel.",
|
||||
py::arg("img"),
|
||||
py::arg("lut"),
|
||||
py::arg("lBound"),
|
||||
py::arg("hBound")
|
||||
);
|
||||
|
||||
|
||||
|
@ -171,42 +179,50 @@ PYBIND11_PLUGIN(olOpt) {
|
|||
|
||||
mod.def( "lin",
|
||||
&lin,
|
||||
"The linear function."
|
||||
"The linear gamma function.",
|
||||
py::arg("x")
|
||||
);
|
||||
|
||||
mod.def( "sRGB",
|
||||
&sRGB,
|
||||
"The sRGB function."
|
||||
"The lin --> sRGB gamma function.",
|
||||
py::arg("x")
|
||||
);
|
||||
|
||||
mod.def( "sRGBinv",
|
||||
&sRGBinv,
|
||||
"The sRGBinv function."
|
||||
"The sRGB --> lin function.",
|
||||
py::arg("x")
|
||||
);
|
||||
|
||||
mod.def( "Rec709",
|
||||
&Rec709,
|
||||
"The Rec709 function."
|
||||
"The lin --> Rec709 function.",
|
||||
py::arg("x")
|
||||
);
|
||||
|
||||
mod.def( "ReinhardHDR",
|
||||
&ReinhardHDR,
|
||||
"The ReinhardHDR function."
|
||||
"The lin --> ReinhardHDR function.",
|
||||
py::arg("x")
|
||||
);
|
||||
|
||||
mod.def( "sLog",
|
||||
&sLog,
|
||||
"The sLog function."
|
||||
"The lin --> sLog function.",
|
||||
py::arg("x")
|
||||
);
|
||||
|
||||
mod.def( "sLog2",
|
||||
&sLog2,
|
||||
"The sLog2 function."
|
||||
"The lin --> sLog2 function.",
|
||||
py::arg("x")
|
||||
);
|
||||
|
||||
mod.def( "DanLog",
|
||||
&DanLog,
|
||||
"The DanLog function."
|
||||
"The lin --> DanLog function.",
|
||||
py::arg("x")
|
||||
);
|
||||
|
||||
return mod.ptr();
|
||||
|
|
4
setup.py
4
setup.py
|
@ -15,6 +15,10 @@ from setuptools import find_packages
|
|||
#Better - Mac & Linux only.
|
||||
#~ pyPath = '/usr/local/include/python{}'.format(get_python_version())'
|
||||
|
||||
#Make sure we're using gcc.
|
||||
os.environ["CC"] = "g++"
|
||||
os.environ["CXX"] = "g++"
|
||||
|
||||
cpp_args = ['-fopenmp', '-std=gnu++14', '-O3']
|
||||
link_args = ['-fopenmp']
|
||||
|
||||
|
|
Loading…
Reference in New Issue