Commit 4d31cd96 authored by Ahmed's avatar Ahmed

add findContours command

parent 779f4aa1
......@@ -125,7 +125,11 @@ public class LanguageUnitCPP extends LanguageUnit {
resultString += "#include \"" + string + ".h\"\n";
for(String string: bluePrint.getCVIncludeStrings())
resultString += "#include \"" + string + ".hpp\"\n";
if(string.contains("vector")){
resultString += "#include <" + string +">\n";
}else {
resultString += "#include \"" + string + ".hpp\"\n";
}
if (generatorCPP.isExecutionLoggingActive)
resultString += "#include <fstream>\n";
......
......@@ -19,7 +19,7 @@ import java.util.List;
* @author Ahmed Diab
*/
public class FindContoursCommand extends MathCommand{
public class FindContoursCommand extends ArgumentReturnMathCommand{
public FindContoursCommand() {
setMathCommandName("findContours");
}
......@@ -52,6 +52,7 @@ public class FindContoursCommand extends MathCommand{
mathMatrixNameExpressionSymbol.getMathMatrixAccessOperatorSymbol().setMathMatrixAccessSymbols(newMatrixAccessSymbols);
((BluePrintCPP) bluePrint).addCVIncludeString("opencv2/imgproc");
((BluePrintCPP) bluePrint).addCVIncludeString("vector");
}
}
......@@ -5,17 +5,26 @@
#endif
#include "armadillo"
#include "opencv2/imgproc.hpp"
#include <vector>
using namespace arma;
using namespace cv;
class test_math_findContoursCommandTest{
public:
mat image;
int mode;
int method;
mat hierarchy;
mat contours;
void init()
{
image=mat(n,m);
hierarchy=mat(x,y);
contours=mat(w,z);
}
void execute()
{
double a = (findContours(0, 0, 0, 0, 0));
findContours(image, contours, hierarchy, mode, method);
}
};
#endif
#endif
\ No newline at end of file
......@@ -2,7 +2,14 @@
package test.math;
component FindContoursCommandTest{
implementation Math{
Q a = findContours(0,0,0,0,0);
port
in Q^{n,m} image,
in Z mode,
in Z method,
out Q^{x,y} hierarchy,
out Q^{w,z} contours;
implementation Math {
contours = findContours(image, hierarchy, mode, method);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment