Grey Slicing Image Function
7 次查看(过去 30 天)
显示 更早的评论
I am trying to create a function to grey slice images using this piecewise function given by my professor:

I am running into some issues right now with setting the intensity values.
function outImage = baker10(inImage, intensities)
% convert input image to grayscale
grayImage = colorToGray(inImage);
% obtain the image size
[M, N, P] = size(grayImage);
% convert image to type double for MATLAB operations
tempim = double(inimage);
% create space for the grayscale image
outImage = zeros(M,N,3);
intensities[
% the image is converted to gray-scale by making setting RGB equal
% to the intensity of the pixel
for m = 1 : 1 : M
for n = 1 : 1 : N
for p = 1 : 1 : P
if tempim(m,n,p) < intesities(m)
outImage(m,n,p) = 0;
elseif tempim(m,n,p) >= intensities(m) && tempim(m,n,p)...
<= intensities(n);
outImage(m,n,p) = intensities(m,n,p);
else tempim(m,n,p) > intensities(n)
outImage(m,n,p) = 0;
end
end
end
% convert image back to type uint8
outImage = uint8(outImage);
outImage = outImage * 255;
end
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!