Skip to content

This repository contains code to apply optical flow techniques for cloud cavitation. Uses Farneback dense optical flow and RAFT optical flow techniques. Also, has script to plot using the velocity fields.

License

Notifications You must be signed in to change notification settings

sanjayvasanth98/optical-flow-cloud-cavitation

 
 

Repository files navigation

optical-flow-cloud-cavitation

Purpose of Different Scripts

gpuJobScript.sh -> To submit job on ARC(Falcon cluster) using GPUs
serialJob.sh -> To submit postprocessing scripts on ARC(Owl cluster)
postProcessVelData.py -> To generate various plots and animations with the generated velocity data from Optical Flow methods
quiverVideo.py -> To overlay velocity vectors on top of the input video
speedUp.py -> To speed up videos for better visualization
tracking.py -> The main script to run Optical flow methods(RAFT and Farneback) on input Videos

tracking.py

Examples
-> python3 tracking.py --method farneback --model c1 --path 32_50f.avi --win_h 4 --win_w 4 --roi 145 333 4 -1 --imgScale 0.0477273 --fpsCam 13000
-> python3 tracking.py --method=raft --model=models/raft-cloudcav.pth --path 32_50f.avi --win_h 4 --win_w 4 --roi 0 360 60 1276 --imgScale 0.02175955 --fpsCam 130000 --use_clahe

Arguments
--method -> to use raft or farneback optical flow
--model -> for Farneback it represents case number for different numerical parameters, for RAFT it is the model parameters that should be used. For RAFT models, you can look inside the models folder and use them accordingly
--path -> path for the input video
--win_h -> window height for averaging velocity
--win_w -> window width for avergaing velocity
--roi -> region of interest for the input video. Let's say the video frame size is 384*1280 and we are only interested in some part of it, we provide the starting pixel position in height(top), ending position in height(bottom), starting position in width(left), ending in width(right). If you do not provide, it will process the whole video frame. Make sure to check if the width and height of ROI is divisible by 8 to avoid errors.
--imgScale -> the calibration value obtained from experiment. It is in mm/px. Default is 0.001.
--fpsCam -> the framerate at which video is captured
--use_clahe -> A preprocessing step to make the contrast uniform. No inputs needed for this arguement. Just using it will activate preprocessing step. Recommended to use it.
Note: The velocity is saved as .h5 format in px/frame units and the imgScale, fpsCam, win_h, win_w are saved as attributes for postprocessing later

quiverVideo.py

Example
-> python3 quiverVideo.py --path 32_50f.avi --velocity 32_50f_raft-cloudcav.h5 --fps 10

postProcessVelData.py

Examples
python3 postProcessVelData.py --method vLinesAvg --path 32_50f_raft-cloudcav.h5
python3 postProcessVelData.py --method hline --path 32_50f_raft-cloudcav.h5
python3 postProcessVelData.py --method points --path 32_50f_raft-cloudcav.h5
Note: so far only the above mentioned 3 different methods are working. points will generate a time series at 2,10,20mm x location from throat. hline will generate a video showing velocity evolution at a line close to bottom wall. vLinesAvg will plot time averaged velocity along the verticle lines at x points 1.5,3,5,10,20mm

About

This repository contains code to apply optical flow techniques for cloud cavitation. Uses Farneback dense optical flow and RAFT optical flow techniques. Also, has script to plot using the velocity fields.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.3%
  • Shell 1.7%