Hi William! Thank you for your effort for PIVlab.
It gives me a great chance to start a research using PIV.
Now I try to analyze two-phase flow (liquid-vapor) by PIV.
As you know when I want to get the liquid velocity in two-phase flow, bubble could be a noise.
So I want to make bubble area into a mask.
I got a binary image of the bubble by MATLAB, but I couldn’t apply the binary image as a mask.
Could you give me an advise for it?
Hi William, PIVlab is a great tool, thanks a lot!
I am having some trouble uploading a mask, every time I upload a mat file nothing happens and no mask appears.
I created a mask by generating a cell variable containing as many columns as images and in each column I placed a matrix with two column, the first is the x and the second is the y coordinates of the polygon I want to mask. Then I saved the variable as a .mat file. Something like this:
[c,x,y]=roipoly(rand(152,231)) % here I choose the polygon
for i=1:totNumberImages % assuming I want the same mask for all images
When I upload mask.mat nothing happens.
Can you give me a suggestion please?
Thanks William, I solved the previous problem (my mistake, I didn't understand your explanation).
I have another question: how can I create a mask composed of different polygons for each frame?
In my images I have more than one object that I need to mask in each frame and I can recognize them via Matlab so it would be useful to be able to upload my custom masks automatically instead of drawing one by one for 50 frames.
You could modify them to load multiple masks per frame. In order to understand the data structure, I recommend to load some images, draw some masks, save as PIVlab session, and then load this session file in Matlab, and have a look at the variables maskiererx and maskierery. I think it's not really difficult.
Thanks for the suggestion William.
It was easy to implement the possibility to import multiple masks per frame.
If anybody is interested, here's how I changed the part of the code to import external masks.
%1 2 3 4
%12 34 56 78
You need to upload a .mat file containing xmask and ymask as cell arrays instead of matrix so the columns represent the frames and each row correspond to a different mask for that frame. Easy.