Increase brightness in part of an image

Hi, I was wondering if anyone would know if it is possible to do something like what I present in the following picture.
The image I'm interested in treating is one of 8000x8000 pixels size and in gray scale, what I really need is to vary the brightness of a certain region of the image.
(What I'm enclosing is a bit of a mess, but I think it exemplifies well what I need. It's made with photoshop)

6 Comments

Unfortunately the attached image is broken :(
Examples:
IMG(317:409, 588:1102) = IMG(317:409, 588:1102) * 1.17;
IMG(317:409, 588:1102) = IMG(317:409, 588:1102) + 12;
Maybe now is fixed, sorry...
That's a nice way of putting it, but it's a complex geometry for a change. I was looking for something more automatic, not having to search through which pixels are comprised.
Unfortunately my browser still complains that the attached bmp contain errors. Perhaps convert it to png and attach that.

Sign in to comment.

 Accepted Answer

Depending on how you are constructing your "complex geometry", sometimes you can construct masks to select pixels. For example you might be able to use poly2mask() . Or sometimes it can be useful to use Computer Vision's insertshape() to paint various shapes into an array, after which you would binarize it (because insertshape() always creates rgb) and use it as the mask.

5 Comments

Ok, i can try with that, thank you. Tell me if you can see the image now.
You could have just given the example of cameraman.tif ;-)
I can see it, but we do not really know what your idea of a "complex geometry" would be. Perhaps you want to do some region detection and turn that into a mask and use that.
Yes is the cameraman example but I changed the tone and saturation of the jacket using the adobe quick selection tool, the idea was to get something similar but using Matlab.
Or some way to be able to change the contrast only of the region I'm interested in. Otherwise I will use some mask and then multiply the original image by this mask...
The question is going to be how you convey to MATLAB which region you are interested in.
Perhaps you might want to use a freehand ROI, such as https://www.mathworks.com/help/images/ref/images.roi.freehand.html
MATLAB does not give any ability to only apply desired functions within a region of interest. But you can createMask() on ROI and use the mask as logical indexes to select data:
mask = createMask(MyROI);
olddata = MyImage(mask);
newdata = imadjust(olddata);
NewImage = MyImage;
NewImage(mask) = newdata;
Ok, thank you so much for all!!!

Sign in to comment.

More Answers (0)

Products

Release

R2020a

Community Treasure Hunt

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

Start Hunting!