I'm trying to segment an RGB image based on it's histograms; my code is as follows:
Red = img(:,:,1);
Green = img(:,:,2);
Blue = img(:,:,3);
[yRed, x] = imhist(Red);
[yGreen, x] = imhist(Green);
[yBlue, x] = imhist(Blue);
plot(x, yRed, 'Red', x, yGreen, 'Green', x, yBlue, 'Blue');
histRGB = hist([imhist(Red), imhist(Green), imhist(Blue)]);
histMask = img.*uint8(histRGB);
I get the following error when compiling this section: "Array dimensions must match for binary array op." I'm not sure how to fix this, as I'm not well versed in Matlab currently.
Any help will be appreciated!