# PIV-PTV-oilcoatedBubbleTracking
# Step progress
- [x] build ptv piv analysis folder (data folder)
Run python [script](https://github.com/lipilian/PIV-PTV-oilcoatedBubbleTracking/blob/master/CreateDatafolder.py) create [data](https://uofi.box.com/s/sw9vvcwwh0pjfxlhspk6wisby87mabtn) folder, which includes all the cases.
- [x] run piv processing for all case.(09/19/2020)
- [x] Detect the Raising period.
- [x] Remove the background noise for bubble trajectory tracking.
1) Call image sequence: ‘file’-‘import’-‘image sequence’
2) Compute background: ‘image’-‘stacks’-‘z project’-‘projection type:min intensity’
3) Remove background: ‘process’-‘image calculator’-‘operatioin:substract’
4) Sharpen the contrast: ‘process-‘enhance contrast’-‘saturated pixels:0.3%’
5) Save filtered sequence: ‘file’-‘save as’-‘image sequence’-‘format:jpeg’
- [x] PTV point detection, Gaussian kernel blob detection.
1) Face the problem about the laser light too light for some frames that it hard to detect the blob shape for certain case, which cause trajectory divergent and mixing. <ul><li>- [x] </li> solved 09/24/2020 by using predictor method, which use the recently nearby velocity to predict the next frame bubble location. For each case, the bubble size need to be rechecked by applying imageJ local maximum detection.
- [x] Trajectory computing.
Bubble case 3 failed.
1) Top view of trajectory in [TopViewTraj folder](https://uofi.box.com/s/sw9vvcwwh0pjfxlhspk6wisby87mabtn), please use the password I send you to access the data.
If you can't open the matlab figure file Try these two lines code in matlab:
eg.
>>fig = openfig('Graph.fig');
>>set(fig, 'Visible', 'on')
- [ ] PIV-PTV Combine.
TODO--------------------------------------------------------
Using POD to calculate the freq of vortex,
test adding mass effect,
sloshing effect,
for the trajectory frequency change. (10/28/2020)
- [x] Trajectory analysis. **Start** (10/07/2020)
1) trajectory analysis
- [x] PCA best fit plane finding.
Update [TopViewTraj folder](https://uofi.box.com/s/sw9vvcwwh0pjfxlhspk6wisby87mabtn), the projection 2D plane function are shown in x label for each figure, and plotted as red line in the figure.(10/07/2020). The red arrow represents the view point of the following figures for 2D fit plane.
- [x] Side 2d view of trajectory on best fit plane.
Update [SideViewTraj folder](https://uofi.box.com/s/sw9vvcwwh0pjfxlhspk6wisby87mabtn), the side view is 3D trajectory which are viewed from norm vector of best fitting 2D Plane. (10/07/2020)
2) velocity analysis.
- [x] Transverse velocity, vertical speed, and total speed.
Velocity profile [VelocityProfile](https://uofi.box.com/s/sw9vvcwwh0pjfxlhspk6wisby87mabtn), the u, v hortizontal velocity of camera view plane; w is the vertical velocity. Speed is the overall velocity. (10/07/2020)
- [x]
Transerse speed with vertical speed [TransverseSpeed](https://uofi.box.com/s/sw9vvcwwh0pjfxlhspk6wisby87mabtn). **I found a very interesting behavior about damping. For higher oil fraction, the damping motion start disspiating, and higher viscousity oil will trigger it much earlier. My guess this motion of oil with in the bubble can balance the vortex induced vibration. Higher oil fraction have higher inertia and momantum. And lower viscousity oil can be easier to move inside the bubble, which can balance this vibration motion.** Based on this, we can study **actual damping motion, wavelet analysis, Hilbert transform.**
- [x] vertical average speed with oil fraction for each case.
Vertical velocity plot with error bar for two cases average.
[VerticalVelocity](https://uofi.box.com/s/sw9vvcwwh0pjfxlhspk6wisby87mabtn) (10/09/2020)
3) frequency analysis
- [x]
Calualte instantaneous frequency based on first conditional spectral moment.
Overall frequency seems to decrease when oil fraction increase. But pure air bubble also has low frequency. **Hard to conclude** Need discuss. (10/09/2020)
[freqAnalysis](https://uofi.box.com/s/sw9vvcwwh0pjfxlhspk6wisby87mabtn)
Update the freq vs oil fraction plot. (10/14/2020) [freqAnalysis](https://uofi.box.com/s/sw9vvcwwh0pjfxlhspk6wisby87mabtn)
(shot time Fourier transform)
- Compute spectrogram power spectrum P(t,f).
- Estimate the joint time-frequency moment.
4) Amplitude analysis
- [x] Position amplitude. (10/14/2020) FFT only work for periodic case, for dissipation case. May be we can use underdamping function fitting method to calculate the trend of amplitude.
For some case the projection to 2D Plane method didn't work vary well to detection the main amplitude. Maybe due to the small disturbance from 3D, which is consistant with top view. (For example, some case the amplitude peak from frequency domain is not that obvious. I chekc their top view, it is much more like 3D trajectory.)[TransversePositionAmplitude](https://uofi.box.com/s/sw9vvcwwh0pjfxlhspk6wisby87mabtn)
- [x] Fit underdamped harmonic oscillator to the model. Red line indicate the fitting curve, blue line is the original data.
[DampingAmplitude](https://uofi.box.com/s/sw9vvcwwh0pjfxlhspk6wisby87mabtn)
(10/19/2020)
- [x] remake 5 airbubble tracking experiment. This time, use regionprops for tracking. (10/22/2022)
[NewAirBubbleExperimentByBing](https://uofi.box.com/s/sw9vvcwwh0pjfxlhspk6wisby87mabtn)
(10/23/2022)
Excel sheet for vertical speed, transverse speed, freq information, Bing will add amplitude information. (10/28/2020)
[ExcelSheetForInformation](https://uofi.box.com/s/sw9vvcwwh0pjfxlhspk6wisby87mabtn)
5) Five more cases,
- [x] process 6 more cases for trajectory tracking.
[FiveNewCase](https://uofi.box.com/s/sw9vvcwwh0pjfxlhspk6wisby87mabtn)
6) Excel sheet for 2D projected trajectory
[Project2DExcel](https://uofi.box.com/s/sw9vvcwwh0pjfxlhspk6wisby87mabtn)
# Overall process progress report
| Outer needle | Inner needle | Initial oil volume (?L) | deq (mm) | foil | ID | deq | Processing Progress | StartFrame-EndFrame |
| ------------ | ------------ | ----------------------- | -------- | ---- | ------------ | ----------- | -------------------- | ------------------- |
| 8G | 22G | 10 | 4.04 | 0.08 | 1082210X-2 | 3.92869399 | <ul><li>- [x] finished </li> | 711-899 (The last frame is around 890 for bubble hitting the top edge, which may caused piv data missing about induced vortex) |
| 8G | 22G | 10 | 4.04 | 0.08 | 1082210X-3 | 3.92755005 | <ul><li>- [x] Left seperate trajectory, try Link(09/25/2020) **Solved** (09/28/2020) </li> |1024-1349 |
| 8G | 22G | 20 | 4.01 | 0.22 | 1082220X-1 | 3.8863055 | <ul><li>- [x] double check right camera 2 traj (09/25/2020) **Solved** (09/28/2020) </li> |129-449 |
| 8G | 22G | 20 | 4.01 | 0.22 | 1082220X-3 | 3.88859096 | <ul><li>- [x] Left Camera 2 trajs (09/25/2020) **Solved** (09/28/2020) </li> |1056-1349 |
| 8G | 22G | 30 | 4.08 | 0.31 | 1082230X-1 | 3.96551573 | <ul><li>- [x] finished </li> |190-449 |
| 8G | 22G | 30 | 4.08 | 0.31 | 1082230X-4 | 3.97278205 | <ul><li>- [x] finished </li> |1558- 1799 |
| 12G | 22G | 30 | 4.02 | 0.38 | 10122230X-3 | 4.17866011 | <ul><li>- [x] Right Camera has two trajectories. need further process **Solved** (09/28/2020) </li> |998-1349 |
| 12G | 22G | 30 | 4.02 | 0.38 | 10122230X-4 | 4.28105654 | <ul><li>- [x] Right Cmaera has two trajectories