|
nexuslua
|
The nexuslua function poke writes an integer to a memory address. It accepts 3 parameters:
This code from agent acrion image_tools calls the poke function to write the resulting pixel value to its memory address.
function CallSubtractLeftRightLua(parameters)
local size = parameters.width * parameters.height * parameters.channels
local depth = parameters.depth
local workingImage = touserdata(parameters.workingImage)
local referenceImage = touserdata(parameters.referenceImage)
for i=0,size do
local addressRight = addoffset(workingImage, i, depth)
local addressLeft = addoffset(referenceImage, i, depth)
local val = peek(addressLeft, depth) - peek(addressRight, depth)
poke(addressRight, val, depth)
end
return {}
end
The pixel value is the mathematical difference between the pixel values in two images. This function is directly used as an nexuslua message than can be sent via send. To allow this, it needs to be registered first, see the second example in addmessage.