Grey Slicing Image Function
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!