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
6d34d6b4
Commit
6d34d6b4
authored
Aug 12, 2016
by
StevenPuttemans
Committed by
Alexander Alekhin
Dec 15, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update samples: waitKey() usage
Original commit is a5f19f7dd6ae5bc93f73e0417a9e0bfd34c01672
parent
4e7b5214
Hide whitespace changes
Inline
Side-by-side
Showing
76 changed files
with
142 additions
and
157 deletions
+142
-157
utility.cpp
apps/createsamples/utility.cpp
+5
-6
calibPipeline.cpp
apps/interactive-calibration/calibPipeline.cpp
+1
-1
remap.markdown
doc/tutorials/imgproc/imgtrans/remap/remap.markdown
+2
-2
pyramids.markdown
doc/tutorials/imgproc/pyramids/pyramids.markdown
+1
-0
tst_scene_render.py
modules/python/test/tst_scene_render.py
+3
-4
3calibration.cpp
samples/cpp/3calibration.cpp
+1
-1
calibration.cpp
samples/cpp/calibration.cpp
+4
-4
cloning_gui.cpp
samples/cpp/cloning_gui.cpp
+1
-1
convexhull.cpp
samples/cpp/convexhull.cpp
+1
-2
detect_mser.cpp
samples/cpp/detect_mser.cpp
+2
-2
distrans.cpp
samples/cpp/distrans.cpp
+1
-1
facedetect.cpp
samples/cpp/facedetect.cpp
+6
-6
ffilldemo.cpp
samples/cpp/ffilldemo.cpp
+3
-3
grabcut.cpp
samples/cpp/grabcut.cpp
+2
-2
laplace.cpp
samples/cpp/laplace.cpp
+2
-2
morphology2.cpp
samples/cpp/morphology2.cpp
+6
-8
pca.cpp
samples/cpp/pca.cpp
+2
-2
phase_corr.cpp
samples/cpp/phase_corr.cpp
+3
-3
points_classifier.cpp
samples/cpp/points_classifier.cpp
+1
-1
segment_objects.cpp
samples/cpp/segment_objects.cpp
+1
-1
select3dobj.cpp
samples/cpp/select3dobj.cpp
+3
-3
smiledetect.cpp
samples/cpp/smiledetect.cpp
+1
-1
squares.cpp
samples/cpp/squares.cpp
+2
-2
Pyramids.cpp
samples/cpp/tutorial_code/ImgProc/Pyramids.cpp
+10
-14
Threshold.cpp
samples/cpp/tutorial_code/ImgProc/Threshold.cpp
+2
-3
Threshold_inRange.cpp
samples/cpp/tutorial_code/ImgProc/Threshold_inRange.cpp
+1
-1
HoughCircle_Demo.cpp
samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp
+2
-2
Remap_Demo.cpp
samples/cpp/tutorial_code/ImgTrans/Remap_Demo.cpp
+2
-2
copyMakeBorder_demo.cpp
samples/cpp/tutorial_code/ImgTrans/copyMakeBorder_demo.cpp
+4
-8
filter2D_demo.cpp
samples/cpp/tutorial_code/ImgTrans/filter2D_demo.cpp
+2
-4
main_detection.cpp
.../calib3d/real_time_pose_estimation/src/main_detection.cpp
+1
-1
planar_tracking.cpp
...torial_code/features2D/AKAZE_tracking/planar_tracking.cpp
+1
-1
objectDetection.cpp
...les/cpp/tutorial_code/objectDetection/objectDetection.cpp
+2
-2
objectDetection2.cpp
...es/cpp/tutorial_code/objectDetection/objectDetection2.cpp
+2
-2
cloning_gui.cpp
.../cpp/tutorial_code/photo/seamless_cloning/cloning_gui.cpp
+1
-1
bg_sub.cpp
samples/cpp/tutorial_code/video/bg_sub.cpp
+7
-5
video-input-psnr-ssim.cpp
...e/videoio/video-input-psnr-ssim/video-input-psnr-ssim.cpp
+1
-2
watershed.cpp
samples/cpp/watershed.cpp
+4
-4
bgfg_segm.cpp
samples/gpu/bgfg_segm.cpp
+1
-1
opengl.cpp
samples/gpu/opengl.cpp
+2
-2
camshift.py
samples/python/camshift.py
+1
-1
coherence.py
samples/python/coherence.py
+1
-1
color_histogram.py
samples/python/color_histogram.py
+1
-1
contours.py
samples/python/contours.py
+1
-1
deconvolution.py
samples/python/deconvolution.py
+1
-1
digits_video.py
samples/python/digits_video.py
+1
-1
distrans.py
samples/python/distrans.py
+1
-1
edge.py
samples/python/edge.py
+1
-1
facedetect.py
samples/python/facedetect.py
+1
-1
fitline.py
samples/python/fitline.py
+1
-1
floodfill.py
samples/python/floodfill.py
+1
-1
gaussian_mix.py
samples/python/gaussian_mix.py
+1
-1
grabcut.py
samples/python/grabcut.py
+1
-1
hist.py
samples/python/hist.py
+1
-1
inpaint.py
samples/python/inpaint.py
+1
-1
kalman.py
samples/python/kalman.py
+1
-1
kmeans.py
samples/python/kmeans.py
+1
-1
lappyr.py
samples/python/lappyr.py
+1
-1
lk_homography.py
samples/python/lk_homography.py
+1
-1
lk_track.py
samples/python/lk_track.py
+1
-1
morphology.py
samples/python/morphology.py
+1
-1
mosse.py
samples/python/mosse.py
+1
-1
mouse_and_match.py
samples/python/mouse_and_match.py
+1
-1
mser.py
samples/python/mser.py
+1
-1
opt_flow.py
samples/python/opt_flow.py
+1
-1
peopledetect.py
samples/python/peopledetect.py
+1
-1
plane_ar.py
samples/python/plane_ar.py
+1
-1
plane_tracker.py
samples/python/plane_tracker.py
+1
-1
squares.py
samples/python/squares.py
+1
-1
tst_scene_render.py
samples/python/tst_scene_render.py
+2
-3
turing.py
samples/python/turing.py
+1
-1
video.py
samples/python/video.py
+1
-1
video_threaded.py
samples/python/video_threaded.py
+1
-1
video_v4l2.py
samples/python/video_v4l2.py
+2
-2
watershed.py
samples/python/watershed.py
+1
-1
ufacedetect.cpp
samples/tapi/ufacedetect.cpp
+6
-6
No files found.
apps/createsamples/utility.cpp
View file @
6d34d6b4
...
...
@@ -1270,7 +1270,7 @@ void cvCreateTrainingSamples( const char* filename,
if
(
showsamples
)
{
cvShowImage
(
"Sample"
,
&
sample
);
if
(
cvWaitKey
(
0
)
==
27
)
if
(
(
cvWaitKey
(
0
)
&
0xFF
)
==
27
)
{
showsamples
=
0
;
}
...
...
@@ -1402,7 +1402,7 @@ void cvCreateTestSamples( const char* infoname,
if
(
showsamples
)
{
cvShowImage
(
"Image"
,
&
cvbgreader
->
src
);
if
(
cvWaitKey
(
0
)
==
27
)
if
(
(
cvWaitKey
(
0
)
&
0xFF
)
==
27
)
{
showsamples
=
0
;
}
...
...
@@ -1525,7 +1525,7 @@ int cvCreateTrainingSamplesFromInfo( const char* infoname, const char* vecfilena
if
(
showsamples
)
{
cvShowImage
(
"Sample"
,
sample
);
if
(
cvWaitKey
(
0
)
==
27
)
if
(
(
cvWaitKey
(
0
)
&
0xFF
)
==
27
)
{
showsamples
=
0
;
}
...
...
@@ -1672,7 +1672,7 @@ void cvShowVecSamples( const char* filename, int winwidth, int winheight,
icvGetTraininDataFromVec
(
sample
,
&
file
);
if
(
scale
!=
1.0
)
cvResize
(
sample
,
scaled_sample
,
CV_INTER_LINEAR
);
cvShowImage
(
"Sample"
,
scaled_sample
);
if
(
cvWaitKey
(
0
)
==
27
)
break
;
if
(
(
cvWaitKey
(
0
)
&
0xFF
)
==
27
)
break
;
}
if
(
scaled_sample
&&
scaled_sample
!=
sample
)
cvReleaseMat
(
&
scaled_sample
);
cvReleaseMat
(
&
sample
);
...
...
@@ -1680,4 +1680,4 @@ void cvShowVecSamples( const char* filename, int winwidth, int winheight,
}
fclose
(
file
.
input
);
}
}
\ No newline at end of file
}
apps/interactive-calibration/calibPipeline.cpp
View file @
6d34d6b4
...
...
@@ -68,7 +68,7 @@ PipelineExitStatus CalibPipeline::start(std::vector<cv::Ptr<FrameProcessor> > pr
for
(
std
::
vector
<
cv
::
Ptr
<
FrameProcessor
>
>::
iterator
it
=
processors
.
begin
();
it
!=
processors
.
end
();
++
it
)
processedFrame
=
(
*
it
)
->
processFrame
(
processedFrame
);
cv
::
imshow
(
mainWindowName
,
processedFrame
);
int
key
=
cv
::
waitKey
(
CAP_DELAY
);
char
key
=
(
char
)
cv
::
waitKey
(
CAP_DELAY
);
if
(
key
==
27
)
// esc
return
Finished
;
...
...
doc/tutorials/imgproc/imgtrans/remap/remap.markdown
View file @
6d34d6b4
...
...
@@ -85,9 +85,9 @@ Explanation
while( true )
{
/// Each 1 sec. Press ESC to exit the program
int c =
waitKey( 1000 );
char c = (char)
waitKey( 1000 );
if(
(char)
c == 27 )
if( c == 27 )
{ break; }
/// Update map_x & map_y. Then apply remap
...
...
doc/tutorials/imgproc/pyramids/pyramids.markdown
View file @
6d34d6b4
...
...
@@ -93,6 +93,7 @@ Let's check the general structure of the program:
-
Perform an infinite loop waiting for user input.
@snippet cpp/tutorial_code/ImgProc/Pyramids.cpp infinite_loop
Our program exits if the user presses *ESC*. Besides, it has two options:
- **Perform upsampling (after pressing 'u')**
...
...
modules/python/test/tst_scene_render.py
View file @
6d34d6b4
...
...
@@ -113,7 +113,7 @@ if __name__ == '__main__':
img
=
render
.
getNextFrame
()
cv2
.
imshow
(
'img'
,
img
)
ch
=
0xFF
&
cv2
.
waitKey
(
3
)
if
ch
==
27
:
ch
=
cv2
.
waitKey
(
3
)
if
ch
==
27
:
break
cv2
.
destroyAllWindows
()
\ No newline at end of file
cv2
.
destroyAllWindows
()
samples/cpp/3calibration.cpp
View file @
6d34d6b4
...
...
@@ -351,7 +351,7 @@ int main( int argc, char** argv )
for
(
k
=
0
;
k
<
small_canvas
.
rows
;
k
+=
16
)
line
(
small_canvas
,
Point
(
0
,
k
),
Point
(
small_canvas
.
cols
,
k
),
Scalar
(
0
,
255
,
0
),
1
);
imshow
(
"rectified"
,
small_canvas
);
int
c
=
waitKey
(
0
);
char
c
=
(
char
)
waitKey
(
0
);
if
(
c
==
27
||
c
==
'q'
||
c
==
'Q'
)
break
;
}
...
...
samples/cpp/calibration.cpp
View file @
6d34d6b4
...
...
@@ -493,9 +493,9 @@ int main( int argc, char** argv )
}
imshow
(
"Image View"
,
view
);
int
key
=
0xff
&
waitKey
(
capture
.
isOpened
()
?
50
:
500
);
char
key
=
(
char
)
waitKey
(
capture
.
isOpened
()
?
50
:
500
);
if
(
(
key
&
255
)
==
27
)
if
(
key
==
27
)
break
;
if
(
key
==
'u'
&&
mode
==
CALIBRATED
)
...
...
@@ -536,8 +536,8 @@ int main( int argc, char** argv )
//undistort( view, rview, cameraMatrix, distCoeffs, cameraMatrix );
remap
(
view
,
rview
,
map1
,
map2
,
INTER_LINEAR
);
imshow
(
"Image View"
,
rview
);
int
c
=
0xff
&
waitKey
();
if
(
(
c
&
255
)
==
27
||
c
==
'q'
||
c
==
'Q'
)
char
c
=
(
char
)
waitKey
();
if
(
c
==
27
||
c
==
'q'
||
c
==
'Q'
)
break
;
}
}
...
...
samples/cpp/cloning_gui.cpp
View file @
6d34d6b4
...
...
@@ -453,7 +453,7 @@ int main()
for
(;;)
{
char
key
=
(
char
)
waitKey
(
0
);
char
key
=
(
char
)
waitKey
(
0
);
if
(
key
==
'd'
&&
flag3
==
0
)
{
...
...
samples/cpp/convexhull.cpp
View file @
6d34d6b4
...
...
@@ -25,7 +25,6 @@ int main( int argc, char** argv )
for
(;;)
{
char
key
;
int
i
,
count
=
(
unsigned
)
rng
%
100
+
1
;
vector
<
Point
>
points
;
...
...
@@ -58,7 +57,7 @@ int main( int argc, char** argv )
imshow
(
"hull"
,
img
);
key
=
(
char
)
waitKey
();
char
key
=
(
char
)
waitKey
();
if
(
key
==
27
||
key
==
'q'
||
key
==
'Q'
)
// 'ESC'
break
;
}
...
...
samples/cpp/detect_mser.cpp
View file @
6d34d6b4
...
...
@@ -279,8 +279,8 @@ static void DrawOpenGLMSER(Mat img, Mat result)
for
(;;)
{
updateWindow
(
"OpenGL"
);
int
key
=
waitKey
(
40
);
if
(
(
key
&
0xff
)
==
27
)
char
key
=
(
char
)
waitKey
(
40
);
if
(
key
==
27
)
break
;
if
(
key
==
0x20
)
rotateEnable
=
!
rotateEnable
;
...
...
samples/cpp/distrans.cpp
View file @
6d34d6b4
...
...
@@ -133,7 +133,7 @@ int main( int argc, const char** argv )
// Call to update the view
onTrackbar
(
0
,
0
);
int
c
=
waitKey
(
0
)
&
255
;
char
c
=
(
char
)
waitKey
(
0
)
;
if
(
c
==
27
)
break
;
...
...
samples/cpp/facedetect.cpp
View file @
6d34d6b4
...
...
@@ -72,9 +72,9 @@ int main( int argc, const char** argv )
}
if
(
inputName
.
empty
()
||
(
isdigit
(
inputName
[
0
])
&&
inputName
.
size
()
==
1
)
)
{
int
c
=
inputName
.
empty
()
?
0
:
inputName
[
0
]
-
'0'
;
if
(
!
capture
.
open
(
c
))
cout
<<
"Capture from camera #"
<<
c
<<
" didn't work"
<<
endl
;
int
c
amera
=
inputName
.
empty
()
?
0
:
inputName
[
0
]
-
'0'
;
if
(
!
capture
.
open
(
c
amera
))
cout
<<
"Capture from camera #"
<<
c
amera
<<
" didn't work"
<<
endl
;
}
else
if
(
inputName
.
size
()
)
{
...
...
@@ -104,7 +104,7 @@ int main( int argc, const char** argv )
Mat
frame1
=
frame
.
clone
();
detectAndDraw
(
frame1
,
cascade
,
nestedCascade
,
scale
,
tryflip
);
int
c
=
waitKey
(
10
);
char
c
=
(
char
)
waitKey
(
10
);
if
(
c
==
27
||
c
==
'q'
||
c
==
'Q'
)
break
;
}
...
...
@@ -127,7 +127,7 @@ int main( int argc, const char** argv )
char
buf
[
1000
+
1
];
while
(
fgets
(
buf
,
1000
,
f
)
)
{
int
len
=
(
int
)
strlen
(
buf
)
,
c
;
int
len
=
(
int
)
strlen
(
buf
);
while
(
len
>
0
&&
isspace
(
buf
[
len
-
1
])
)
len
--
;
buf
[
len
]
=
'\0'
;
...
...
@@ -136,7 +136,7 @@ int main( int argc, const char** argv )
if
(
!
image
.
empty
()
)
{
detectAndDraw
(
image
,
cascade
,
nestedCascade
,
scale
,
tryflip
);
c
=
waitKey
(
0
);
c
har
c
=
(
char
)
waitKey
(
0
);
if
(
c
==
27
||
c
==
'q'
||
c
==
'Q'
)
break
;
}
...
...
samples/cpp/ffilldemo.cpp
View file @
6d34d6b4
...
...
@@ -105,13 +105,13 @@ int main( int argc, char** argv )
{
imshow
(
"image"
,
isColor
?
image
:
gray
);
int
c
=
waitKey
(
0
);
if
(
(
c
&
255
)
==
27
)
char
c
=
(
char
)
waitKey
(
0
);
if
(
c
==
27
)
{
cout
<<
"Exiting ...
\n
"
;
break
;
}
switch
(
(
char
)
c
)
switch
(
c
)
{
case
'c'
:
if
(
isColor
)
...
...
samples/cpp/grabcut.cpp
View file @
6d34d6b4
...
...
@@ -306,8 +306,8 @@ int main( int argc, char** argv )
for
(;;)
{
int
c
=
waitKey
(
0
);
switch
(
(
char
)
c
)
char
c
=
(
char
)
waitKey
(
0
);
switch
(
c
)
{
case
'\x1b'
:
cout
<<
"Exiting ..."
<<
endl
;
...
...
samples/cpp/laplace.cpp
View file @
6d34d6b4
...
...
@@ -83,10 +83,10 @@ int main( int argc, char** argv )
convertScaleAbs
(
laplace
,
result
,
(
sigma
+
1
)
*
0.25
);
imshow
(
"Laplacian"
,
result
);
int
c
=
waitKey
(
30
);
char
c
=
(
char
)
waitKey
(
30
);
if
(
c
==
' '
)
smoothType
=
smoothType
==
GAUSSIAN
?
BLUR
:
smoothType
==
BLUR
?
MEDIAN
:
GAUSSIAN
;
if
(
c
==
'q'
||
c
==
'Q'
||
(
c
&
255
)
==
27
)
if
(
c
==
'q'
||
c
==
'Q'
||
c
==
27
)
break
;
}
...
...
samples/cpp/morphology2.cpp
View file @
6d34d6b4
...
...
@@ -82,21 +82,19 @@ int main( int argc, char** argv )
for
(;;)
{
int
c
;
OpenClose
(
open_close_pos
,
0
);
ErodeDilate
(
erode_dilate_pos
,
0
);
c
=
waitKey
(
0
);
c
har
c
=
(
char
)
waitKey
(
0
);
if
(
(
char
)
c
==
27
)
if
(
c
==
27
)
break
;
if
(
(
char
)
c
==
'e'
)
if
(
c
==
'e'
)
element_shape
=
MORPH_ELLIPSE
;
else
if
(
(
char
)
c
==
'r'
)
else
if
(
c
==
'r'
)
element_shape
=
MORPH_RECT
;
else
if
(
(
char
)
c
==
'c'
)
else
if
(
c
==
'c'
)
element_shape
=
MORPH_CROSS
;
else
if
(
(
char
)
c
==
' '
)
else
if
(
c
==
' '
)
element_shape
=
(
element_shape
+
1
)
%
3
;
}
...
...
samples/cpp/pca.cpp
View file @
6d34d6b4
...
...
@@ -183,9 +183,9 @@ int main(int argc, char** argv)
// display until user presses q
imshow
(
winName
,
reconstruction
);
int
key
=
0
;
char
key
=
0
;
while
(
key
!=
'q'
)
key
=
waitKey
();
key
=
(
char
)
waitKey
();
return
0
;
}
samples/cpp/phase_corr.cpp
View file @
6d34d6b4
...
...
@@ -9,7 +9,7 @@ int main(int, char* [])
{
VideoCapture
video
(
0
);
Mat
frame
,
curr
,
prev
,
curr64f
,
prev64f
,
hann
;
int
key
=
0
;
char
key
;
do
{
...
...
@@ -37,10 +37,10 @@ int main(int, char* [])
}
imshow
(
"phase shift"
,
frame
);
key
=
waitKey
(
2
);
key
=
(
char
)
waitKey
(
2
);
prev
=
curr
.
clone
();
}
while
(
(
char
)
key
!=
27
);
// Esc to exit...
}
while
(
key
!=
27
);
// Esc to exit...
return
0
;
}
samples/cpp/points_classifier.cpp
View file @
6d34d6b4
...
...
@@ -312,7 +312,7 @@ int main()
for
(;;)
{
uchar
key
=
(
u
char
)
waitKey
();
char
key
=
(
char
)
waitKey
();
if
(
key
==
27
)
break
;
...
...
samples/cpp/segment_objects.cpp
View file @
6d34d6b4
...
...
@@ -105,7 +105,7 @@ int main(int argc, char** argv)
refineSegments
(
tmp_frame
,
bgmask
,
out_frame
);
imshow
(
"video"
,
tmp_frame
);
imshow
(
"segmented"
,
out_frame
);
int
keycode
=
waitKey
(
30
);
char
keycode
=
(
char
)
waitKey
(
30
);
if
(
keycode
==
27
)
break
;
if
(
keycode
==
' '
)
...
...
samples/cpp/select3dobj.cpp
View file @
6d34d6b4
...
...
@@ -285,8 +285,8 @@ static int select3DBox(const string& windowname, const string& selWinName, const
imshow
(
windowname
,
shownFrame
);
imshow
(
selWinName
,
selectedObjFrame
);
int
c
=
waitKey
(
30
);
if
(
(
c
&
255
)
==
27
)
char
c
=
(
char
)
waitKey
(
30
);
if
(
c
==
27
)
{
nobjpt
=
0
;
}
...
...
@@ -593,7 +593,7 @@ int main(int argc, char** argv)
imshow
(
"View"
,
shownFrame
);
imshow
(
"Selected Object"
,
selectedObjFrame
);
int
c
=
waitKey
(
imageList
.
empty
()
&&
!
box
.
empty
()
?
30
:
300
);
char
c
=
(
char
)
waitKey
(
imageList
.
empty
()
&&
!
box
.
empty
()
?
30
:
300
);
if
(
c
==
'q'
||
c
==
'Q'
)
break
;
if
(
c
==
'\r'
||
c
==
'\n'
)
...
...
samples/cpp/smiledetect.cpp
View file @
6d34d6b4
...
...
@@ -99,7 +99,7 @@ int main( int argc, const char** argv )
Mat
frame1
=
frame
.
clone
();
detectAndDraw
(
frame1
,
cascade
,
nestedCascade
,
scale
,
tryflip
);
int
c
=
waitKey
(
10
);
char
c
=
(
char
)
waitKey
(
10
);
if
(
c
==
27
||
c
==
'q'
||
c
==
'Q'
)
break
;
}
...
...
samples/cpp/squares.cpp
View file @
6d34d6b4
...
...
@@ -167,8 +167,8 @@ int main(int argc, char** argv)
findSquares
(
image
,
squares
);
drawSquares
(
image
,
squares
);
int
c
=
waitKey
();
if
(
(
char
)
c
==
27
)
char
c
=
(
char
)
waitKey
();
if
(
c
==
27
)
break
;
}
...
...
samples/cpp/tutorial_code/ImgProc/Pyramids.cpp
View file @
6d34d6b4
...
...
@@ -45,26 +45,22 @@ int main( void )
//![infinite_loop]
for
(;;)
{
int
c
;
c
=
waitKey
(
0
);
char
c
=
(
char
)
waitKey
(
0
);
if
(
(
char
)
c
==
27
)
if
(
c
==
27
)
{
break
;
}
if
(
(
char
)
c
==
'u'
)
{
//![pyrup]
pyrUp
(
tmp
,
dst
,
Size
(
tmp
.
cols
*
2
,
tmp
.
rows
*
2
)
);
//![pyrup]
//![pyrup]
if
(
c
==
'u'
)
{
pyrUp
(
tmp
,
dst
,
Size
(
tmp
.
cols
*
2
,
tmp
.
rows
*
2
)
);
printf
(
"** Zoom In: Image x 2
\n
"
);
}
else
if
(
(
char
)
c
==
'd'
)
{
//![pyrdown]
pyrDown
(
tmp
,
dst
,
Size
(
tmp
.
cols
/
2
,
tmp
.
rows
/
2
)
);
//![pyrdown]
//![pyrup]
//![pyrdown]
else
if
(
c
==
'd'
)
{
pyrDown
(
tmp
,
dst
,
Size
(
tmp
.
cols
/
2
,
tmp
.
rows
/
2
)
);
printf
(
"** Zoom Out: Image / 2
\n
"
);
}
//![pyrdown]
imshow
(
window_name
,
dst
);
//![update_tmp]
...
...
samples/cpp/tutorial_code/ImgProc/Threshold.cpp
View file @
6d34d6b4
...
...
@@ -60,9 +60,8 @@ int main( int, char** argv )
/// Wait until user finishes program
for
(;;)
{
int
c
;
c
=
waitKey
(
20
);
if
(
(
char
)
c
==
27
)
char
c
=
(
char
)
waitKey
(
20
);
if
(
c
==
27
)
{
break
;
}
}
...
...
samples/cpp/tutorial_code/ImgProc/Threshold_inRange.cpp
View file @
6d34d6b4
...
...
@@ -41,7 +41,7 @@ int main()
createTrackbar
(
"Low B"
,
"Object Detection"
,
&
low_b
,
255
,
on_low_b_thresh_trackbar
);
createTrackbar
(
"High B"
,
"Object Detection"
,
&
high_b
,
255
,
on_high_b_thresh_trackbar
);
//! [trackbar]
while
(
char
(
waitKey
(
1
)
)
!=
'q'
){
while
(
(
char
)
waitKey
(
1
)
!=
'q'
){
//! [while]
cap
>>
frame
;
if
(
frame
.
empty
())
...
...
samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp
View file @
6d34d6b4
...
...
@@ -90,7 +90,7 @@ int main(int argc, char** argv)
// infinite loop to display
// and refresh the content of the output image
// until the user presses q or Q
int
key
=
0
;
char
key
=
0
;
while
(
key
!=
'q'
&&
key
!=
'Q'
)
{
// those paramaters cannot be =0
...
...
@@ -102,7 +102,7 @@ int main(int argc, char** argv)
HoughDetection
(
src_gray
,
src
,
cannyThreshold
,
accumulatorThreshold
);
// get user key
key
=
waitKey
(
10
);
key
=
(
char
)
waitKey
(
10
);
}
return
0
;
...
...
samples/cpp/tutorial_code/ImgTrans/Remap_Demo.cpp
View file @
6d34d6b4
...
...
@@ -40,9 +40,9 @@ int main( int, char** argv )
for
(;;)
{
/// Each 1 sec. Press ESC to exit the program
int
c
=
waitKey
(
1000
);
char
c
=
(
char
)
waitKey
(
1000
);
if
(
(
char
)
c
==
27
)
if
(
c
==
27
)
{
break
;
}
/// Update map_x & map_y. Then apply remap
...
...
samples/cpp/tutorial_code/ImgTrans/copyMakeBorder_demo.cpp
View file @
6d34d6b4
...
...
@@ -23,9 +23,6 @@ RNG rng(12345);
*/
int
main
(
int
,
char
**
argv
)
{
int
c
;
//![load]
src
=
imread
(
argv
[
1
],
IMREAD_COLOR
);
// Load an image
...
...
@@ -59,13 +56,12 @@ int main( int, char** argv )
for
(;;)
{
//![check_keypress]
c
=
waitKey
(
500
);
if
(
(
char
)
c
==
27
)
char
c
=
(
char
)
waitKey
(
500
);
if
(
c
==
27
)
{
break
;
}
else
if
(
(
char
)
c
==
'c'
)
else
if
(
c
==
'c'
)
{
borderType
=
BORDER_CONSTANT
;
}
else
if
(
(
char
)
c
==
'r'
)
else
if
(
c
==
'r'
)
{
borderType
=
BORDER_REPLICATE
;
}
//![check_keypress]
...
...
samples/cpp/tutorial_code/ImgTrans/filter2D_demo.cpp
View file @
6d34d6b4
...
...
@@ -25,8 +25,6 @@ int main ( int, char** argv )
int
kernel_size
;
const
char
*
window_name
=
"filter2D Demo"
;
int
c
;
//![load]
src
=
imread
(
argv
[
1
],
IMREAD_COLOR
);
// Load an image
...
...
@@ -45,9 +43,9 @@ int main ( int, char** argv )
int
ind
=
0
;
for
(;;)
{
c
=
waitKey
(
500
);
c
har
c
=
(
char
)
waitKey
(
500
);
/// Press 'ESC' to exit the program
if
(
(
char
)
c
==
27
)
if
(
c
==
27
)
{
break
;
}
//![update_kernel]
...
...
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/main_detection.cpp
View file @
6d34d6b4
...
...
@@ -180,7 +180,7 @@ int main(int argc, char *argv[])
Mat
frame
,
frame_vis
;
while
(
cap
.
read
(
frame
)
&&
waitKey
(
30
)
!=
27
)
// capture frame until ESC is pressed
while
(
cap
.
read
(
frame
)
&&
(
char
)
waitKey
(
30
)
!=
27
)
// capture frame until ESC is pressed
{
frame_vis
=
frame
.
clone
();
// refresh visualisation frame
...
...
samples/cpp/tutorial_code/features2D/AKAZE_tracking/planar_tracking.cpp
View file @
6d34d6b4
...
...
@@ -195,7 +195,7 @@ int main(int argc, char **argv)
drawStatistics
(
orb_res
,
orb_draw_stats
);
vconcat
(
akaze_res
,
orb_res
,
res_frame
);
cv
::
imshow
(
video_name
,
res_frame
);
if
(
cv
::
waitKey
(
1
)
==
27
)
break
;
//quit on ESC button
if
(
waitKey
(
1
)
==
27
)
break
;
//quit on ESC button
}
akaze_stats
/=
i
-
1
;
orb_stats
/=
i
-
1
;
...
...
samples/cpp/tutorial_code/objectDetection/objectDetection.cpp
View file @
6d34d6b4
...
...
@@ -44,8 +44,8 @@ int main( void )
//-- 3. Apply the classifier to the frame
detectAndDisplay
(
frame
);
int
c
=
waitKey
(
10
);
if
(
(
char
)
c
==
27
)
{
break
;
}
// escape
char
c
=
(
char
)
waitKey
(
10
);
if
(
c
==
27
)
{
break
;
}
// escape
}
return
0
;
}
...
...
samples/cpp/tutorial_code/objectDetection/objectDetection2.cpp
View file @
6d34d6b4
...
...
@@ -51,8 +51,8 @@ int main( void )
detectAndDisplay
(
frame
);
//-- bail out if escape was pressed
int
c
=
waitKey
(
10
);
if
(
(
char
)
c
==
27
)
{
break
;
}
char
c
=
(
char
)
waitKey
(
10
);
if
(
c
==
27
)
{
break
;
}
}
return
0
;
}
...
...
samples/cpp/tutorial_code/photo/seamless_cloning/cloning_gui.cpp
View file @
6d34d6b4
...
...
@@ -452,7 +452,7 @@ int main()
for
(;;)
{
char
key
=
(
char
)
waitKey
(
0
);
char
key
=
(
char
)
waitKey
(
0
);
if
(
key
==
'd'
&&
flag3
==
0
)
{
...
...
samples/cpp/tutorial_code/video/bg_sub.cpp
View file @
6d34d6b4
...
...
@@ -23,7 +23,7 @@ using namespace std;
Mat
frame
;
//current frame
Mat
fgMaskMOG2
;
//fg mask fg mask generated by MOG2 method
Ptr
<
BackgroundSubtractor
>
pMOG2
;
//MOG2 Background subtractor
int
keyboard
;
//input from keyboard
char
keyboard
;
//input from keyboard
/** Function Headers */
void
help
();
...
...
@@ -98,7 +98,8 @@ void processVideo(char* videoFilename) {
exit
(
EXIT_FAILURE
);
}
//read input data. ESC or 'q' for quitting
while
(
(
char
)
keyboard
!=
'q'
&&
(
char
)
keyboard
!=
27
){
keyboard
=
0
;
while
(
keyboard
!=
'q'
&&
keyboard
!=
27
){
//read the current frame
if
(
!
capture
.
read
(
frame
))
{
cerr
<<
"Unable to read next frame."
<<
endl
;
...
...
@@ -119,7 +120,7 @@ void processVideo(char* videoFilename) {
imshow
(
"Frame"
,
frame
);
imshow
(
"FG Mask MOG 2"
,
fgMaskMOG2
);
//get the input from the keyboard
keyboard
=
waitKey
(
30
);
keyboard
=
(
char
)
waitKey
(
30
);
}
//delete capture object
capture
.
release
();
...
...
@@ -139,7 +140,8 @@ void processImages(char* fistFrameFilename) {
//current image filename
string
fn
(
fistFrameFilename
);
//read input data. ESC or 'q' for quitting
while
(
(
char
)
keyboard
!=
'q'
&&
(
char
)
keyboard
!=
27
){
keyboard
=
0
;
while
(
keyboard
!=
'q'
&&
keyboard
!=
27
){
//update the background model
pMOG2
->
apply
(
frame
,
fgMaskMOG2
);
//get the frame number and write it on the current frame
...
...
@@ -162,7 +164,7 @@ void processImages(char* fistFrameFilename) {
imshow
(
"Frame"
,
frame
);
imshow
(
"FG Mask MOG 2"
,
fgMaskMOG2
);
//get the input from the keyboard
keyboard
=
waitKey
(
30
);
keyboard
=
(
char
)
waitKey
(
30
);
//search for the next image in the sequence
ostringstream
oss
;
oss
<<
(
frameNumber
+
1
);
...
...
samples/cpp/tutorial_code/videoio/video-input-psnr-ssim/video-input-psnr-ssim.cpp
View file @
6d34d6b4
...
...
@@ -44,7 +44,6 @@ int main(int argc, char *argv[])
conv
<<
argv
[
3
]
<<
endl
<<
argv
[
4
];
// put in the strings
conv
>>
psnrTriggerValue
>>
delay
;
// take out the numbers
char
c
;
int
frameNum
=
-
1
;
// Frame counter
VideoCapture
captRefrnc
(
sourceReference
),
captUndTst
(
sourceCompareWith
);
...
...
@@ -126,7 +125,7 @@ int main(int argc, char *argv[])
imshow
(
WIN_RF
,
frameReference
);
imshow
(
WIN_UT
,
frameUnderTest
);
c
=
(
char
)
waitKey
(
delay
);
c
har
c
=
(
char
)
waitKey
(
delay
);
if
(
c
==
27
)
break
;
}
...
...
samples/cpp/watershed.cpp
View file @
6d34d6b4
...
...
@@ -74,19 +74,19 @@ int main( int argc, char** argv )
for
(;;)
{
int
c
=
waitKey
(
0
);
char
c
=
(
char
)
waitKey
(
0
);
if
(
(
char
)
c
==
27
)
if
(
c
==
27
)
break
;
if
(
(
char
)
c
==
'r'
)
if
(
c
==
'r'
)
{
markerMask
=
Scalar
::
all
(
0
);
img0
.
copyTo
(
img
);
imshow
(
"image"
,
img
);
}
if
(
(
char
)
c
==
'w'
||
(
char
)
c
==
' '
)
if
(
c
==
'w'
||
c
==
' '
)
{
int
i
,
j
,
compCount
=
0
;
vector
<
vector
<
Point
>
>
contours
;
...
...
samples/gpu/bgfg_segm.cpp
View file @
6d34d6b4
...
...
@@ -161,7 +161,7 @@ int main(int argc, const char** argv)
if
(
!
bgimg
.
empty
())
imshow
(
"mean background image"
,
bgimg
);
int
key
=
waitKey
(
30
);
char
key
=
(
char
)
waitKey
(
30
);
if
(
key
==
27
)
break
;
}
...
...
samples/gpu/opengl.cpp
View file @
6d34d6b4
...
...
@@ -105,8 +105,8 @@ int main(int argc, char* argv[])
for
(;;)
{
updateWindow
(
"OpenGL"
);
int
key
=
waitKey
(
40
);
if
(
(
key
&
0xff
)
==
27
)
char
key
=
(
char
)
waitKey
(
40
);
if
(
key
==
27
)
break
;
}
...
...
samples/python/camshift.py
View file @
6d34d6b4
...
...
@@ -110,7 +110,7 @@ class App(object):
cv2
.
imshow
(
'camshift'
,
vis
)
ch
=
0xFF
&
cv2
.
waitKey
(
5
)
ch
=
cv2
.
waitKey
(
5
)
if
ch
==
27
:
break
if
ch
==
ord
(
'b'
):
...
...
samples/python/coherence.py
View file @
6d34d6b4
...
...
@@ -77,7 +77,7 @@ if __name__ == '__main__':
cv2
.
imshow
(
'src'
,
src
)
update
()
while
True
:
ch
=
0xFF
&
cv2
.
waitKey
()
ch
=
cv2
.
waitKey
()
if
ch
==
ord
(
' '
):
update
()
if
ch
==
27
:
...
...
samples/python/color_histogram.py
View file @
6d34d6b4
...
...
@@ -56,7 +56,7 @@ if __name__ == '__main__':
vis
=
hsv_map
*
h
[:,:,
np
.
newaxis
]
/
255.0
cv2
.
imshow
(
'hist'
,
vis
)
ch
=
0xFF
&
cv2
.
waitKey
(
1
)
ch
=
cv2
.
waitKey
(
1
)
if
ch
==
27
:
break
cv2
.
destroyAllWindows
()
samples/python/contours.py
View file @
6d34d6b4
...
...
@@ -66,5 +66,5 @@ if __name__ == '__main__':
update
(
3
)
cv2
.
createTrackbar
(
"levels+3"
,
"contours"
,
3
,
7
,
update
)
cv2
.
imshow
(
'image'
,
img
)
0xFF
&
cv2
.
waitKey
()
cv2
.
waitKey
()
cv2
.
destroyAllWindows
()
samples/python/deconvolution.py
View file @
6d34d6b4
...
...
@@ -122,7 +122,7 @@ if __name__ == '__main__':
update
(
None
)
while
True
:
ch
=
cv2
.
waitKey
()
&
0xFF
ch
=
cv2
.
waitKey
()
if
ch
==
27
:
break
if
ch
==
ord
(
' '
):
...
...
samples/python/digits_video.py
View file @
6d34d6b4
...
...
@@ -92,7 +92,7 @@ def main():
cv2
.
imshow
(
'frame'
,
frame
)
cv2
.
imshow
(
'bin'
,
bin
)
ch
=
cv2
.
waitKey
(
1
)
&
0xFF
ch
=
cv2
.
waitKey
(
1
)
if
ch
==
27
:
break
...
...
samples/python/distrans.py
View file @
6d34d6b4
...
...
@@ -59,7 +59,7 @@ if __name__ == '__main__':
while
True
:
ch
=
0xFF
&
cv2
.
waitKey
(
50
)
ch
=
cv2
.
waitKey
(
50
)
if
ch
==
27
:
break
if
ch
==
ord
(
'v'
):
...
...
samples/python/edge.py
View file @
6d34d6b4
...
...
@@ -49,7 +49,7 @@ if __name__ == '__main__':
vis
=
np
.
uint8
(
vis
/
2.
)
vis
[
edge
!=
0
]
=
(
0
,
255
,
0
)
cv2
.
imshow
(
'edge'
,
vis
)
ch
=
cv2
.
waitKey
(
5
)
&
0xFF
ch
=
cv2
.
waitKey
(
5
)
if
ch
==
27
:
break
cv2
.
destroyAllWindows
()
samples/python/facedetect.py
View file @
6d34d6b4
...
...
@@ -68,6 +68,6 @@ if __name__ == '__main__':
draw_str
(
vis
,
(
20
,
20
),
'time:
%.1
f ms'
%
(
dt
*
1000
))
cv2
.
imshow
(
'facedetect'
,
vis
)
if
0xFF
&
cv2
.
waitKey
(
5
)
==
27
:
if
cv2
.
waitKey
(
5
)
==
27
:
break
cv2
.
destroyAllWindows
()
samples/python/fitline.py
View file @
6d34d6b4
...
...
@@ -88,7 +88,7 @@ if __name__ == '__main__':
cv2
.
createTrackbar
(
'outlier
%
'
,
'fit line'
,
30
,
100
,
update
)
while
True
:
update
()
ch
=
cv2
.
waitKey
(
0
)
&
0xFF
ch
=
cv2
.
waitKey
(
0
)
if
ch
==
ord
(
'f'
):
if
PY3
:
cur_func_name
=
next
(
dist_func_names
)
...
...
samples/python/floodfill.py
View file @
6d34d6b4
...
...
@@ -66,7 +66,7 @@ if __name__ == '__main__':
cv2
.
createTrackbar
(
'hi'
,
'floodfill'
,
20
,
255
,
update
)
while
True
:
ch
=
0xFF
&
cv2
.
waitKey
()
ch
=
cv2
.
waitKey
()
if
ch
==
27
:
break
if
ch
==
ord
(
'f'
):
...
...
samples/python/gaussian_mix.py
View file @
6d34d6b4
...
...
@@ -63,7 +63,7 @@ if __name__ == '__main__':
draw_gaussain
(
img
,
m
,
cov
,
(
0
,
0
,
255
))
cv2
.
imshow
(
'gaussian mixture'
,
img
)
ch
=
0xFF
&
cv2
.
waitKey
(
0
)
ch
=
cv2
.
waitKey
(
0
)
if
ch
==
27
:
break
cv2
.
destroyAllWindows
()
samples/python/grabcut.py
View file @
6d34d6b4
...
...
@@ -129,7 +129,7 @@ if __name__ == '__main__':
cv2
.
imshow
(
'output'
,
output
)
cv2
.
imshow
(
'input'
,
img
)
k
=
0xFF
&
cv2
.
waitKey
(
1
)
k
=
cv2
.
waitKey
(
1
)
# key bindings
if
k
==
27
:
# esc to exit
...
...
samples/python/hist.py
View file @
6d34d6b4
...
...
@@ -84,7 +84,7 @@ if __name__ == '__main__':
cv2
.
imshow
(
'image'
,
im
)
while
True
:
k
=
cv2
.
waitKey
(
0
)
&
0xFF
k
=
cv2
.
waitKey
(
0
)
if
k
==
ord
(
'a'
):
curve
=
hist_curve
(
im
)
cv2
.
imshow
(
'histogram'
,
curve
)
...
...
samples/python/inpaint.py
View file @
6d34d6b4
...
...
@@ -41,7 +41,7 @@ if __name__ == '__main__':
sketch
=
Sketcher
(
'img'
,
[
img_mark
,
mark
],
lambda
:
((
255
,
255
,
255
),
255
))
while
True
:
ch
=
0xFF
&
cv2
.
waitKey
()
ch
=
cv2
.
waitKey
()
if
ch
==
27
:
break
if
ch
==
ord
(
' '
):
...
...
samples/python/kalman.py
View file @
6d34d6b4
...
...
@@ -90,7 +90,7 @@ if __name__ == "__main__":
if
code
!=
-
1
:
break
if
(
code
%
0x100
)
in
[
27
,
ord
(
'q'
),
ord
(
'Q'
)]:
if
code
in
[
27
,
ord
(
'q'
),
ord
(
'Q'
)]:
break
cv2
.
destroyWindow
(
"Kalman"
)
samples/python/kmeans.py
View file @
6d34d6b4
...
...
@@ -44,7 +44,7 @@ if __name__ == '__main__':
cv2
.
circle
(
img
,
(
x
,
y
),
1
,
c
,
-
1
)
cv2
.
imshow
(
'gaussian mixture'
,
img
)
ch
=
0xFF
&
cv2
.
waitKey
(
0
)
ch
=
cv2
.
waitKey
(
0
)
if
ch
==
27
:
break
cv2
.
destroyAllWindows
()
samples/python/lappyr.py
View file @
6d34d6b4
...
...
@@ -70,5 +70,5 @@ if __name__ == '__main__':
cv2
.
imshow
(
'laplacian pyramid filter'
,
res
)
if
cv2
.
waitKey
(
1
)
&
0xFF
==
27
:
if
cv2
.
waitKey
(
1
)
==
27
:
break
samples/python/lk_homography.py
View file @
6d34d6b4
...
...
@@ -90,7 +90,7 @@ class App:
cv2
.
imshow
(
'lk_homography'
,
vis
)
ch
=
0xFF
&
cv2
.
waitKey
(
1
)
ch
=
cv2
.
waitKey
(
1
)
if
ch
==
27
:
break
if
ch
==
ord
(
' '
):
...
...
samples/python/lk_track.py
View file @
6d34d6b4
...
...
@@ -85,7 +85,7 @@ class App:
self
.
prev_gray
=
frame_gray
cv2
.
imshow
(
'lk_track'
,
vis
)
ch
=
0xFF
&
cv2
.
waitKey
(
1
)
ch
=
cv2
.
waitKey
(
1
)
if
ch
==
27
:
break
...
...
samples/python/morphology.py
View file @
6d34d6b4
...
...
@@ -79,7 +79,7 @@ if __name__ == '__main__':
cv2
.
createTrackbar
(
'iters'
,
'morphology'
,
1
,
10
,
update
)
update
()
while
True
:
ch
=
0xFF
&
cv2
.
waitKey
()
ch
=
cv2
.
waitKey
()
if
ch
==
27
:
break
if
ch
==
ord
(
'1'
):
...
...
samples/python/mosse.py
View file @
6d34d6b4
...
...
@@ -176,7 +176,7 @@ class App:
self
.
rect_sel
.
draw
(
vis
)
cv2
.
imshow
(
'frame'
,
vis
)
ch
=
cv2
.
waitKey
(
10
)
&
0xFF
ch
=
cv2
.
waitKey
(
10
)
if
ch
==
27
:
break
if
ch
==
ord
(
' '
):
...
...
samples/python/mouse_and_match.py
View file @
6d34d6b4
...
...
@@ -78,6 +78,6 @@ if __name__ == '__main__':
drag_start
=
None
gray
=
cv2
.
cvtColor
(
img
,
cv2
.
COLOR_BGR2GRAY
)
cv2
.
imshow
(
"gray"
,
gray
)
if
(
cv2
.
waitKey
()
&
255
)
==
27
:
if
cv2
.
waitKey
(
)
==
27
:
break
cv2
.
destroyAllWindows
()
samples/python/mser.py
View file @
6d34d6b4
...
...
@@ -40,6 +40,6 @@ if __name__ == '__main__':
cv2
.
polylines
(
vis
,
hulls
,
1
,
(
0
,
255
,
0
))
cv2
.
imshow
(
'img'
,
vis
)
if
0xFF
&
cv2
.
waitKey
(
5
)
==
27
:
if
cv2
.
waitKey
(
5
)
==
27
:
break
cv2
.
destroyAllWindows
()
samples/python/opt_flow.py
View file @
6d34d6b4
...
...
@@ -83,7 +83,7 @@ if __name__ == '__main__':
cur_glitch
=
warp_flow
(
cur_glitch
,
flow
)
cv2
.
imshow
(
'glitch'
,
cur_glitch
)
ch
=
0xFF
&
cv2
.
waitKey
(
5
)
ch
=
cv2
.
waitKey
(
5
)
if
ch
==
27
:
break
if
ch
==
ord
(
'1'
):
...
...
samples/python/peopledetect.py
View file @
6d34d6b4
...
...
@@ -65,7 +65,7 @@ if __name__ == '__main__':
draw_detections
(
img
,
found_filtered
,
3
)
print
(
'
%
d (
%
d) found'
%
(
len
(
found_filtered
),
len
(
found
)))
cv2
.
imshow
(
'img'
,
img
)
ch
=
0xFF
&
cv2
.
waitKey
()
ch
=
cv2
.
waitKey
()
if
ch
==
27
:
break
cv2
.
destroyAllWindows
()
samples/python/plane_ar.py
View file @
6d34d6b4
...
...
@@ -75,7 +75,7 @@ class App:
self
.
rect_sel
.
draw
(
vis
)
cv2
.
imshow
(
'plane'
,
vis
)
ch
=
cv2
.
waitKey
(
1
)
&
0xFF
ch
=
cv2
.
waitKey
(
1
)
if
ch
==
ord
(
' '
):
self
.
paused
=
not
self
.
paused
if
ch
==
ord
(
'c'
):
...
...
samples/python/plane_tracker.py
View file @
6d34d6b4
...
...
@@ -170,7 +170,7 @@ class App:
self
.
rect_sel
.
draw
(
vis
)
cv2
.
imshow
(
'plane'
,
vis
)
ch
=
cv2
.
waitKey
(
1
)
&
0xFF
ch
=
cv2
.
waitKey
(
1
)
if
ch
==
ord
(
' '
):
self
.
paused
=
not
self
.
paused
if
ch
==
ord
(
'c'
):
...
...
samples/python/squares.py
View file @
6d34d6b4
...
...
@@ -49,7 +49,7 @@ if __name__ == '__main__':
squares
=
find_squares
(
img
)
cv2
.
drawContours
(
img
,
squares
,
-
1
,
(
0
,
255
,
0
),
3
)
cv2
.
imshow
(
'squares'
,
img
)
ch
=
0xFF
&
cv2
.
waitKey
()
ch
=
cv2
.
waitKey
()
if
ch
==
27
:
break
cv2
.
destroyAllWindows
()
samples/python/tst_scene_render.py
View file @
6d34d6b4
...
...
@@ -108,9 +108,9 @@ if __name__ == '__main__':
img
=
render
.
getNextFrame
()
cv2
.
imshow
(
'img'
,
img
)
ch
=
0xFF
&
cv2
.
waitKey
(
3
)
ch
=
cv2
.
waitKey
(
3
)
if
ch
==
27
:
break
#import os
#print (os.environ['PYTHONPATH'])
cv2
.
destroyAllWindows
()
\ No newline at end of file
cv2
.
destroyAllWindows
()
samples/python/turing.py
View file @
6d34d6b4
...
...
@@ -69,6 +69,6 @@ if __name__ == '__main__':
vis
=
a
.
copy
()
draw_str
(
vis
,
(
20
,
20
),
'frame
%
d'
%
frame_i
)
cv2
.
imshow
(
'a'
,
vis
)
if
0xFF
&
cv2
.
waitKey
(
5
)
==
27
:
if
cv2
.
waitKey
(
5
)
==
27
:
break
cv2
.
destroyAllWindows
()
samples/python/video.py
View file @
6d34d6b4
...
...
@@ -217,7 +217,7 @@ if __name__ == '__main__':
ret
,
img
=
cap
.
read
()
imgs
.
append
(
img
)
cv2
.
imshow
(
'capture
%
d'
%
i
,
img
)
ch
=
0xFF
&
cv2
.
waitKey
(
1
)
ch
=
cv2
.
waitKey
(
1
)
if
ch
==
27
:
break
if
ch
==
ord
(
' '
):
...
...
samples/python/video_threaded.py
View file @
6d34d6b4
...
...
@@ -81,7 +81,7 @@ if __name__ == '__main__':
else
:
task
=
DummyTask
(
process_frame
(
frame
,
t
))
pending
.
append
(
task
)
ch
=
0xFF
&
cv2
.
waitKey
(
1
)
ch
=
cv2
.
waitKey
(
1
)
if
ch
==
ord
(
' '
):
threaded_mode
=
not
threaded_mode
if
ch
==
27
:
...
...
samples/python/video_v4l2.py
View file @
6d34d6b4
...
...
@@ -58,10 +58,10 @@ while True:
cv2
.
putText
(
img
,
"FPS: {}"
.
format
(
fps
),
(
15
,
80
),
font
,
1.0
,
color
)
cv2
.
imshow
(
"Video"
,
img
)
k
=
0xFF
&
cv2
.
waitKey
(
1
)
k
=
cv2
.
waitKey
(
1
)
if
k
==
27
:
break
elif
k
==
ord
(
"g"
):
elif
k
==
ord
(
'g'
):
convert_rgb
=
not
convert_rgb
cap
.
set
(
cv2
.
CAP_PROP_CONVERT_RGB
,
convert_rgb
)
samples/python/watershed.py
View file @
6d34d6b4
...
...
@@ -56,7 +56,7 @@ class App:
def
run
(
self
):
while
cv2
.
getWindowProperty
(
'img'
,
0
)
!=
-
1
or
cv2
.
getWindowProperty
(
'watershed'
,
0
)
!=
-
1
:
ch
=
0xFF
&
cv2
.
waitKey
(
50
)
ch
=
cv2
.
waitKey
(
50
)
if
ch
==
27
:
break
if
ch
>=
ord
(
'1'
)
and
ch
<=
ord
(
'7'
):
...
...
samples/tapi/ufacedetect.cpp
View file @
6d34d6b4
...
...
@@ -78,9 +78,9 @@ int main( int argc, const char** argv )
if
(
inputName
.
empty
()
||
(
isdigit
(
inputName
[
0
])
&&
inputName
.
size
()
==
1
)
)
{
int
c
=
inputName
.
empty
()
?
0
:
inputName
[
0
]
-
'0'
;
if
(
!
capture
.
open
(
c
))
cout
<<
"Capture from camera #"
<<
c
<<
" didn't work"
<<
endl
;
int
c
amera
=
inputName
.
empty
()
?
0
:
inputName
[
0
]
-
'0'
;
if
(
!
capture
.
open
(
c
amera
))
cout
<<
"Capture from camera #"
<<
c
amera
<<
" didn't work"
<<
endl
;
}
else
{
...
...
@@ -105,7 +105,7 @@ int main( int argc, const char** argv )
detectAndDraw
(
frame
,
canvas
,
cascade
,
nestedCascade
,
scale
,
tryflip
);
int
c
=
waitKey
(
10
);
char
c
=
(
char
)
waitKey
(
10
);
if
(
c
==
27
||
c
==
'q'
||
c
==
'Q'
)
break
;
}
...
...
@@ -128,7 +128,7 @@ int main( int argc, const char** argv )
char
buf
[
1000
+
1
];
while
(
fgets
(
buf
,
1000
,
f
)
)
{
int
len
=
(
int
)
strlen
(
buf
)
,
c
;
int
len
=
(
int
)
strlen
(
buf
);
while
(
len
>
0
&&
isspace
(
buf
[
len
-
1
])
)
len
--
;
buf
[
len
]
=
'\0'
;
...
...
@@ -137,7 +137,7 @@ int main( int argc, const char** argv )
if
(
!
image
.
empty
()
)
{
detectAndDraw
(
image
,
canvas
,
cascade
,
nestedCascade
,
scale
,
tryflip
);
c
=
waitKey
(
0
);
c
har
c
=
(
char
)
waitKey
(
0
);
if
(
c
==
27
||
c
==
'q'
||
c
==
'Q'
)
break
;
}
...
...
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