1010import com .github .javaparser .ast .type .PrimitiveType ;
1111import edu .wpi .gripgenerator .defaults .DefaultValueCollector ;
1212import edu .wpi .gripgenerator .defaults .EnumDefaultValue ;
13- import edu .wpi .gripgenerator .defaults .ObjectDefaultValue ;
1413import edu .wpi .gripgenerator .defaults .PrimitiveDefaultValue ;
15- import edu .wpi .gripgenerator .settings .DefinedMethod ;
16- import edu .wpi .gripgenerator .settings .DefinedMethodCollection ;
17- import edu .wpi .gripgenerator .settings .DefinedParamType ;
1814import edu .wpi .gripgenerator .templates .OperationList ;
1915
2016import java .io .ByteArrayInputStream ;
@@ -113,9 +109,6 @@ public Expression getDefaultValue(String defaultValue) {
113109 returnMap .putAll (parseOpenImgprc (compilationUnit , collector , operationList ));
114110
115111 }
116-
117- // Generate the Operation List class last
118- returnMap .put (operationList .getClassName (), operationList .getDeclaration ());
119112 return returnMap ;
120113 }
121114
@@ -126,70 +119,6 @@ public static Map<String, CompilationUnit> parseOpenImgprc(CompilationUnit imgpr
126119 OpenCVEnumVisitor enumVisitor = new OpenCVEnumVisitor (baseClassName , collector );
127120 enumVisitor .visit (imgprocDeclaration , compilationUnits );
128121 compilationUnits .putAll (enumVisitor .generateCompilationUnits ());
129-
130- DefinedMethodCollection collection = new DefinedMethodCollection (baseClassName ,
131- new DefinedMethod ("Sobel" , false , "Mat" , "Mat"
132- ).addDescription ("Find edges by calculating the requested derivative order for the given image." ),
133- new DefinedMethod ("medianBlur" , false , "Mat" , "Mat"
134- ).addDescription ("Apply a Median blur to an image." ),
135- new DefinedMethod ("GaussianBlur" , false ,
136- new DefinedParamType ("Mat" ),
137- new DefinedParamType ("Mat" ),
138- new DefinedParamType ("Size" ).setDefaultValue (new ObjectDefaultValue ("Size" , "1" , "1" ))
139- ).addDescription ("Apply a Gaussian blur to an image." ),
140- new DefinedMethod ("Laplacian" , "Mat" , "Mat"
141- ).addDescription ("Find edges by calculating the Laplacian for the given image." ),
142- new DefinedMethod ("dilate" , false ,
143- new DefinedParamType ("Mat" ),
144- new DefinedParamType ("Mat" ),
145- new DefinedParamType ("Mat" ).setDefaultValue (new ObjectDefaultValue ("Mat" ))
146- ).addDescription ("Expands areas of higher values in an image." ),
147- new DefinedMethod ("Canny" , false ,
148- new DefinedParamType ("Mat" ),
149- new DefinedParamType ("Mat" , DefinedParamType .DefinedParamDirection .OUTPUT )
150- ).addDescription ("Apply a \\ \" canny edge detection\\ \" algorithm to an image." ),
151- new DefinedMethod ("threshold" , false ,
152- new DefinedParamType ("Mat" ),
153- new DefinedParamType ("Mat" ),
154- new DefinedParamType ("double" ),
155- new DefinedParamType ("double" ),
156- new DefinedParamType ("int" ).setLiteralDefaultValue ("THRESH_BINARY" )
157- ).addDescription ("Apply a fixed-level threshold to each array element in an image." ),
158- new DefinedMethod ("adaptiveThreshold" , false ,
159- new DefinedParamType ("Mat" ),
160- new DefinedParamType ("Mat" ),
161- new DefinedParamType ("double" ),
162- new DefinedParamType ("int" ).setLiteralDefaultValue ("ADAPTIVE_THRESH_MEAN_C" ),
163- new DefinedParamType ("int" ).setLiteralDefaultValue ("THRESH_BINARY" )
164- ).addDescription ("Transforms a grayscale image to a binary image)." ),
165- new DefinedMethod ("erode" , false ,
166- new DefinedParamType ("Mat" ),
167- new DefinedParamType ("Mat" ),
168- new DefinedParamType ("Mat" ).setDefaultValue (new ObjectDefaultValue ("Mat" ))
169- ).addDescription ("Expands areas of lower values in an image." ),
170- new DefinedMethod ("cvtColor" , false ,
171- new DefinedParamType ("Mat" ),
172- new DefinedParamType ("Mat" ),
173- new DefinedParamType ("int" ).setLiteralDefaultValue ("COLOR_BGR2BGRA" )
174- ).addDescription ("Convert an image from one color space to another." ),
175- new DefinedMethod ("applyColorMap" , true ,
176- new DefinedParamType ("Mat" ),
177- new DefinedParamType ("Mat" ),
178- new DefinedParamType ("int" ).setLiteralDefaultValue ("COLORMAP_AUTUMN" )
179- ).addDescription ("Apply a MATLAB equivalent colormap to an image." ),
180- new DefinedMethod ("resize" , false ,
181- new DefinedParamType ("Mat" ),
182- new DefinedParamType ("Mat" ),
183- new DefinedParamType ("Size" ).setDefaultValue (new ObjectDefaultValue ("Size" ))
184- ).addDescription ("Resize the image to the specified size." ),
185- new DefinedMethod ("rectangle" , false ,
186- new DefinedParamType ("Mat" , DefinedParamType .DefinedParamDirection .INPUT_AND_OUTPUT ),
187- new DefinedParamType ("Point" )
188- ).addDescription ("Draw a rectangle (outline or filled) on an image." )
189- ).setDirectionDefaults (DefinedParamType .DefinedParamDirection .OUTPUT , "dst" )
190- .setIgnoreDefaults ("dtype" , "ddepth" );
191- new OpenCVMethodVisitor (collection ).visit (imgprocDeclaration , compilationUnits );
192- collection .generateCompilationUnits (collector , compilationUnits , operations );
193122 return compilationUnits ;
194123 }
195124
@@ -201,62 +130,6 @@ public static Map<String, CompilationUnit> parseOpenCVCore(CompilationUnit coreD
201130 enumVisitor .visit (coreDeclaration , compilationUnits );
202131 compilationUnits .putAll (enumVisitor .generateCompilationUnits ());
203132
204- DefinedMethodCollection collection = new DefinedMethodCollection (baseClassName ,
205- new DefinedMethod ("add" , true , "Mat" , "Mat" , "Mat" )
206- .addDescription ("Calculate the per-pixel sum of two images." ),
207- new DefinedMethod ("subtract" , true , "Mat" , "Mat" , "Mat" )
208- .addDescription ("Calculate the per-pixel difference between two images." ),
209- new DefinedMethod ("multiply" , false , "Mat" , "Mat" , "Mat" )
210- .addDescription ("Calculate the per-pixel scaled product of two images." ),
211- new DefinedMethod ("divide" , false , "Mat" , "Mat" , "Mat" )
212- .addDescription ("Perform per-pixel division of two images." ),
213- new DefinedMethod ("scaleAdd" , false , "Mat" , "double" , "Mat" , "Mat" )
214- .addDescription ("Calculate the sum of two images where one image is multiplied by a scalar." ),
215- // new DefinedMethod("normalize", false, "Mat", "Mat"),
216- new DefinedMethod ("addWeighted" , false , "Mat" )
217- .addDescription ("Calculate the weighted sum of two images." ),
218- new DefinedMethod ("flip" , false ,
219- new DefinedParamType ("Mat" ),
220- new DefinedParamType ("Mat" ),
221- new DefinedParamType ("int" ).setLiteralDefaultValue ("Y_AXIS" ))
222- .addDescription ("Flip image around vertical, horizontal, or both axes." ),
223- new DefinedMethod ("bitwise_and" , true , "Mat" , "Mat" , "Mat" )
224- .addDescription ("Calculate the per-element bitwise conjunction of two images." ),
225- new DefinedMethod ("bitwise_or" , true , "Mat" , "Mat" , "Mat" )
226- .addDescription ("Calculate the per-element bit-wise disjunction of two images." ),
227- new DefinedMethod ("bitwise_xor" , true , "Mat" , "Mat" , "Mat" )
228- .addDescription ("Calculate the per-element bit-wise \\ \" exclusive or\\ \" on two images." ),
229- new DefinedMethod ("bitwise_not" , true , "Mat" , "Mat" )
230- .addDescription ("Calculate per-element bit-wise inversion of an image." ),
231- new DefinedMethod ("absdiff" , false , "Mat" , "Mat" )
232- .addDescription ("Calculate the per-element absolute difference of two images." ),
233- new DefinedMethod ("compare" , true ,
234- new DefinedParamType ("Mat" ),
235- new DefinedParamType ("Mat" ),
236- new DefinedParamType ("Mat" ),
237- new DefinedParamType ("int" ).setLiteralDefaultValue ("CMP_EQ" )
238- ).addDescription ("Compare each pixel in two images using a given rule." ),
239- new DefinedMethod ("max" , false , "Mat" , "Mat" )
240- .addDescription ("Calculate per-element maximum of two images." ),
241- new DefinedMethod ("min" , false , "Mat" , "Mat" )
242- .addDescription ("Calculate the per-element minimum of two images." ),
243- new DefinedMethod ("extractChannel" , false , "Mat" , "Mat" )
244- .addDescription ("Extract a single channel from a image." ),
245- new DefinedMethod ("transpose" , false , "Mat" , "Mat" )
246- .addDescription ("Calculate the transpose of an image." )
247- // new DefinedMethod("sqrt", false, "Mat", "Mat"),
248- // new DefinedMethod("pow", false,
249- // new DefinedParamType("Mat"),
250- // new DefinedParamType("double")
251- // .setDefaultValue(new PrimitiveDefaultValue(new PrimitiveType(PrimitiveType.Primitive.Double), "1"))
252- // )
253- ).setDirectionDefaults (DefinedParamType .DefinedParamDirection .OUTPUT , "dst" )
254- .setIgnoreDefaults ("dtype" , "ddepth" );
255- new OpenCVMethodVisitor (collection ).visit (coreDeclaration , compilationUnits );
256-
257- collection .generateCompilationUnits (collector , compilationUnits , operations );
258-
259-
260133 return compilationUnits ;
261134 }
262135
0 commit comments