/* * Copyright (c) 2000, University of Amsterdam, The Netherlands. * All rights reserved. * * Author(s): * Marc Navarro (mnavarro@wins.uva.nl) * Dennis Koelma (koelma@wins.uva.nl) */ #include "HxAdd.h" HxImageRep HxAdd(HxImageRep im1, HxImageRep im2) { return im1.binaryPixOp(im2, "add"); }
As shown in the code, HxAdd is just a wrapper around the generic binary pixel operation. For an example of how to use a global function in a C++ application see A first application.
MidApp
HxAdd can also be used via the menu and dialogue interface:
We can also execute the generic binary pixel operation directly:
Addition of images is demonstrated in demoAdd.cs
# Demo: shows how to add Horus images println("Enter name of first image, e.g. c:/images/trui.tif"); name = getline(); println("Read image from disk"); a = OPS.HxMakeFromFile(name); println("Enter name of second image, e.g. c:/images/cermet.tif"); name = getline(); println("Read image from disk"); b = OPS.HxMakeFromFile(name); println("Now add the images using the global function HxAdd"); c = OPS.HxAdd(a, b); println("Now add the images using the generic function"); d = a.binaryPixOp(b, "add", CTOR.emptyTagList());
and executed with exec("x:/HxSamples/Scripts/demoAdd.cs");
.
Matlab
Addition of images is demonstrated in demoAdd.m
%demoAdd Demo: shows how to add Horus images echo on clc name = input('Enter name of first image, e.g. c:/images/trui.tif\n', 's'); % Read image from disk a = OPS.HxMakeFromFile(name); % Display the image hxShow(a); name = input('Enter name of second image, e.g. c:/images/cermet.tif\n', 's'); % Read image from disk b = OPS.HxMakeFromFile(name); % And display it hxShow(b); pause % Press any key to continue % Now add the images using the global function HxAdd c = OPS.HxAdd(a, b); % And display it hxShow(c); pause % Press any key to continue % Now add the images using the generic function d = a.binaryPixOp(b, 'add', CTOR.emptyTagList); % And display it hxShow(c);
and executed with demoAdd
.