Commit 7b32d2d4 authored by Ahmed's avatar Ahmed

delete not needed files

parent 0668b1cc
......@@ -59,14 +59,10 @@ public class MathCommandRegisterCPP extends MathCommandRegister {
registerMathCommand(new ErodeCommand());
registerMathCommand(new DilateCommand());
registerMathCommand(new BoundingRectCommand());
registerMathCommand(new CircleCommand());
registerMathCommand(new CvtColorCommand());
registerMathCommand(new DrawContoursCommand());
registerMathCommand(new FindContoursCommand());
registerMathCommand(new GaussianBlurCommand());
registerMathCommand(new InRangeCommand());
registerMathCommand(new PutTextCommand());
registerMathCommand(new ThresholdCommand());
registerMathCommand(new LargestContourCommand());
registerMathCommand(new RectangleCommand());
......
package de.monticore.lang.monticar.generator.cpp.commands;
import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixAccessSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol;
import de.monticore.lang.monticar.generator.BluePrint;
import de.monticore.lang.monticar.generator.MathCommand;
import de.monticore.lang.monticar.generator.cpp.BluePrintCPP;
import de.monticore.lang.monticar.generator.cpp.MathFunctionFixer;
import de.monticore.lang.monticar.generator.cpp.converter.ExecuteMethodGenerator;
import de.monticore.lang.monticar.generator.cpp.converter.MathConverter;
import de.monticore.lang.monticar.generator.cpp.symbols.MathStringExpression;
import de.se_rwth.commons.logging.Log;
import java.util.ArrayList;
import java.util.List;
/**
* @author Ahmed Diab
*/
public class CircleCommand extends MathCommand{
public CircleCommand() {
setMathCommandName("circle");
}
@Override
public void convert(MathExpressionSymbol mathExpressionSymbol, BluePrint bluePrint) {
String backendName = MathConverter.curBackend.getBackendName();
if (backendName.equals("OctaveBackend")) {
convertUsingOctaveBackend(mathExpressionSymbol, bluePrint);
} else if (backendName.equals("ArmadilloBackend")) {
convertUsingArmadilloBackend(mathExpressionSymbol, bluePrint);
}
}
public void convertUsingOctaveBackend(MathExpressionSymbol mathExpressionSymbol, BluePrint bluePrint) {
Log.error("No implementation for Octave Backend");
}
public void convertUsingArmadilloBackend(MathExpressionSymbol mathExpressionSymbol, BluePrint bluePrint) {
MathMatrixNameExpressionSymbol mathMatrixNameExpressionSymbol = (MathMatrixNameExpressionSymbol) mathExpressionSymbol;
mathMatrixNameExpressionSymbol.setNameToAccess("");
String valueListString = "";
for (MathMatrixAccessSymbol accessSymbol : mathMatrixNameExpressionSymbol.getMathMatrixAccessOperatorSymbol().getMathMatrixAccessSymbols())
MathFunctionFixer.fixMathFunctions(accessSymbol, (BluePrintCPP) bluePrint);
valueListString += ExecuteMethodGenerator.generateExecuteCode(mathExpressionSymbol, new ArrayList<String>());
List<MathMatrixAccessSymbol> newMatrixAccessSymbols = new ArrayList<>();
MathStringExpression stringExpression = new MathStringExpression("circle" + valueListString,mathMatrixNameExpressionSymbol.getMathMatrixAccessOperatorSymbol().getMathMatrixAccessSymbols());
newMatrixAccessSymbols.add(new MathMatrixAccessSymbol(stringExpression));
mathMatrixNameExpressionSymbol.getMathMatrixAccessOperatorSymbol().setMathMatrixAccessSymbols(newMatrixAccessSymbols);
((BluePrintCPP) bluePrint).addCVIncludeString("opencv2/imgproc");
}
}
package de.monticore.lang.monticar.generator.cpp.commands;
import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixAccessSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol;
import de.monticore.lang.monticar.generator.BluePrint;
import de.monticore.lang.monticar.generator.MathCommand;
import de.monticore.lang.monticar.generator.cpp.BluePrintCPP;
import de.monticore.lang.monticar.generator.cpp.MathFunctionFixer;
import de.monticore.lang.monticar.generator.cpp.converter.ExecuteMethodGenerator;
import de.monticore.lang.monticar.generator.cpp.converter.MathConverter;
import de.monticore.lang.monticar.generator.cpp.symbols.MathStringExpression;
import de.se_rwth.commons.logging.Log;
import java.util.ArrayList;
import java.util.List;
/**
* @author Ahmed Diab
*/
public class DrawContoursCommand extends MathCommand{
public DrawContoursCommand() {
setMathCommandName("drawContours");
}
@Override
public void convert(MathExpressionSymbol mathExpressionSymbol, BluePrint bluePrint) {
String backendName = MathConverter.curBackend.getBackendName();
if (backendName.equals("OctaveBackend")) {
convertUsingOctaveBackend(mathExpressionSymbol, bluePrint);
} else if (backendName.equals("ArmadilloBackend")) {
convertUsingArmadilloBackend(mathExpressionSymbol, bluePrint);
}
}
public void convertUsingOctaveBackend(MathExpressionSymbol mathExpressionSymbol, BluePrint bluePrint) {
Log.error("No implementation for Octave Backend");
}
public void convertUsingArmadilloBackend(MathExpressionSymbol mathExpressionSymbol, BluePrint bluePrint) {
MathMatrixNameExpressionSymbol mathMatrixNameExpressionSymbol = (MathMatrixNameExpressionSymbol) mathExpressionSymbol;
mathMatrixNameExpressionSymbol.setNameToAccess("");
String valueListString = "";
for (MathMatrixAccessSymbol accessSymbol : mathMatrixNameExpressionSymbol.getMathMatrixAccessOperatorSymbol().getMathMatrixAccessSymbols())
MathFunctionFixer.fixMathFunctions(accessSymbol, (BluePrintCPP) bluePrint);
valueListString += ExecuteMethodGenerator.generateExecuteCode(mathExpressionSymbol, new ArrayList<String>());
List<MathMatrixAccessSymbol> newMatrixAccessSymbols = new ArrayList<>();
MathStringExpression stringExpression = new MathStringExpression("drawContours" + valueListString,mathMatrixNameExpressionSymbol.getMathMatrixAccessOperatorSymbol().getMathMatrixAccessSymbols());
newMatrixAccessSymbols.add(new MathMatrixAccessSymbol(stringExpression));
mathMatrixNameExpressionSymbol.getMathMatrixAccessOperatorSymbol().setMathMatrixAccessSymbols(newMatrixAccessSymbols);
((BluePrintCPP) bluePrint).addCVIncludeString("opencv2/imgproc");
}
}
package de.monticore.lang.monticar.generator.cpp.commands;
import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixAccessSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol;
import de.monticore.lang.monticar.generator.BluePrint;
import de.monticore.lang.monticar.generator.MathCommand;
import de.monticore.lang.monticar.generator.cpp.BluePrintCPP;
import de.monticore.lang.monticar.generator.cpp.MathFunctionFixer;
import de.monticore.lang.monticar.generator.cpp.converter.ExecuteMethodGenerator;
import de.monticore.lang.monticar.generator.cpp.converter.MathConverter;
import de.monticore.lang.monticar.generator.cpp.symbols.MathStringExpression;
import de.se_rwth.commons.logging.Log;
import java.util.ArrayList;
import java.util.List;
/**
* @author Ahmed Diab
*/
public class PutTextCommand extends MathCommand{
public PutTextCommand() {
setMathCommandName("putText");
}
@Override
public void convert(MathExpressionSymbol mathExpressionSymbol, BluePrint bluePrint) {
String backendName = MathConverter.curBackend.getBackendName();
if (backendName.equals("OctaveBackend")) {
convertUsingOctaveBackend(mathExpressionSymbol, bluePrint);
} else if (backendName.equals("ArmadilloBackend")) {
convertUsingArmadilloBackend(mathExpressionSymbol, bluePrint);
}
}
public void convertUsingOctaveBackend(MathExpressionSymbol mathExpressionSymbol, BluePrint bluePrint) {
Log.error("No implementation for Octave Backend");
}
public void convertUsingArmadilloBackend(MathExpressionSymbol mathExpressionSymbol, BluePrint bluePrint) {
MathMatrixNameExpressionSymbol mathMatrixNameExpressionSymbol = (MathMatrixNameExpressionSymbol) mathExpressionSymbol;
mathMatrixNameExpressionSymbol.setNameToAccess("");
String valueListString = "";
for (MathMatrixAccessSymbol accessSymbol : mathMatrixNameExpressionSymbol.getMathMatrixAccessOperatorSymbol().getMathMatrixAccessSymbols())
MathFunctionFixer.fixMathFunctions(accessSymbol, (BluePrintCPP) bluePrint);
valueListString += ExecuteMethodGenerator.generateExecuteCode(mathExpressionSymbol, new ArrayList<String>());
List<MathMatrixAccessSymbol> newMatrixAccessSymbols = new ArrayList<>();
MathStringExpression stringExpression = new MathStringExpression("putText" + valueListString,mathMatrixNameExpressionSymbol.getMathMatrixAccessOperatorSymbol().getMathMatrixAccessSymbols());
newMatrixAccessSymbols.add(new MathMatrixAccessSymbol(stringExpression));
mathMatrixNameExpressionSymbol.getMathMatrixAccessOperatorSymbol().setMathMatrixAccessSymbols(newMatrixAccessSymbols);
((BluePrintCPP) bluePrint).addCVIncludeString("opencv2/imgproc");
}
}
package de.monticore.lang.monticar.generator.cpp.commands;
import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixAccessSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol;
import de.monticore.lang.monticar.generator.BluePrint;
import de.monticore.lang.monticar.generator.MathCommand;
import de.monticore.lang.monticar.generator.cpp.BluePrintCPP;
import de.monticore.lang.monticar.generator.cpp.MathFunctionFixer;
import de.monticore.lang.monticar.generator.cpp.converter.ExecuteMethodGenerator;
import de.monticore.lang.monticar.generator.cpp.converter.MathConverter;
import de.monticore.lang.monticar.generator.cpp.symbols.MathStringExpression;
import de.se_rwth.commons.logging.Log;
import java.util.ArrayList;
import java.util.List;
/**
* @author Ahmed Diab
*/
public class ThresholdCommand extends MathCommand{
public ThresholdCommand() {
setMathCommandName("threshold");
}
@Override
public void convert(MathExpressionSymbol mathExpressionSymbol, BluePrint bluePrint) {
String backendName = MathConverter.curBackend.getBackendName();
if (backendName.equals("OctaveBackend")) {
convertUsingOctaveBackend(mathExpressionSymbol, bluePrint);
} else if (backendName.equals("ArmadilloBackend")) {
convertUsingArmadilloBackend(mathExpressionSymbol, bluePrint);
}
}
@Override
public boolean isCVMathCommand(){
return true;
}
public void convertUsingOctaveBackend(MathExpressionSymbol mathExpressionSymbol, BluePrint bluePrint) {
Log.error("No implementation for Octave Backend");
}
public void convertUsingArmadilloBackend(MathExpressionSymbol mathExpressionSymbol, BluePrint bluePrint) {
MathMatrixNameExpressionSymbol mathMatrixNameExpressionSymbol = (MathMatrixNameExpressionSymbol) mathExpressionSymbol;
mathMatrixNameExpressionSymbol.setNameToAccess("");
String valueListString = "";
for (MathMatrixAccessSymbol accessSymbol : mathMatrixNameExpressionSymbol.getMathMatrixAccessOperatorSymbol().getMathMatrixAccessSymbols())
MathFunctionFixer.fixMathFunctions(accessSymbol, (BluePrintCPP) bluePrint);
valueListString += ExecuteMethodGenerator.generateExecuteCode(mathExpressionSymbol, new ArrayList<String>());
List<MathMatrixAccessSymbol> newMatrixAccessSymbols = new ArrayList<>();
MathStringExpression stringExpression = new MathStringExpression("threshold" + valueListString,mathMatrixNameExpressionSymbol.getMathMatrixAccessOperatorSymbol().getMathMatrixAccessSymbols());
newMatrixAccessSymbols.add(new MathMatrixAccessSymbol(stringExpression));
mathMatrixNameExpressionSymbol.getMathMatrixAccessOperatorSymbol().setMathMatrixAccessSymbols(newMatrixAccessSymbols);
((BluePrintCPP) bluePrint).addCVIncludeString("opencv2/imgproc");
}
}
......@@ -235,21 +235,11 @@ public class ArmadilloFunctionTest extends AbstractSymtabTest {
testMathCommand("boundingRect");
}
@Test
public void testCircleCommand() throws IOException{
testMathCommand("circle");
}
@Test
public void testCvtColorCommand() throws IOException{
testMathCommand("cvtColor");
}
@Test
public void testDrawContoursCommand() throws IOException{
testMathCommand("drawContours");
}
@Test
public void testFindContoursCommand() throws IOException{
testMathCommand("findContours");
......@@ -265,16 +255,6 @@ public class ArmadilloFunctionTest extends AbstractSymtabTest {
testMathCommand("inRange");
}
@Test
public void testPutTextCommand() throws IOException{
testMathCommand("putText");
}
@Test
public void testThresholdCommand() throws IOException{
testMathCommand("threshold");
}
@Test
public void testLargestContourCommand() throws IOException{
testMathCommand("largestContour");
......
......@@ -6,7 +6,7 @@
#include "armadillo"
#include "opencv2/imgproc.hpp"
using namespace arma;
using namespace cv;
using namespace std;
class test_math_boundingRectCommandTest{
public:
vector<cv::Point> contour;
......@@ -16,7 +16,7 @@ void init()
}
void execute()
{
rectAngle = (boundingRect(contour));
rectAngle = (cv::boundingRect(contour));
}
};
......
#ifndef TEST_MATH_CIRCLECOMMANDTEST
#define TEST_MATH_CIRCLECOMMANDTEST
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include "armadillo"
#include "opencv2/imgproc.hpp"
using namespace arma;
using namespace cv;
class test_math_circleCommandTest{
public:
void init()
{
}
void execute()
{
double a = (circle(0, 0, 0, 0, 0));
}
};
#endif
......@@ -5,8 +5,9 @@
#endif
#include "armadillo"
#include "opencv2/imgproc.hpp"
#include "ConvHelper.h"
using namespace arma;
using namespace cv;
using namespace std;
class test_math_cvtColorCommandTest{
public:
mat src;
......@@ -19,7 +20,7 @@ dst=mat(n,m);
}
void execute()
{
cvtColor(src, dst, colorConversion);
cv::cvtColor(src, dst, colorConversion);
}
};
......
......@@ -5,8 +5,9 @@
#endif
#include "armadillo"
#include "opencv2/imgproc.hpp"
#include "ConvHelper.h"
using namespace arma;
using namespace cv;
using namespace std;
class test_math_dilateCommandTest{
public:
mat src;
......@@ -25,10 +26,10 @@ void dilateHelper(mat src, mat dst, int dilation_elem, int iterations)
else if( dilation_elem == 1 ){ dilation_type = MORPH_CROSS; }
else if( dilation_elem == 2) { dilation_type = MORPH_ELLIPSE; }
dilation_size = dilation_elem;
mat element = getStructuringElement( dilation_type,
mat element = cv::getStructuringElement( dilation_type,
Size( 2*dilation_size + 1, 2*dilation_size+1 ),
Point( -1, -1 ) );
dilate( src, dst, element, Point(-1,-1), iterations );
cv::dilate( src, dst, element, Point(-1,-1), iterations );
}
void execute()
{
......@@ -36,4 +37,4 @@ dilateHelper(src, dst, dilation_elem, iterations);
}
};
#endif
\ No newline at end of file
#endif
#ifndef TEST_MATH_DRAWCONTOURSCOMMANDTEST
#define TEST_MATH_DRAWCONTOURSCOMMANDTEST
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include "armadillo"
#include "opencv2/imgproc.hpp"
using namespace arma;
using namespace cv;
class test_math_drawContoursCommandTest{
public:
void init()
{
}
void execute()
{
double a = (drawContours(0, 0, 0, 0, 0));
}
};
#endif
......@@ -67,4 +67,3 @@ cv::findContours(dst3, contours, method, mode);
};
#endif
......@@ -7,7 +7,7 @@
#include "ConvHelper.h"
#include "opencv2/imgproc.hpp"
using namespace arma;
using namespace cv;
using namespace std;
class test_math_erodeCommandTest{
public:
mat src;
......@@ -26,10 +26,10 @@ void erodeHelper(mat src, mat dst, int erosion_elem, int iterations)
else if( erosion_elem == 1 ){ erosion_type = MORPH_CROSS; }
else if( erosion_elem == 2) { erosion_type = MORPH_ELLIPSE; }
erosion_size = erosion_elem;
mat element = getStructuringElement( erosion_type,
mat element = cv::getStructuringElement( erosion_type,
Size( 2*erosion_size + 1, 2*erosion_size+1 ),
Point( -1, -1 ) );
erode( src, dst, element, Point(-1,-1), iterations );
cv::erode( src, dst, element, Point(-1,-1), iterations );
}
void execute()
{
......
......@@ -5,9 +5,10 @@
#endif
#include "armadillo"
#include "opencv2/imgproc.hpp"
#include "ConvHelper.h"
#include <vector>
using namespace arma;
using namespace cv;
using namespace std;
class test_math_findContoursCommandTest{
public:
mat image;
......@@ -20,8 +21,8 @@ image=mat(n,m);
}
void execute()
{
findContours(image, contours, mode, method);
cv::findContours(image, contours, mode, method);
}
};
#endif
\ No newline at end of file
#endif
......@@ -5,8 +5,9 @@
#endif
#include "armadillo"
#include "opencv2/imgproc.hpp"
#include "ConvHelper.h"
using namespace arma;
using namespace cv;
using namespace std;
class test_math_gaussianBlurCommandTest{
public:
cube src;
......@@ -22,7 +23,7 @@ dst = cube(3, n, m);
}
void gaussianBlurHelper(cube src, cube dst, int sizeX, int sizeY, double sigmaX, double sigmaY)
{
gaussianBlur(src, dst, Size(sizeX, sizeY), sigmaX, sigmaY);
cv::gaussianBlur(src, dst, Size(sizeX, sizeY), sigmaX, sigmaY);
}
void execute()
{
......
......@@ -5,8 +5,9 @@
#endif
#include "armadillo"
#include "opencv2/core.hpp"
#include "ConvHelper.h"
using namespace arma;
using namespace cv;
using namespace std;
class test_math_inRangeCommandTest{
public:
mat src;
......@@ -22,7 +23,7 @@ dst=mat(n,m);
}
void inRangeHelper(cube src, mat dst, colvec lowerB, colvec upperB)
{
inRange(src, Scalar(lowerB(0), lowerB(1), lowerB(2)),
cv::inRange(src, Scalar(lowerB(0), lowerB(1), lowerB(2)),
Scalar(upperB(0), upperB(1), upperB(2)), dst);
}
void execute()
......@@ -31,4 +32,4 @@ inRangeHelper(src, dst, lowerBoundary, upperBoundary);
}
};
#endif
\ No newline at end of file
#endif
......@@ -6,7 +6,7 @@
#include "armadillo"
#include "opencv2/imgproc.hpp"
using namespace arma;
using namespace cv;
using namespace std;
class test_math_largestContourCommandTest{
public:
vector<vector<cv::Point>> contours;
......@@ -19,7 +19,7 @@ vector<Point> largestContour(vector <vector<Point>> contours)
double maxArea = 0;
int maxAreaContourId = -1;
for (int j = 0; j < contours.size(); j++) {
double newArea = contourArea(contours.at(j));
double newArea = cv::contourArea(contours.at(j));
if (newArea > maxArea) {
maxArea = newArea;
maxAreaContourId = j;
......
#ifndef TEST_MATH_PUTTEXTCOMMANDTEST
#define TEST_MATH_PUTTEXTCOMMANDTEST
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include "armadillo"
#include "opencv2/imgproc.hpp"
using namespace arma;
using namespace cv;
class test_math_putTextCommandTest{
public:
void init()
{
}
void execute()
{
double a = (putText(0, 0, 0, 0, 0));
}
};
#endif
......@@ -5,8 +5,9 @@
#endif
#include "armadillo"
#include "opencv2/imgproc.hpp"
#include "ConvHelper.h"
using namespace arma;
using namespace cv;
using namespace std;
class test_math_rectangleCommandTest{
public:
cube src;
......
#ifndef TEST_MATH_THRESHOLDCOMMANDTEST
#define TEST_MATH_THRESHOLDCOMMANDTEST
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include "armadillo"
#include "opencv2/imgproc.hpp"
using namespace arma;
using namespace cv;
class test_math_thresholdCommandTest{
public:
void init()
{
}
void execute()
{
double a = (threshold(0, 0, 0, 0, 0));
}
};
#endif
/* (c) https://github.com/MontiCore/monticore */
package test.math;
component CircleCommandTest{
implementation Math{
Q a = circle(0,0,0,0,0);
}
}
/* (c) https://github.com/MontiCore/monticore */
package test.math;
component DrawContoursCommandTest{
implementation Math{
Q a = drawContours(0,0,0,0,0);
}
}
/* (c) https://github.com/MontiCore/monticore */
package test.math;
component PutTextCommandTest{
implementation Math{
Q a = putText(0,0,0,0,0);
}
}
/* (c) https://github.com/MontiCore/monticore */
package test.math;
component ThresholdCommandTest{
implementation Math{
Q a = threshold(0,0,0,0,0);
}
}
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