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
4ac5f37d
Commit
4ac5f37d
authored
Sep 06, 2016
by
Yuval Langer
Committed by
Maksim Shabunin
May 24, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add inline code backticks
parent
19464a3e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
py_image_display.markdown
...torials/py_gui/py_image_display/py_image_display.markdown
+3
-3
py_video_display.markdown
...torials/py_gui/py_video_display/py_video_display.markdown
+6
-6
No files found.
doc/py_tutorials/py_gui/py_image_display/py_image_display.markdown
View file @
4ac5f37d
...
...
@@ -36,7 +36,7 @@ img = cv2.imread('messi5.jpg',0)
**warning**
Even if the image path is wrong, it won't throw any error, but
print img will give you None
Even if the image path is wrong, it won't throw any error, but
`print img`
will give you
`None`
### Display an image
...
...
@@ -109,8 +109,8 @@ elif k == ord('s'): # wait for 's' key to save and exit
**warning**
If you are using a 64-bit machine, you will have to modify
k = cv2.waitKey(0)
line as follows :
k = cv2.waitKey(0) & 0xFF
If you are using a 64-bit machine, you will have to modify
`k = cv2.waitKey(0)`
line as follows :
`k = cv2.waitKey(0) & 0xFF`
Using Matplotlib
----------------
...
...
doc/py_tutorials/py_gui/py_video_display/py_video_display.markdown
View file @
4ac5f37d
...
...
@@ -42,11 +42,11 @@ while(True):
cap.release()
cv2.destroyAllWindows()
@endcode
cap.read() returns a bool (True/False). If frame is read correctly, it will be True
. So you can
`cap.read()`
returns a bool (
`True`
/
`False`
). If frame is read correctly, it will be
`True`
. So you can
check end of the video by checking this return value.
Sometimes, cap may not have initialized the capture. In that case, this code shows error. You can
check whether it is initialized or not by the method
**cap.isOpened()**
. If it is
True
, OK.
check whether it is initialized or not by the method
**cap.isOpened()**
. If it is
`True`
, OK.
Otherwise open it using
**cap.open()**
.
You can also access some of the features of this video using
**cap.get(propId)**
method where propId
...
...
@@ -55,9 +55,9 @@ video) and full details can be seen here: cv::VideoCapture::get() .
Some of these values can be modified using
**cap.set(propId, value)**
. Value is the new value you
want.
For example, I can check the frame width and height by
cap.get(3) and cap.get(4)
. It gives me
640x480 by default. But I want to modify it to 320x240. Just use
ret = cap.set(3,320)
and
ret = cap.set(4,240)
.
For example, I can check the frame width and height by
`cap.get(cv2.CAP_PROP_FRAME_WIDTH)`
and
`cap.get(cv2.CAP_PROP_FRAME_HEIGHT)`
. It gives me
640x480 by default. But I want to modify it to 320x240. Just use
`ret = cap.set(cv2.CAP_PROP_FRAME_WIDTH,320)`
and
`ret = cap.set(cv2.CAP_PROP_FRAME_HEIGHT,240)`
.
@note If you are getting error, make sure camera is working fine using any other camera application
(like Cheese in Linux).
...
...
@@ -100,7 +100,7 @@ very simple, just use cv2.imwrite(). Here a little more work is required.
This time we create a
**VideoWriter**
object. We should specify the output file name (eg:
output.avi). Then we should specify the
**FourCC**
code (details in next paragraph). Then number of
frames per second (fps) and frame size should be passed. And last one is
**isColor**
flag. If it is
True
, encoder expect color frame, otherwise it works with grayscale frame.
`True`
, encoder expect color frame, otherwise it works with grayscale frame.
[
FourCC
](
http://en.wikipedia.org/wiki/FourCC
)
is a 4-byte code used to specify the video codec. The
list of available codes can be found in
[
fourcc.org
](
http://www.fourcc.org/codecs.php
)
. It is
...
...
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