MATLAB: Using regionprops to change intensity of blobs

image processingImage Processing Toolboxregionprops

I am having a gray scale image which has certain blobs. The region apart from these blobs has intensity of 0. Using regionprops() I can extract various properties like Area, mean intensity of each blob.
Based on these mean intensity of a blob I want to modify the intensity of that blob. Any ideas on how I can achieve that?

Best Answer

Using regionprops you can also extract the PixelIdxList of the different blobs. You can use that to modify the pixels in the desired region,
S=regionprops(...,'PixelIdxList');
myImage(S(i).PixelIdxList)= new_Intensities;