← Home About Archive Photos Replies Search Also on Micro.blog
  • Visualising 2D Linear Transformations in Python

    I have been trying to get my head around the application of matrices in colour space transforms. As a learning exercise I thought it would be simpler to loose a dimension and plot the results on a 2D graph. The code is not mine, but I have been tinkering with it to get different results.

    import numpy as np
    import matplotlib as mpl
    import matplotlib.pyplot as plt
    
    xvals = np.linspace(-4, 4, 9)
    yvals = np.linspace(-3, 3, 7)
    xygrid = np.column_stack([[x,y] for x in xvals for y in yvals])
    
    a = np.column_stack([[0, 1], [1, 0]])
    print(a)
    uvgrid = np.dot(a, xygrid)
    

    Matrix: (0 1, 1 0) is a permutation matrix in which each row contains one entry of 1 and 0’s elsewhere. The effect of which changes the order of each element in the dataset.

    def colourizer(x, y):
        r = min(1, 1-y/3)
        g = min(1, 1+y/3)
        b = 1/4 + x/16
        return (r, g, b)
    
    colours = list(map(colourizer, xygrid[0], xygrid[1]))
    
    plt.figure(figsize=(4,4), facecolor="w")
    plt.scatter(xygrid[0], xygrid[1], s=36, c=colours, edgecolor="none")
    plt.grid(True)
    plt.axis("equal")
    plt.title=("Original grid in x-y space")
    

    Here is our starting grid of equal spaced points

    plt.figure(figsize=(4,4), facecolor="w")
    plt.scatter(uvgrid[0], uvgrid[1], s=36, c=colours, edgecolor="none")
    plt.grid(True)
    plt.axis("equal")
    

    We apply out transformation matrix to the grid and re-plot the result. As you can see the permutation transformation has taken place.

    Application to colour

    The above example is a simplified demonstration of how colour transformation matrices work. These are often 3x3 matrices and are applied to the 3D colour cube axis XYZ each representing RGB. When the vector is applied the resulting 3D cube is scaled to meet the bounds of the transform.

    There is more to learn about this subject, I hope to be able to modify this code or use it as a starting point to develop my own version that visualizes 3D linear transformations. Another topic that I am also keen to study is interpolation and how it is applied in colour science, particularly it’s use in 3D look up tables.

    → 6:17 PM, Jan 18
  • Sigmoid Functions in Lattice

    I have been playing around with logistic functions in Lattice to create contrast curves in 1D/3D LUT’s.

    A logistic function is a common s-shaped curve. When applied to a log encoded image it simulates a contrast curve. The curve can be encoded into 1D or 3D LUT’s for application in video editing software and image processing.

    When the above function is applied in Lattice the following result is achieved:

    To learn more or play around yourself, find Lattice here:

    https://videovillage.co/lattice/

    → 8:33 PM, Aug 11
  • Yubikey for 2FA

    I recently got hold of a couple of Yubikeys as an additional security measure. These are small devices that are plugged into computers or phones/tables and act as a physical 2FA method, some models can even be purchased with NFC capability.

    So far the experience has been pretty good, most services I use have worked well with the security key and the process of using it is pretty simple. Plug in when prompted, touch the button and you’re good to go. The only account that I found tricky to work with was Microsoft 365 for business, for some reason I couldn’t find the security key settings in my account management panel.

    Having this system set up for a while now, I wondered if it would be possible to set up a little security key server on my local network. The server could be a raspberry pi, and the key would be plugged into its USB port permanently. The USB port would then be shared over the local network with USB over IP. This way all computers connected over the local network can share the same security key. As opposed to having to unplug and move it to and from each computer I am working on at the time.

    Think I will come back to this in the future to see if I can work something out, more to follow.

    → 9:54 PM, Jul 31
  • Neural Networks for Colour Transformations 💻

    A while ago; I explored the possibility of using neural networks to calculate colour transforms. My hypothesis was that a trained model would be able to apply a more accurate colour transform in a shorter amount of time compared to an equivalent 64x LUT.

    I started tinkering around with Python and Tensorflow and had some promising results, but quickly found that I lacked the time and the computing power to train the models properly. As a result of this, it was tricky to get results good enough that would have made it worth exploring the project further.

    Although using neural networks for colour transformations is probably impractical in professional applications. I am still keen to chip away at this as a personal research project when I have time.

    → 10:08 PM, Jul 28
  • Croc File Sharing Utility 💻

    Recently I came across a great tool for quickly sharing files across a network, croc. The tool works in the command line and allows two users to transfer data between two computers using a relay, data is encrypted using PAKE.

    What is really useful is transfers can be resumed if they are interrupted.

    I have been using this on a number of film production projects to quickly send pdfs and cdl’s with on-set colour decisions to our data management workstation which is operated off set. Generally the tool works well, and is much quicker than email or using a usb stick. However we have noticed that with larger transfers the utility does become less reliable, with transfers often freezing. We did get around this by using a self hosted docker image to host our own relay.

    The croc utility is easy to install with the following command:

    curl https://getcroc.schollz.com | bash
    

    Which will download the correct version for your system. On macOS you can install the latest release with HomeBrew

    brew install croc
    
    → 4:08 PM, Jul 28
  • RSS
  • JSON Feed
  • Micro.blog