![]() The Lua variable decreaseBrightness now contains a description of an image processing pipeline. The ] casts the output to a format that our image saving library supports (24 bit color). It is similar to Lua’s function definition syntax, but unlike Lua the last expression is the return value. The keyword im indicates that we are creating an image function. Let’s start by writing an image function that decreases the brightness of the input by 10%: im decreaseBrightness(x,y) Describing an image processing pipeline will consist of writing a number of these ‘image functions’. ![]() You can also create ‘image functions’ that perform calculations to compute an image. DarkroomSimple provides a function that will load simple image formats (bmp, ppm): inputImage = darkroomSimple.load("examples/color.bmp") import "darkroom"ĭarkroomSimple = terralib.require("darkroomSimple")īefore we can perform any image processing, we need to load an input image. The darkroomSimple library provides convenience functions for loading and saving images - we will use it for now to make these examples cleaner. Recall that you need to include Darkroom with ‘import “darkroom”’. For now, run these commands from inside the darkroom directory. Darkroom is not supported in the Terra REPL. Run this tutorial by creating and running a. Lua is a simple language - the Programming in Lua tutorial provides a quick introduction. While it is possible to write Darkroom code without being familiar with Lua, knowing the basics of Lua will make Darkroom easier to understand and allow you to write more powerful programs. Darkroom uses a right-handed coordinate system, with files loaded from disk resting on the XY axis by default:ĭarkroom is embedded in Lua. In Darkroom, images are represented as functions from integer (x,y) coordinates to pixel values. And then examine the resulting images in darkroom/tests/out and make sure they look correct. Which should write darkroom/examples/out/campipe.bmp.ĭarkroom also contains a test suite which you can run to make sure there isn’t any strangeness on your platform: cd darkroom/testsĪll tests should complete without errors. Running Darkroomĭarkroom includes a number of example image processing pipelines that can be used to test that Darkroom is correctly installed. ?.t $DR/?.t $DR/src/?.t $DR/extras/?.t $TERRADIR/tests/lib/?.t"ĭarkroom and Terra are tested to work on Linux and Mac OS X. bashrc: export DR=Įxport TERRA_PATH="$TERRA_PATH. Run the REPL and make sure it installed correctly.Īdd the Darkroom language definition to your lua path environment variable. Installationįirst you will need to clone and build Terra using the instructions in the Terra Readme. James Hegarty is a language for describing image processing pipelines embedded in Terra. Theme by orderedlist Getting Started with Darkroom
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |