Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMAM2Cpp
Commits
8f53e604
Commit
8f53e604
authored
Mar 06, 2020
by
Ahmed
Browse files
add some changes
parent
12bf3bd9
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/generator/cpp/commands/LargestContourCommand.java
View file @
8f53e604
...
...
@@ -84,8 +84,9 @@ public class LargestContourCommand extends MathCommand {
return
new
Instruction
()
{
@Override
public
String
getTargetLanguageInstruction
()
{
return
"double maxArea = 0;\n"
+
"int maxAreaContourId = -1;\n"
+
return
" std::vector<cv::Point> singleContour;\n"
+
" double maxArea = 0;\n"
+
" int maxAreaContourId = 0;\n"
+
" for (int j = 0; j < contours.size(); j++) {\n"
+
" double newArea = cv::contourArea(contours.at(j));\n"
+
" if (newArea > maxArea) {\n"
+
...
...
@@ -93,7 +94,7 @@ public class LargestContourCommand extends MathCommand {
" maxAreaContourId = j;\n"
+
" }\n"
+
" }\n"
+
" return contours.at(maxAreaContourId);\n"
;
" return
contours.empty()? singleContour:
contours.at(maxAreaContourId);\n"
;
}
@Override
...
...
src/test/resources/results/armadillo/testMath/l0/test_math_largestContourCommandTest.h
View file @
8f53e604
...
...
@@ -16,8 +16,9 @@ void init()
}
std
::
vector
<
cv
::
Point
>
largestContour
(
const
std
::
vector
<
std
::
vector
<
cv
::
Point
>>&
contours
)
{
double
maxArea
=
0
;
int
maxAreaContourId
=
-
1
;
std
::
vector
<
cv
::
Point
>
singleContour
;
double
maxArea
=
0
;
int
maxAreaContourId
=
0
;
for
(
int
j
=
0
;
j
<
contours
.
size
();
j
++
)
{
double
newArea
=
cv
::
contourArea
(
contours
.
at
(
j
));
if
(
newArea
>
maxArea
)
{
...
...
@@ -25,7 +26,7 @@ int maxAreaContourId = -1;
maxAreaContourId
=
j
;
}
}
return
contours
.
at
(
maxAreaContourId
);
return
contours
.
empty
()
?
singleContour
:
contours
.
at
(
maxAreaContourId
);
}
void
execute
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment