Creating exclusion masks for PIVlab – ‘no mask found’ error

18 views
Skip to first unread message

Andrea Pasqua

unread,
Jun 11, 2025, 5:21:16 AMJun 11
to PIVlab

Hello everyone,

I’m working with PIVlab and trying to create exclusion masks via a MATLAB script. The script generates a cell array per frame, where each cell is itself a 1x5 cell array structured as follows:

  • cell{1,1} = the string 'ROI_object_polygon'

  • cell{1,2} = the polygon vertex coordinates (x,y)

  • cell{1,3}, cell{1,4}, and cell{1,5} = unclear to me

When I load my generated .mat file into PIVlab, it throws an error saying “no mask found”. I suspect the issue lies in the contents or format of cells 3, 4, and 5, but I haven’t found clear documentation or examples describing what those should contain.

Could anyone share insights or examples on the required format or contents of these cells so that PIVlab correctly recognizes the mask?

Thank you in advance for any help!

Best regards,
Andrea


William

unread,
Jun 15, 2025, 8:28:05 AMJun 15
to PIVlab
Hi, the error message is thrown because your mat file does not contain a variable named masks_in_frame:
https://github.com/Shrediquette/PIVlab/blob/main/%2Bmask%2Fload_Callback.m
I would recommend to draw a mask in pivlab and save it, then learn the structure in the mat file from there.

Andrea Pasqua

unread,
Jun 16, 2025, 6:53:36 AMJun 16
to PIVlab
Thank you William! Now it is working! 

Thanks for your help!

Have a great day
Reply all
Reply to author
Forward
0 new messages