INTERFACE FeatureMapper2D; IMPORT Texture2DGray AS Tx; IMPORT Wr; TYPE LONG = LONGREAL; LONGS = ARRAY OF LONG; NAT = CARDINAL; INT = INTEGER; BOOL = BOOLEAN; Nhood = Tx.PixelNeighborhood; (* A 3x3 pixel neighborhood. *) CoNhood = Nhood; (* Derivatives OF something relto a neighborhood. *) Nhoods = ARRAY OF Nhood; (* A stack of pixel nhoods in different layers *) CoNhoods = Nhoods; (* Derivatives relto a stack of pixel nhoods. *) Features = ARRAY OF LONG; (* A set of local features. *) CoFeatures = Features; (* Derivatives relto a set of features. *) TYPE T = OBJECT NL: NAT; (* Number of input components (layers) *) NF: NAT; (* Number of local features produced *) METHODS print(wr: Wr.T); (* Prints a description of the mapper to "wr". *) eval(READONLY n: Nhoods; VAR t: Features); (* Computes the local features "t[i]" from the multi-layer neighborhood "n". *) diff( READONLY dEdf: CoFeatures; READONLY f: Features; READONLY n: Nhoods; VAR dEdn: CoNhoods; ); (* Returns in "dEdn" the derivative of some function "E" relative to each pixel in the neighborhood "n", given the derivatives "dEdf" of "E" relative to the local features "f" that were extracted by "eval" from that same neighborhood. *) defined(READONLY m: Nhood): BOOLEAN; (* The neighborhood "n" is assumed to be a ``mask'' that tells which pixels in some other neighborhood "n" are defined ("1") or undefined ("0"). The "defined" method will return TRUE if the pixels of "n" used by "eval(n, f)" are all defined; that is, if the corresponding pixels of "m" are all "1". *) END; TYPE SpaceDerivatives = RECORD f: LONG; fx, fy: LONG; fxx, fxy, fyy: LONG; END; CoSpaceDerivatives = SpaceDerivatives; (* Derivatives relto the SpaceDerivatives. *) PROCEDURE EvalSpaceDerivatives(READONLY n: Nhood): SpaceDerivatives; (* Computes the spatial SpaceDerivatives of an image at a pixel center, from the pixel's 3x3 neighborhood. *) PROCEDURE DiffSpaceDerivatives(READONLY dEdD: CoSpaceDerivatives; VAR dEdn: CoNhood); (* Returns in "dEdn" the derivative of some function "E" relative to each pixel in the neighborhood "n", given the derivatives "dEdD" of "E" relative to the spatial derivatives of "f". *) END FeatureMapper2D.