Issues with a thresholding function
显示 更早的评论
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!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!