HOW TO IDENTIFY MEAN AND STANDARD DEVIATION FOR THIS CODE?
Mostrar comentarios más antiguos
Read image by its file name
I = imread('.');
I=imresize(I,[256 256]);
I=im2double(I);
imshow(I)
% Convert RGB to HSV
img1=rgb2hsv(I);
figure(), subplot(2, 2, 1), imshow(I), title('Original')
subplot(2, 2, 2), imshow(img1(:,:,1)), title('Hue'), colorbar
subplot(2, 2, 3), imshow(img1(:,:,2)), title('Saturation'), colorbar
subplot(2, 2, 4), imshow(img1(:,:,3)), title('Value of Brightness'), colorbar
H=img1(:,:,1).*255;
S=img1(:,:,2).*255;
V=img1(:,:,3).*255;
% H(:,:,1) = H(:,:,1) * 2.5;
% min. and max value of hsv
Hmin = min(H(:));
Smin = min(S(:));
Vmin = min(V(:));
Hmax = max(H(:));
Smax = max(S(:));
Vmax = max(V(:));
%Set the hue value to zero if it
%less than 50 or great than 150
H((H < 50) | (H > 150)) = 0;
%Set the hue value of wheat straw
% pixel to zero
H(H > 49 & H < 60 & S > 5 & S < 50 & V > 150) = 0;
%Thresholding
T = 49; %T can be any value in [1, 49]
t = T./255;
BW = im2bw(H, t);
%Delete the objects less than 100 pixels
BW = bwareaopen(BW, 100);
%Show the identification result
figure, imshow(BW);
% Calculate the area, in pixels, of binary image.
numberOfPixels1 = sum(BW(:));
% Another way to calculate it that takes fractional pixels into account.
numberOfPixels2 = bwarea(BW);
% CALCULATE PARAMETERS
I =rgb2gray(I);
I=double(I);
BW =(BW);
% % % Find the mean squared error
mse = sum((I(:)-BW(:)).^2) / numel(I);
%
% % % now find the psnr, as peak=255
psnr = 10*log10(255*255/mse);
3 comentarios
Adam Danz
el 17 de Jun. de 2019
TLDR
Mean and std of what variable?
tashu Dabariya
el 17 de Jun. de 2019
tashu Dabariya
el 17 de Jun. de 2019
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Image Arithmetic en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!