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!