Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
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
Commits
27f5cd2a
Commit
27f5cd2a
authored
Jul 22, 2013
by
ozantonkal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
overlay image widget constructor with Rect
parent
540f9a67
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
widgets.hpp
modules/viz/include/opencv2/viz/widgets.hpp
+1
-1
shape_widgets.cpp
modules/viz/src/shape_widgets.cpp
+14
-3
No files found.
modules/viz/include/opencv2/viz/widgets.hpp
View file @
27f5cd2a
...
...
@@ -147,7 +147,7 @@ namespace cv
class
CV_EXPORTS
ImageOverlayWidget
:
public
Widget2D
{
public
:
ImageOverlayWidget
(
const
Mat
&
image
,
const
Point2i
&
pos
);
ImageOverlayWidget
(
const
Mat
&
image
,
const
Rect
&
rect
);
void
setImage
(
const
Mat
&
image
);
...
...
modules/viz/src/shape_widgets.cpp
View file @
27f5cd2a
...
...
@@ -622,7 +622,7 @@ struct cv::viz::ImageOverlayWidget::CopyImpl
}
};
cv
::
viz
::
ImageOverlayWidget
::
ImageOverlayWidget
(
const
Mat
&
image
,
const
Point2i
&
pos
)
cv
::
viz
::
ImageOverlayWidget
::
ImageOverlayWidget
(
const
Mat
&
image
,
const
Rect
&
rect
)
{
CV_Assert
(
!
image
.
empty
()
&&
image
.
depth
()
==
CV_8U
);
...
...
@@ -641,14 +641,25 @@ cv::viz::ImageOverlayWidget::ImageOverlayWidget(const Mat &image, const Point2i
flipFilter
->
SetInputConnection
(
vtk_image
->
GetProducerPort
());
flipFilter
->
Update
();
// Scale the image based on the Rect
vtkSmartPointer
<
vtkTransform
>
transform
=
vtkSmartPointer
<
vtkTransform
>::
New
();
transform
->
Scale
(
double
(
image
.
cols
)
/
rect
.
width
,
double
(
image
.
rows
)
/
rect
.
height
,
1.0
);
vtkSmartPointer
<
vtkImageReslice
>
image_reslice
=
vtkSmartPointer
<
vtkImageReslice
>::
New
();
image_reslice
->
SetResliceTransform
(
transform
);
image_reslice
->
SetInputConnection
(
flipFilter
->
GetOutputPort
());
image_reslice
->
SetOutputDimensionality
(
2
);
image_reslice
->
InterpolateOn
();
image_reslice
->
AutoCropOutputOn
();
vtkSmartPointer
<
vtkImageMapper
>
imageMapper
=
vtkSmartPointer
<
vtkImageMapper
>::
New
();
imageMapper
->
SetInputConnection
(
flipFilter
->
GetOutputPort
());
imageMapper
->
SetInputConnection
(
image_reslice
->
GetOutputPort
());
imageMapper
->
SetColorWindow
(
255
);
// OpenCV color
imageMapper
->
SetColorLevel
(
127.5
);
vtkSmartPointer
<
vtkActor2D
>
actor
=
vtkSmartPointer
<
vtkActor2D
>::
New
();
actor
->
SetMapper
(
imageMapper
);
actor
->
SetPosition
(
pos
.
x
,
pos
.
y
);
actor
->
SetPosition
(
rect
.
x
,
rect
.
y
);
WidgetAccessor
::
setProp
(
*
this
,
actor
);
}
...
...
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