-
Notifications
You must be signed in to change notification settings - Fork 251
Render a video on a Cube #322 #862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
robinroy03
wants to merge
24
commits into
fury-gl:master
Choose a base branch
from
robinroy03:cube_viz
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+242
−0
Open
Changes from 16 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
deb99c6
video on a cube
robinroy03 41848f7
import vtk through fury lib.py, added some comments on possible impro…
robinroy03 2773729
fixing pep8 one line at a time
robinroy03 6feeeb0
fixing pep8 one line at a time (part 2)
robinroy03 d4b3344
Merge branch 'fury-gl:master' into cube_viz
robinroy03 f58f41d
modified cube viz with different textures on all 6 sides
robinroy03 ed688ca
pep8 fix
robinroy03 1887ccb
pep8
robinroy03 5a7c6fc
textured cube final version without tests
robinroy03 6fc3dcd
tutorial for viz_play_cube
robinroy03 a351499
pep8 fix
robinroy03 78f8135
pep8
robinroy03 724ee56
modified to elininate circular import error, removed get_scene() beca…
robinroy03 6a84176
added tests and fixed some docstrings, also added to lib.py
robinroy03 f735ad9
using isintance for the type comparison
robinroy03 c141f31
Added center coordinate parameter, used util.py helper function to si…
robinroy03 1953851
Removed classes, made it functional. Changed the tests accordingly. M…
robinroy03 0367526
Merge branch 'fury-gl:master' into cube_viz
robinroy03 dc74532
fixed a coordinate bug, now it is perfectly aligned to the center
robinroy03 264721b
fixed docs, made it cleaner. Fixed uneven variable names for texture_…
robinroy03 20d668d
small typo fix
robinroy03 62ac13c
fixed the normal directions (it now points outwards, earlier it point…
robinroy03 faf40bf
Merge branch 'fury-gl:master' into cube_viz
robinroy03 b26842a
https version of videos, removed implementation note from docstring, …
robinroy03 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| """ | ||
| ======================================================= | ||
| Play a video in the 3D world | ||
| ======================================================= | ||
|
|
||
| The goal of this demo is to show how to visualize a video | ||
| on a cube by updating its textures. | ||
| """ | ||
|
|
||
| from fury import window, actor | ||
| import numpy as np | ||
| import cv2 | ||
|
|
||
|
|
||
| def timer_callback(_caller, _timer_event): | ||
| rgb_images = [] | ||
| for video_capture in video_captures: | ||
| _, bgr_image = video_capture.read() | ||
|
|
||
| # Condition used to stop rendering when the smallest video is over. | ||
| if isinstance(bgr_image, np.ndarray): | ||
| rgb_image = cv2.cvtColor(bgr_image, cv2.COLOR_BGR2RGB) | ||
| rgb_images.append(rgb_image) | ||
| else: | ||
| show_manager.exit() | ||
| return | ||
|
|
||
| cube.texture_update( | ||
| show_manager, | ||
| *rgb_images | ||
| ) | ||
|
|
||
|
|
||
| # the 6 sources for the video, can be URL or directory links on your machine. | ||
| sources = [ | ||
| 'http://commondatastorage.googleapis.com/gtv-videos-bucket/' | ||
| + 'sample/BigBuckBunny.mp4', | ||
| 'http://commondatastorage.googleapis.com/gtv-videos-bucket/' | ||
| + 'sample/BigBuckBunny.mp4', | ||
| 'http://commondatastorage.googleapis.com/gtv-videos-bucket/' | ||
| + 'sample/BigBuckBunny.mp4', | ||
| 'http://commondatastorage.googleapis.com/gtv-videos-bucket/' | ||
| + 'sample/BigBuckBunny.mp4', | ||
| 'http://commondatastorage.googleapis.com/gtv-videos-bucket/' | ||
| + 'sample/BigBuckBunny.mp4', | ||
| 'http://commondatastorage.googleapis.com/gtv-videos-bucket/' | ||
| + 'sample/BigBuckBunny.mp4' | ||
|
robinroy03 marked this conversation as resolved.
Outdated
|
||
| ] | ||
|
|
||
| video_captures = [cv2.VideoCapture(source) for source in sources] | ||
| rgb_images = [] | ||
| for video_capture in video_captures: | ||
| _, bgr_image = video_capture.read() | ||
| rgb_image = cv2.cvtColor(bgr_image, cv2.COLOR_BGR2RGB) | ||
| rgb_images.append(rgb_image) | ||
|
robinroy03 marked this conversation as resolved.
Outdated
|
||
|
|
||
| # Creating a TexturedCube with different textures on all 6 sides. | ||
| cube = actor.TexturedCube(*rgb_images) | ||
| scene = window.Scene() | ||
| cube_actor = cube.get_actor() | ||
| scene.add(cube_actor) | ||
| show_manager = window.ShowManager(scene, size=(1280, 720), reset_camera=False) | ||
| show_manager.add_timer_callback(True, int(1/60), timer_callback) | ||
| show_manager.start() | ||
|
robinroy03 marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.