MATLAB: Extract white minerals from background

backgroundextractMATLABmineralnoiseroundnessshape

i have a jpg of a number of minerals with 2 nikol and i need to end up with an image with just the light colored minerals and more importantly their shape intact cause i'll need the best shape possible to calculate their roundness, i'm interested in getting the white ones (also slightly gray) turned into black shape and eliminate the background (noise, colored minerals and dark ones)rendering it white, thanks in advance

Best Answer

You may be able to achieve this by using Color-Based Segmentation. There are two examples that may help you get started: