From: Nicky on
I am trying to take the equalization of an image, but only in a certain region. So what I have tried doing is use the roipoly function to select my region of interest:

im = imread('test.jpg');
gray = rgb2gray(im);
BW = roipoly(im);
roi = gray.*uint8(BW);

And then use the histeq function on just the region of interest:

eq = histeq(roi);

but whenever I show the eq variable it only gives a red screen, rather than the equalized image. Can anyone give me any pointers on if I am misusing the functions, or if there is a better one that I could look into? Also, is there a better way to get the original image data, but only within the ROI logical mask (line 4)? I want to use logical indexing, but if I do something like roi = gray(BW); it converts the image matrix into one single row. Thank you for the help