Skip to content
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

Use of pcolormesh instead of imshow #58

Open
jurjendejong opened this issue Mar 30, 2018 · 5 comments
Open

Use of pcolormesh instead of imshow #58

jurjendejong opened this issue Mar 30, 2018 · 5 comments
Assignees

Comments

@jurjendejong
Copy link
Contributor

jurjendejong commented Mar 30, 2018

Switching to new visualisation method for higher framerate.

A test has been done with 1000 frames of a changing 100 x 100 matrix. Different engines have been tested. Script is checked in in the Bastei branch in the 'playground' folder as 'compare_plotting_functions.py'.

Module Methode Frequentie (s-1)
matplotlib imshow 8.16
matplotlib imshow with set_data 10.27
matplotlib pcolormesh (with set_array) 21.96
matplotlib pcolormesh for larger window 12.63
vispy App, canvas, image 61.44
cv2 imshow 64.02

3-4-2018: Update using cv2 and changing the timing from time.process_time() to time.time()

@jurjendejong jurjendejong self-assigned this Mar 30, 2018
@jurjendejong
Copy link
Contributor Author

jurjendejong commented Apr 3, 2018

  • Update on visualisation: pcolormesh did not prove to be much of a gain (somehow).
  • Rewritten the code to have one imshow for the combined data of waterdepth+kinectheight+dotjes, switching from a data arrays (3 arrays of m x n cells) to one color array (m x n x 4)
  • Add test with cv2 as another plotting library (also imshow)
  • Switch to cv2?

@jurjendejong
Copy link
Contributor Author

Finished the upgrade to cv2, however, the visualisation has gotten a lot slower. I suspect that the actions of array transformation are getting too expensive to achieve the high framerate. Profiling is required.

@jurjendejong
Copy link
Contributor Author

jurjendejong commented Apr 4, 2018

timestep 1 2 3 4 5 6
update_kinect_height 0.010 0.097 0.004 0.003 0.007 0.004
update_height_cells 0.004 0.004 0.003 0.003 0.003 0.003
update_waterdepth 0.018 0.015 0.008 0.012 0.010 0.010
update_height_cells 0.004 0.006 0.003 0.004 0.003 0.002
update_waterdepth 0.022 0.014 0.012 0.015 0.009 0.008
update_uv 0.009 0.024 0.006 0.009 0.006 0.006
seed_lic 0.005 0.004 0.004 0.004 0.004 0.004
update_lic 0.085 0.071 0.053 0.069 0.048 0.047
vis_kinect_height 0.019 0.018 0.013 0.014 0.018 0.017
combine_images 0.038 0.043 0.035 0.046 0.029 0.029
vis_waterdepth 0.025 0.024 0.017 0.027 0.017 0.019
combine_images 0.032 0.049 0.032 0.029 0.034 0.039
vis_lic 0.000 0.000 0.000 0.000 0.000 0.000
combine_images 0.038 0.040 0.028 0.027 0.037 0.025
sum of above 0.309031 0.409041 0.21802 0.262026 0.225023 0.213022
update 0.335033 0.40104 0.222022 0.269027 0.231023 0.221022

@jurjendejong
Copy link
Contributor Author

After further investigation of the script and the table above, i've come to the conclusion that matrix/array computations in python take most of the time. Not the model, not the plotting, not the video analysis, but just some basic matrix multiplications.

@jurjendejong
Copy link
Contributor Author

Suggestions by Fedor:

  1. Use numpy MKL version
  2. Merging of images using CV2
  3. Making canvas with matplotlib, but plotting with cv2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant