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
56754e90
Commit
56754e90
authored
Feb 15, 2014
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed crash for windows if console widow is closed or CTRL_C/CTRL_BRAK keys in console are pressed.
parent
1a5dfe42
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
12 deletions
+62
-12
viz3d.hpp
modules/viz/include/opencv2/viz/viz3d.hpp
+2
-0
precomp.hpp
modules/viz/src/precomp.hpp
+12
-2
viz3d.cpp
modules/viz/src/viz3d.cpp
+2
-0
vizcore.cpp
modules/viz/src/vizcore.cpp
+43
-9
vizimpl.cpp
modules/viz/src/vizimpl.cpp
+2
-0
vizimpl.hpp
modules/viz/src/vizimpl.hpp
+1
-1
No files found.
modules/viz/include/opencv2/viz/viz3d.hpp
View file @
56754e90
...
...
@@ -114,6 +114,8 @@ namespace cv
double
getRenderingProperty
(
const
String
&
id
,
int
property
);
void
setRepresentation
(
int
representation
);
void
setGlobalWarnings
(
bool
enabled
=
false
);
private
:
struct
VizImpl
;
...
...
modules/viz/src/precomp.hpp
View file @
56754e90
...
...
@@ -155,7 +155,16 @@ namespace cv
namespace
viz
{
typedef
std
::
map
<
String
,
vtkSmartPointer
<
vtkProp
>
>
WidgetActorMap
;
typedef
std
::
map
<
String
,
Viz3d
>
VizMap
;
struct
VizMap
{
typedef
std
::
map
<
String
,
Viz3d
>
type
;
typedef
type
::
iterator
iterator
;
type
m
;
~
VizMap
();
void
replace_clear
();
};
class
VizStorage
{
...
...
@@ -167,7 +176,6 @@ namespace cv
private
:
VizStorage
();
// Static
~
VizStorage
();
static
void
add
(
const
Viz3d
&
window
);
static
Viz3d
&
get
(
const
String
&
window_name
);
...
...
@@ -177,6 +185,8 @@ namespace cv
static
VizMap
storage
;
friend
class
Viz3d
;
static
VizStorage
init
;
};
template
<
typename
_Tp
>
inline
_Tp
normalized
(
const
_Tp
&
v
)
{
return
v
*
1
/
norm
(
v
);
}
...
...
modules/viz/src/viz3d.cpp
View file @
56754e90
...
...
@@ -146,3 +146,5 @@ void cv::viz::Viz3d::setRenderingProperty(const String &id, int property, double
double
cv
::
viz
::
Viz3d
::
getRenderingProperty
(
const
String
&
id
,
int
property
)
{
return
getWidget
(
id
).
getRenderingProperty
(
property
);
}
void
cv
::
viz
::
Viz3d
::
setRepresentation
(
int
representation
)
{
impl_
->
setRepresentation
(
representation
);
}
void
cv
::
viz
::
Viz3d
::
setGlobalWarnings
(
bool
enabled
)
{
vtkObject
::
SetGlobalWarningDisplay
(
enabled
?
1
:
0
);
}
modules/viz/src/vizcore.cpp
View file @
56754e90
...
...
@@ -67,36 +67,70 @@ cv::Affine3d cv::viz::makeCameraPose(const Vec3d& position, const Vec3d& focal_p
///////////////////////////////////////////////////////////////////////////////////////////////
/// VizStorage implementation
#if defined(_WIN32) && !defined(__CYGWIN__)
#include <windows.h>
static
BOOL
WINAPI
ConsoleHandlerRoutine
(
DWORD
/*dwCtrlType*/
)
{
vtkObject
::
GlobalWarningDisplayOff
();
return
FALSE
;
}
static
void
register_console_handler
()
{
HANDLE
hOut
=
GetStdHandle
(
STD_OUTPUT_HANDLE
);
CONSOLE_SCREEN_BUFFER_INFO
hOutInfo
;
if
(
GetConsoleScreenBufferInfo
(
hOut
,
&
hOutInfo
))
SetConsoleCtrlHandler
(
ConsoleHandlerRoutine
,
TRUE
);
}
#else
void
register_console_handler
()
{}
#endif
cv
::
viz
::
VizStorage
cv
::
viz
::
VizStorage
::
init
;
cv
::
viz
::
VizMap
cv
::
viz
::
VizStorage
::
storage
;
void
cv
::
viz
::
VizStorage
::
unregisterAll
()
{
storage
.
clear
();
}
void
cv
::
viz
::
VizMap
::
replace_clear
()
{
type
().
swap
(
m
);
}
cv
::
viz
::
VizMap
::~
VizMap
()
{
replace_clear
();
}
cv
::
viz
::
VizStorage
::
VizStorage
()
{
register_console_handler
();
}
void
cv
::
viz
::
VizStorage
::
unregisterAll
()
{
storage
.
replace_clear
();
}
cv
::
viz
::
Viz3d
&
cv
::
viz
::
VizStorage
::
get
(
const
String
&
window_name
)
{
String
name
=
generateWindowName
(
window_name
);
VizMap
::
iterator
vm_itr
=
storage
.
find
(
name
);
CV_Assert
(
vm_itr
!=
storage
.
end
());
VizMap
::
iterator
vm_itr
=
storage
.
m
.
find
(
name
);
CV_Assert
(
vm_itr
!=
storage
.
m
.
end
());
return
vm_itr
->
second
;
}
void
cv
::
viz
::
VizStorage
::
add
(
const
Viz3d
&
window
)
{
String
window_name
=
window
.
getWindowName
();
VizMap
::
iterator
vm_itr
=
storage
.
find
(
window_name
);
CV_Assert
(
vm_itr
==
storage
.
end
());
storage
.
insert
(
std
::
make_pair
(
window_name
,
window
));
VizMap
::
iterator
vm_itr
=
storage
.
m
.
find
(
window_name
);
CV_Assert
(
vm_itr
==
storage
.
m
.
end
());
storage
.
m
.
insert
(
std
::
make_pair
(
window_name
,
window
));
}
bool
cv
::
viz
::
VizStorage
::
windowExists
(
const
String
&
window_name
)
{
String
name
=
generateWindowName
(
window_name
);
return
storage
.
find
(
name
)
!=
storage
.
end
();
return
storage
.
m
.
find
(
name
)
!=
storage
.
m
.
end
();
}
void
cv
::
viz
::
VizStorage
::
removeUnreferenced
()
{
for
(
VizMap
::
iterator
pos
=
storage
.
begin
();
pos
!=
storage
.
end
();)
for
(
VizMap
::
iterator
pos
=
storage
.
m
.
begin
();
pos
!=
storage
.
m
.
end
();)
if
(
pos
->
second
.
impl_
->
ref_counter
==
1
)
storage
.
erase
(
pos
++
);
storage
.
m
.
erase
(
pos
++
);
else
++
pos
;
}
...
...
modules/viz/src/vizimpl.cpp
View file @
56754e90
...
...
@@ -72,6 +72,8 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name) : spin_once_state_(false),
setBackgroundMeshLab
();
}
cv
::
viz
::
Viz3d
::
VizImpl
::~
VizImpl
()
{
close
();
}
/////////////////////////////////////////////////////////////////////////////////////////////
void
cv
::
viz
::
Viz3d
::
VizImpl
::
TimerCallback
::
Execute
(
vtkObject
*
caller
,
unsigned
long
event_id
,
void
*
cookie
)
{
...
...
modules/viz/src/vizimpl.hpp
View file @
56754e90
...
...
@@ -55,7 +55,7 @@ public:
int
ref_counter
;
VizImpl
(
const
String
&
name
);
virtual
~
VizImpl
()
{}
virtual
~
VizImpl
()
;
bool
wasStopped
()
const
;
void
close
();
...
...
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