Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
D
datang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaoyunfei
datang
Commits
8265bbd4
Commit
8265bbd4
authored
Jan 30, 2021
by
zhaoyunfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抛洒物 ROI
parent
a8155a31
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
8 deletions
+29
-8
DetectAnomaly.cpp
DetectAnomaly.cpp
+17
-8
ObjLeftDetect.cpp
ObjLeftDetect.cpp
+12
-0
No files found.
DetectAnomaly.cpp
View file @
8265bbd4
...
@@ -96,6 +96,7 @@ DetectAnomaly::DetectAnomaly()
...
@@ -96,6 +96,7 @@ DetectAnomaly::DetectAnomaly()
cfgAnomaly
.
gmm_long_learn_rate
=
0.0001
;
cfgAnomaly
.
gmm_long_learn_rate
=
0.0001
;
cfgAnomaly
.
gmm_short_learn_rate
=
0.002
;
cfgAnomaly
.
gmm_short_learn_rate
=
0.002
;
cfgAnomaly
.
top_left_x
=
759
*
cfgAnomaly
.
input_resize
;
// set gloabl var
// set gloabl var
...
@@ -111,14 +112,22 @@ DetectAnomaly::DetectAnomaly()
...
@@ -111,14 +112,22 @@ DetectAnomaly::DetectAnomaly()
GMM_SHORT_LEARN_RATE
=
0.002
;
GMM_SHORT_LEARN_RATE
=
0.002
;
// INPUT_RESIZE = 0.25;
// INPUT_RESIZE = 0.25;
cfgAnomaly
.
top_left_x
=
759
*
cfgAnomaly
.
input_resize
;
// cfgAnomaly.top_left_x = 759 * cfgAnomaly.input_resize;
cfgAnomaly
.
top_left_y
=
35
*
cfgAnomaly
.
input_resize
;
// cfgAnomaly.top_left_y = 35 * cfgAnomaly.input_resize;
cfgAnomaly
.
top_right_x
=
1581
*
cfgAnomaly
.
input_resize
;
// cfgAnomaly.top_right_x = 1581 * cfgAnomaly.input_resize;
cfgAnomaly
.
top_right_y
=
21
*
cfgAnomaly
.
input_resize
;
// cfgAnomaly.top_right_y = 21 * cfgAnomaly.input_resize;
cfgAnomaly
.
bottom_left_x
=
73
*
cfgAnomaly
.
input_resize
;
// cfgAnomaly.bottom_left_x = 73 * cfgAnomaly.input_resize;
cfgAnomaly
.
bottom_left_y
=
739
*
cfgAnomaly
.
input_resize
;
// cfgAnomaly.bottom_left_y = 739 * cfgAnomaly.input_resize;
cfgAnomaly
.
bottom_right_x
=
2376
*
cfgAnomaly
.
input_resize
;
// cfgAnomaly.bottom_right_x = 2376 * cfgAnomaly.input_resize;
cfgAnomaly
.
bottom_right_y
=
661
*
cfgAnomaly
.
input_resize
;
// cfgAnomaly.bottom_right_y = 661 * cfgAnomaly.input_resize;
cfgAnomaly
.
top_left_x
=
562
*
cfgAnomaly
.
input_resize
;
cfgAnomaly
.
top_left_y
=
58
*
cfgAnomaly
.
input_resize
;
cfgAnomaly
.
top_right_x
=
1330
*
cfgAnomaly
.
input_resize
;
cfgAnomaly
.
top_right_y
=
45
*
cfgAnomaly
.
input_resize
;
cfgAnomaly
.
bottom_left_x
=
65
*
cfgAnomaly
.
input_resize
;
cfgAnomaly
.
bottom_left_y
=
734
*
cfgAnomaly
.
input_resize
;
cfgAnomaly
.
bottom_right_x
=
1780
*
cfgAnomaly
.
input_resize
;
cfgAnomaly
.
bottom_right_y
=
715
*
cfgAnomaly
.
input_resize
;
obj_left
=
false
;
obj_left
=
false
;
arr
[
0
]
=
4
;
arr
[
0
]
=
4
;
...
...
ObjLeftDetect.cpp
View file @
8265bbd4
...
@@ -32,6 +32,18 @@ void ObjLeftDetect::ObjLeftSet(myImage *input, int set_MOG_LearnFrame, int set_m
...
@@ -32,6 +32,18 @@ void ObjLeftDetect::ObjLeftSet(myImage *input, int set_MOG_LearnFrame, int set_m
myImage_2_opencv
(
mask
,
objmask
);
myImage_2_opencv
(
mask
,
objmask
);
cv
::
findContours
(
objmask
,
contours
,
cv
::
noArray
(),
cv
::
RETR_EXTERNAL
,
cv
::
CHAIN_APPROX_SIMPLE
);
cv
::
findContours
(
objmask
,
contours
,
cv
::
noArray
(),
cv
::
RETR_EXTERNAL
,
cv
::
CHAIN_APPROX_SIMPLE
);
if
(
contours
.
size
()
>
0
)
{
for
(
size_t
i
=
0
;
i
<
contours
.
size
();
i
++
)
{
if
(
cv
::
contourArea
(
contours
[
i
])
<
10000
)
{
contours
.
erase
(
contours
.
begin
()
+
i
);
i
--
;
}
}
}
cv
::
Mat
showpic
=
cv
::
Mat
::
zeros
(
cv
::
Size
(
new_width
,
new_height
),
CV_8UC1
);
cv
::
Mat
showpic
=
cv
::
Mat
::
zeros
(
cv
::
Size
(
new_width
,
new_height
),
CV_8UC1
);
drawContours
(
showpic
,
contours
,
0
,
Scalar
::
all
(
255
));
drawContours
(
showpic
,
contours
,
0
,
Scalar
::
all
(
255
));
// cv::imwrite("show.jpg",showpic);
// cv::imwrite("show.jpg",showpic);
...
...
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