Loading external masks - A single different masks for each frame - "Inverse" masks

classic Classic list List threaded Threaded
4 messages Options
Antoine Antoine
Reply | Threaded
Open this post in threaded view
|

Loading external masks - A single different masks for each frame - "Inverse" masks

Hi William,

I first of all wanted to thank you for your PIVLab Toolbox; it is really great! Thanks! For one of my projects, I am trying to determine the flow inside vibrating small droplets.

Since I have an oscillating droplet, having the same mask for all images is not a solution for me and since I have a lot of images to process, drawing the masks by hand one by one is just impossible... I have been able to compute the polygon for each frame, as shown in the example enclosed, but I found myself stuck. I have two distinct problems:

1) The polygon computed will mask the interior of the droplet and not the exterior, which is actually my ROI...;
2) Since the droplets change in size, the vectors xmask and ymask also change in size, so I have to work with cells (xmask and ymask have to be cells not vectors - at least I haven't found another solution), but this doesn’t work with PIVLab --> I can load a unique mask fine, but not different masks for each frame...;

Maybe it is possible to subtract two masks - the whole image minus the droplet-mask - but I don’t know how to do that…

For now, I have find an “okay" solution by multiplying the original image by the mask. But I do get some issues at the boundary of the droplet.

Thanks a lot for your reply,

Antoine

William William
Reply | Threaded
Open this post in threaded view
|

Re: Loading external masks - A single different masks for each frame - "Inverse" masks

Hi Antoine,
I don't have a solution right now, but I am sure there is one...
I think there was a code version linked in this forum, where PIVlab calculated "NaNs" in image areas that are completely black. Would that help?
You could also expand the binary mask a bit, so that there is enough space around the boundary of the droplet. Matlab has tons of code examples for mask/binary image operations.

Please consider donating for the PIVlab project:
http://paypal.me/pools/c/81Y8wBVi4y

The developer needs to update to a recent Matlab release in order to keep the project running.

Antoine Antoine
Reply | Threaded
Open this post in threaded view
|

Re: Loading external masks - A single different masks for each frame - "Inverse" masks

Hi William,

I finally succeeded in building the correct mask. I cheated a bit by drawing a small artificial "white portion" (which I can then eliminate with the ROI zone) to make the polygon go around the droplet AND the boarder of the image, as shown in the image enclosed.

I also managed to create a unique size xmask / ymask by just completing the frames with less points with 0.

Thanks again,
Antoine


 
William William
Reply | Threaded
Open this post in threaded view
|

Re: Loading external masks - A single different masks for each frame - "Inverse" masks

Good to hear!

Please consider donating for the PIVlab project:
http://paypal.me/pools/c/81Y8wBVi4y

The developer needs to update to a recent Matlab release in order to keep the project running.