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!