In[]:=
vid=Import[FileNameJoin[{$HomeDirectory,"Downloads","water.mp4"}]]
Out[]=
In[]:=
Spectrogram[Audio[vid]]
Out[]=
In[]:=
frames=VideoExtractFrames[vid,Interval[{Quantity[0.0,"Seconds"],Quantity[2.0,"Seconds"]}]];Length[frames]
Out[]=
61
we should probably remove the string.
In[]:=
framesCropped=ImageCrop[#,{Full,200},Bottom]&/@frames;framesCropped[[;;2]]
Out[]=
,
In[]:=
framesGray=ImageEffect[#,"Decolorization"]&/@framesCropped;framesGray[[;;2]]
Out[]=
,
In[]:=
diffs=ImageDifference[Blur[#[[1]]],Blur[#[[2]]]]&/@Partition[framesGray,2,1];ImageAdjust/@diffs[[;;2]]
Out[]=
,
In[]:=
Mean[diffs]
Out[]=
In[]:=
maxes=Max/@diffs;maxes[[;;10]]Max[maxes]
Out[]=
{0.698039,0.694118,0.6,0.662745,0.647059,0.627451,0.596078,0.545098,0.568627,0.619608}
Out[]=
0.721569
In[]:=
SmoothHistogram[maxes]
Out[]=
In[]:=
means=Mean@Mean[ImageData[#]]&/@diffs;means[[;;10]]Max[means]Mean[means]Min[means]
Out[]=
{0.111847,0.109459,0.0943154,0.102543,0.0925802,0.0927434,0.08399,0.0786787,0.0664864,0.0679128}
Out[]=
0.118092
Out[]=
0.0757428
Out[]=
0.0426476
There does not appear to be enough trackable features on the water’s surface to estimate flow from image descriptors automatically. Perhaps this is possible with some custom correspondence algorithm.
Maybe there is something we can do with gaussian derivatives?
We can find the median difference between frames
Let’s try another filter