deffcode
deffcode copied to clipboard
[v0.2.4] New Index based Camera Device Capturing (Fixes #27)
Brief Description
Implemented a new Index based Camera Device Capturing feature (Similar to OpenCV), where the user just have to assign device index as integer number in source parameter of DeFFcode APIs to directly access the given input device in few seconds.
Requirements / Checklist
- [x] I have read the DeFFcode PR Guidelines.
- [x] I have read the DeFFcode Documentation.
- [x] I have updated the documentation files accordingly(if required).
Related Issue
#27
Context
Currently deffcode users have to manually Identify and Specify each Video Capture Device Name/Path and suitable Demuxer on different OS platforms. This PR bring the Index based Camera Device Capturing feature that implements Device Indexing (similar to OpenCV) for all currently supported OS platforms, where the user just have to assign device index as integer (-n to n-1th) in source parameter of DeFFcode APIs to directly access the given input device in few seconds, thus minimizing perceived complexity of decoding Live Feed Devices.
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing functionality to change)
Miscellaneous (if available):
Bare-minimum Code to test this PR feature on your computer:
# import the necessary packages
from deffcode import FFdecoder
import cv2
# initialize and formulate the decoder for BGR24 pixel format output
decoder = FFdecoder(0, frame_format="bgr24", verbose=True).formulate()
# grab the BGR24 frames from decoder
for frame in decoder.generateFrame():
# check if frame is None
if frame is None:
break
# {do something with the frame here}
# Show output window
cv2.imshow("Output", frame)
# check for 'q' key if pressed
key = cv2.waitKey(1) & 0xFF
if key == ord("q"):
break
# close output window
cv2.destroyAllWindows()
# terminate the decoder
decoder.terminate()
Codecov Report
Base: 97.57% // Head: 96.61% // Decreases project coverage by -0.95%
:warning:
Coverage data is based on head (
f82ae29
) compared to base (f833f25
). Patch coverage: 93.06% of modified lines in pull request are covered.
Additional details and impacted files
@@ Coverage Diff @@
## master #29 +/- ##
==========================================
- Coverage 97.57% 96.61% -0.96%
==========================================
Files 6 6
Lines 618 768 +150
==========================================
+ Hits 603 742 +139
- Misses 15 26 +11
Impacted Files | Coverage Δ | |
---|---|---|
deffcode/ffhelper.py | 96.66% <85.96%> (-3.34%) |
:arrow_down: |
deffcode/utils.py | 97.87% <87.50%> (+2.87%) |
:arrow_up: |
deffcode/sourcer.py | 97.33% <94.11%> (-0.89%) |
:arrow_down: |
deffcode/ffdecoder.py | 95.61% <96.80%> (+0.16%) |
:arrow_up: |
deffcode/version.py | 100.00% <100.00%> (ø) |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.