create irregular regions in a RGB image

1 view (last 30 days)
Goodmorning,
I'd like to create some irregular regions in a RGB image with an effect similar to contour plots.
I have to work on these regions for example modifying contrast, saturation or luminance into every region created.
As a consequence I think that the drawfreehand and roipoly commands are not suited for my purpose because I saw that they create a mask on which I can't apply transformations named above.
Do you know if is there the possibility to obtain this effect?
Thank you,
Sara

Answers (1)

Pratheek Punchathody
Pratheek Punchathody on 4 Sep 2020
Hi Sara,
To my understanding you want to create an irregular regions in the image and modify the variable properties of that regions such as contrast, saturation or luminance.
Please follow this code in which I have created an irregular region in the image using "images.roi.AssistedFreehand()" and "draw()" function.
%%code starts here
I=imread('_DSC2845.jpg');
imshow(I);
shape = images.roi.AssistedFreehand;
draw(shape);
BW = createMask(shape);
BW(:,:,2) = BW;
BW(:,:,3) = BW(:,:,1);
I(BW) = imadjust(I(BW),[0.3 0.8],[]);
imshow(I);
%%code ends here
Basic idea is to create a binary mask for the required irregular region and then perform the modifications to the region and map it to the original image.
This is the original image on top of which the irregular region is created.
The irregular region which is created is modified by changing the contrast and intensity.
Use "imadjust()" to map the intensity values of the image.
Please look into the documentation of changing the "Saturation"

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!