Skip to content

Instantly share code, notes, and snippets.

This file has been truncated, but you can view the full file.
@jedypod
jedypod / SummedAreaTable.cpp
Last active October 19, 2020 20:10
Perform a spatially varying box blur based on an input map. Box blur only for the moment. Uses a summed area table.
/* Create a summed area table in one direction, based on an input image.
In order to create a 2-dimensional summed area table,
you need two copies of the node, the 2nd with col=true
Currently there are issues with precision for higher resolution images...
*/
kernel SummedAreaTable : ImageComputationKernel<eComponentWise> {
Image<eRead, eAccessRandom, eEdgeConstant> src;
Image<eReadWrite, eAccessRandom> dst;
@jedypod
jedypod / BoxBlur.cpp
Created October 19, 2020 20:04
Perform a multiple iteration box blur on the input image. Works in a single dimension so 2 copies are needed for a 2 dimensional blur.
/* Perform a horizontal or vertical Box Blur
Can perform multiple iterations in order to approximate a Gaussian Blur.
*/
kernel BoxBlur : ImageComputationKernel<eComponentWise> {
Image<eRead, eAccessRandom, eEdgeClamped> src;
Image<eReadWrite, eAccessRandom, eEdgeClamped> dst;
param:
float2 size; // blur size
int iterations; // number of iterations to perform
@jedypod
jedypod / Distort.cpp
Created October 19, 2020 19:59
Distorts an input image based on an input uv map or vector map.
kernel Distort : ImageComputationKernel<ePixelWise> {
Image<eRead, eAccessRandom, eEdgeClamped> in;
Image<eRead, eAccessPoint, eEdgeClamped> uv;
Image<eWrite, eAccessPoint> out;
param:
bool stmap;
bool enable_blur;
float blur_size;
int blur_samples;
@jedypod
jedypod / Transform.cpp
Last active October 23, 2023 09:21
Nuke blinkscript implementation of a simple image Transform operator. This blinkscript demonstrates pixel filter interpolation algorithms.
/*
Nuke blinkscript implementation of a simple image Transform operator.
Demonstrates pixel filter interpolation algorithms.
The following pixel filters are implemented:
0 - Blackman-Harris : Similar to cubic, but better performance in high frequencies
1 - Lanczos4 : 2x2 lanczos windowed sinc function
2 - Lanczos6 : 3x3 lanczos windowed sinc function
3 - Cubic : (Bicubic interpolation) - a=0.0, b=0.0
4 - Mitchell : (Bicubic interpolation) - a=1/3, b=1/3
@jedypod
jedypod / opusencdir
Created August 2, 2020 21:17
opusencdir is a Python tool to recursively encode contents of source directory into Opus audio files.
#!/usr/bin/python3
import os, sys, re, shutil
import logging
import threading
import concurrent.futures
import multiprocessing
import argparse, shlex
@jedypod
jedypod / menu.py
Created May 11, 2020 03:32 — forked from dbr/menu.py
Alternative viewer connection shorcuts - alt+1..9 connect viewer, 1..9 only switch viewer
def viewer_shotcuts_alt():
# Alt+1, Alt+2 etc to connect node to viewer
for n in range(9):
def connect_viewer(n=n):
selection = nuke.selectedNodes()
nuke.connectViewer(n, nuke.selectedNode())
[node.setSelected(False) for node in nuke.selectedNodes()]
[node.setSelected(True) for node in selection]
nuke.menu("Node Graph").addMenu("ViewerThing").addCommand(
@jedypod
jedypod / nuke_viewer_shortcut_intercept.py
Created May 11, 2020 03:26 — forked from dbr/nuke_viewer_shortcut_intercept.py
Test of finding Nuke's viewer widget, and intercepting the hardwired "c" shortcut and rewiring it to view the RGB channel
"""Test of finding Nuke's viewer widget, and intercepting the hardwired "c" shortcut and rewiring it to view the RGB channel
"""
from PySide import QtGui, QtCore
def findviewer():
stack = QtGui.QApplication.topLevelWidgets()
viewers = []
while stack:
@jedypod
jedypod / custom_ui_docked.py
Created April 22, 2020 18:55 — forked from fredrikaverpil/custom_ui_docked.py
Create custom PySide GUI and dock it into Nuke UI
import PySide.QtCore as QtCore
import PySide.QtGui as QtGui
from nukescripts import panels
class PanelTest(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setLayout(QtGui.QVBoxLayout())
self.myTable = QtGui.QTableWidget()
self.myTable.header = ['Date', 'Files', 'Size', 'Path' ]
@jedypod
jedypod / GamutCompression_blinkscript.cpp
Last active August 29, 2024 13:48
Jed Smith Gamut Compression Development
kernel GamutCompression : ImageComputationKernel<ePixelWise> {
Image<eRead, eAccessPoint, eEdgeClamped> src;
Image<eWrite> dst;
param:
float threshold;
float cyan;
float magenta;
float yellow;
int method;