A comment on my original question. The issue boils down to computing the intersection of implicitly defined surfaces. The blog "Mike on MATLAB Graphics" discussed this issue in a post in 2015.
User TimeCoder turned the ideas discussed in this post were turned into a File Exchange submission Intersection of 2 surfaces.
Jaroslaw Tuszynski submitted another solution to the same problem to File Exchange a few years earlier.
Between these two packages and Mathieu's accepted answer, I should be able to solve my problem.
Still, If I could extract the borders between the different colors in the colored image above, I would be done. I wonder how to do this..