Part Six: Summarization Of Effects As Menu Commands

(sharing) In[152]:=

UnshareFrontEnd[]

In[153]:=

kBox = 1 ; kGaussian = 2 ; kHighpass = 3 ; kUnsharp = 4 ; kSmoothing = 5 ; kLaplacianOfGaussian = 6 ;  (* *) kThreshold = 7 ; (* *) kReplicateScale = 8 ; kAreaAveragingScale = 9 ;

Functions of the effect which takes the image data and returns the result image data.

In[153]:=

ApplyBoxFilter[tid_] := DiscreteConvolve[tid, BoxFilter[10, 10], Centered -> True]

In[154]:=

ApplyGaussianFilter[tid_] := DiscreteConvolve[tid, GaussianFilter[10, 10], Centered -> True]

In[155]:=

ApplyHighpassFilter[tid_] := DiscreteConvolve[tid, HighpassFilter[10, 10], Centered -> True]

In[156]:=

ApplyUnsharpFilter[tid_] := DiscreteConvolve[tid, UnsharpFilter[10, 10], Centered -> True]

In[157]:=

ApplySmoothingFilter[tid_] := DiscreteConvolve[tid, SmoothingFilter[15, 7, 15, 7], Centered -> True]

In[158]:=

ApplyLaplacianOfGaussianFilter[tid_] := DiscreteConvolve[tid, LoGFilter[15, 15], Centered -> True]

In[159]:=

ApplyThresholdProcess[tid_, roi_, val_] := RegionProcessing[Threshold[#1, val, {0, 255}] &, tid, roi]

Functions of the effect which takes the java image and returns the result java image.

In[160]:=

CropImage[producer_, srcImg_, x_, y_, w_, h_, throwawaysrc_: False] := Module[ {filter, dstImg ... ,  srcImg @ getSource[],  filter] ] ;  If[throwawaysrc, ReleaseObject[srcImg]] ;  Return[dstImg] ]

In[161]:=

ReplicateScale[producer_, srcImg_, newWidth_, newHeight_, throwawaysrc_: False] := Module[ {fi ...  srcImg @ getSource[],  filter] ] ;  If[throwawaysrc, ReleaseObject[srcImg] ;] ;  Return[dstImg] ]

In[162]:=

AreaAveragingScale[producer_, srcImg_, newWidth_, newHeight_, throwawaysrc_: False] := Module[ ...  srcImg @ getSource[],  filter] ] ;  If[throwawaysrc, ReleaseObject[srcImg] ;] ;  Return[dstImg] ]

In[163]:=

LoadClass["java.awt.Toolkit"] ;

In[164]:=

ApplyJavaReplicateScaleFilter[src_, bnd_, scaleX_: 2, scaleY_: 2] := Module[ {tk, crop, result ... urn[Null]] ;  ReplicateScale[tk, crop, Round[scaleX * bnd[[3]]], Round[scaleY * bnd[[4]]], True] ]

In[165]:=

ApplyJavaAreaAveragingScaleFilter[src_, bnd_] := Module[ {tk, crop, result},  tk = java`awt`To ...  Null, Return[Null]] ;  AreaAveragingScale[tk, crop, Round[bnd[[3]]/2], Round[bnd[[4]]/2], True] ]

In[166]:=

GetROIBounds[frame_] := JavaBlock[Module[ {rct, panel},  rct = GetMarqueeBounds[frame] ;  If[r ...  Null && rct[[3]] > 0 && rct[[4]] > 0,  Return[rct] ; ] ] ;  Return[Null] ]]

In[167]:=

GetROIBoundsImageData[frame_] := JavaBlock[Module[ {imgData = Null, rct, panel},  rct = GetMar ... mp; rct[[4]] > 0,  imgData = GetAreaSelectionBoundsImageData[frame] ; ] ] ;  Return[imgData] ]]

•ROIBounds Filter
•Threshold
•ProcessEffect

•Menu Commands


Converted by Mathematica  (July 17, 2003)