Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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
submodule
opencv_contrib
Commits
4446ef5e
Commit
4446ef5e
authored
Jun 01, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2132 from AHolliday:fix_2102_redux
parents
4df17e67
81b61652
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
selectivesearchsegmentation.cpp
modules/ximgproc/src/selectivesearchsegmentation.cpp
+12
-4
No files found.
modules/ximgproc/src/selectivesearchsegmentation.cpp
View file @
4446ef5e
...
...
@@ -558,9 +558,14 @@ namespace cv {
center
=
Point
((
int
)(
img_plane_rotated
.
cols
/
2.0
),
(
int
)(
img_plane_rotated
.
rows
/
2.0
));
rot
=
cv
::
getRotationMatrix2D
(
center
,
-
45.0
,
1.0
);
warpAffine
(
tmp_gradiant
,
tmp_rot
,
rot
,
bbox
.
size
());
// Using this bigger box avoids clipping the ends of narrow images
Rect
bbox2
=
cv
::
RotatedRect
(
center
,
img_plane_rotated
.
size
(),
-
45.0
).
boundingRect
();
\
warpAffine
(
tmp_gradiant
,
tmp_rot
,
rot
,
bbox2
.
size
());
tmp_gradiant
=
tmp_rot
(
Rect
((
bbox
.
width
-
img
.
cols
)
/
2
,
(
bbox
.
height
-
img
.
rows
)
/
2
,
img
.
cols
,
img
.
rows
));
// for narrow images, bbox might be less tall or wide than img
int
start_x
=
std
::
max
(
0
,
(
bbox
.
width
-
img
.
cols
)
/
2
);
int
start_y
=
std
::
max
(
0
,
(
bbox
.
height
-
img
.
rows
)
/
2
);
tmp_gradiant
=
tmp_rot
(
Rect
(
start_x
,
start_y
,
img
.
cols
,
img
.
rows
));
threshold
(
tmp_gradiant
,
tmp_gradiant_pos
,
0
,
0
,
THRESH_TOZERO
);
threshold
(
tmp_gradiant
,
tmp_gradiant_neg
,
0
,
0
,
THRESH_TOZERO_INV
);
...
...
@@ -573,9 +578,12 @@ namespace cv {
center
=
Point
((
int
)(
img_plane_rotated
.
cols
/
2.0
),
(
int
)(
img_plane_rotated
.
rows
/
2.0
));
rot
=
cv
::
getRotationMatrix2D
(
center
,
-
45.0
,
1.0
);
warpAffine
(
tmp_gradiant
,
tmp_rot
,
rot
,
bbox
.
size
());
bbox2
=
cv
::
RotatedRect
(
center
,
img_plane_rotated
.
size
(),
-
45.0
).
boundingRect
();
\
warpAffine
(
tmp_gradiant
,
tmp_rot
,
rot
,
bbox2
.
size
());
tmp_gradiant
=
tmp_rot
(
Rect
((
bbox
.
width
-
img
.
cols
)
/
2
,
(
bbox
.
height
-
img
.
rows
)
/
2
,
img
.
cols
,
img
.
rows
));
start_x
=
std
::
max
(
0
,
(
bbox
.
width
-
img
.
cols
)
/
2
);
start_y
=
std
::
max
(
0
,
(
bbox
.
height
-
img
.
rows
)
/
2
);
tmp_gradiant
=
tmp_rot
(
Rect
(
start_x
,
start_y
,
img
.
cols
,
img
.
rows
));
threshold
(
tmp_gradiant
,
tmp_gradiant_pos
,
0
,
0
,
THRESH_TOZERO
);
threshold
(
tmp_gradiant
,
tmp_gradiant_neg
,
0
,
0
,
THRESH_TOZERO_INV
);
...
...
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