In [1]:
//!apt-get install freeglut3-dev
//!apt-get install mesa-common-dev
%install-location $cwd/swift-install
%install '.package(path: "$cwd/../../")' GPUImage
//%install '.package(url: "https://github.com/BradLarson/GPUImage2", from: "0.0.1")' GPUImage


Installing packages:
	.package(path: "/home/larson/Development/GPUImage2/examples/Linux-OpenGL/../../")
		GPUImage
With SwiftPM flags: []
Working in: /tmp/tmp2709astp/swift-install
warning: you may be able to install libv4l-dev using your system-packager:
     apt-get install libv4l-dev

warning: you may be able to install freeglut3-dev using your system-packager:
     apt-get install freeglut3-dev

warning: you may be able to install mesa-commmon-dev using your system-packager:
     apt-get install mesa-common-dev

Compile Swift Module 'GPUImage' (149 sources)
Compile Swift Module 'jupyterInstalledPackages' (1 sources)
Linking ./.build/x86_64-unknown-linux/debug/libjupyterInstalledPackages.so
Initializing Swift...
Installation complete!

In [2]:
import GPUImage
import Foundation

In [3]:
import Python
%include "EnableIPythonDisplay.swift"
let pythonDisplay = Python.import("IPython.display")

The OpenGL context is owned by GLUT, so you have to create a blank offscreen render window for now.


In [4]:
let renderWindow = GLUTRenderWindow()

In [5]:
let pictureInput = PictureInput(path: "../SharedAssets/Lambeau.jpg")!
pythonDisplay.Image(filename: "../SharedAssets/Lambeau.jpg", width: 640, height: 480).display()


Framebuffer created

In [6]:
let edgeDetection = SobelEdgeDetection()
let pictureOutput = PictureOutput()

In [7]:
pictureInput.removeAllTargets()
edgeDetection.removeAllTargets()
pictureInput --> edgeDetection --> pictureOutput

pictureOutput.saveNextFrameToPath("./test.png", format:.png)

pictureInput.processImage(synchronously: true)


Generating new framebuffer at size: GLSize(width: 2000, height: 1494) --> FramebufferCache.swift: requestFramebufferWithProperties(orientation:size:textureOnly:minFilter:magFilter:wrapS:wrapT:internalFormat:format:type:stencil:): 36
Generating new framebuffer at size: GLSize(width: 2000, height: 1494) --> FramebufferCache.swift: requestFramebufferWithProperties(orientation:size:textureOnly:minFilter:magFilter:wrapS:wrapT:internalFormat:format:type:stencil:): 36

In [8]:
pythonDisplay.Image(filename:"./test.png", width: 640, height: 480).display()



In [ ]: