Issues with a thresholding function
Show older comments
I have the following function:
function rgbMap = thresholdFunction(x)
rArray=zeros(size(numel(x)));
gArray=zeros(size(numel(x)));
bArray=zeros(size(numel(x)));
rArray(x>110 & x<=152) = 255;
gArray(x<=110) = 255;
bArray(x>152) = 255;
rgbMap = cat(3,rArray,gArray,bArray);
end
Which then gives the error message: 'Dimensions being concatenated are not consistent'
The function is designed to apply thresholds to a grayscale image which is the input 'x', and give a colormap of the different value selections 'rgbMap'.
The reason I'm using a function instead of applying the thresholds directly to the image, is because it's part of a batch processing code, and so 'x' would end up being more than one image being put through a 'for' loop.
I am fairly new to Matlab so if I'm doing something ridiculously stupid, feel free to point it out!
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!