I'm trying to define a custom region of interest over my frame by creating a binary mask and then appling it to the image.
Is there an efficient way for doing so? (maybe using some built-in functions?). The only thing that I came up with is the cycle on all pixels and clearing the ones outside the ROI but it is painfully slow.
I've thought about using some sort of element-wise product between my frame and the mask (with 0s and 1s) but I didn't find anything similar in the built-in functions or in the IPTBX.
Can someone point me to the right direction?
Thanks and kind regards,