Version 1.0.0 (279 KB) by Azhar
nothing to show


Updated 2 Jul 2022

View License

%Reading Images image = imread('C:\Users\hp\Desktop\Other Works\NewDataSet\4.jpeg'); subplot(4,4,1); imshow(image); title('Original'); %Resizing Images resize = imresize(image,[500 700]); subplot(4,4,2); imshow(resize); title('Resized'); %RGB to Gray Conversion BW = rgb2gray(resize); subplot(4,4,3); imshow(BW); title('Black & White'); subplot(4,4,4); imhist(BW); title('Histogram'); %Equalizing Histogram new = histeq(BW); subplot(4,4,5); imshow(new); subplot(4,4,6); imhist(new,64); title('Equalized Histogram'); %Converting to Binary binary = im2bw(new,0.07); subplot(4,4,7); imshow(binary); title('Binary Image'); %Canny Filter Application BW2 = edge(binary,'canny',0.99); subplot(4,4,8); imshow(BW2); title('canny Filter'); %%Image Segmentation se0 = strel('square',9); BWsdil = imdilate(BW2,se0); subplot(4,4,9); imshow(BWsdil) title('Dilated Gradient Mask') BWdfill = imfill(BWsdil,'holes'); subplot(4,4,10); imshow(BWdfill) title('Binary Image with Filled Holes') seD = strel('disk',1,4); BWfinal = imerode(BWdfill,seD); BWfinal = imerode(BWfinal,seD); subplot(4,4,11); imshow(BWfinal) title('Segmented Image'); % Binarize the image. mask = imbinarize(double(BWfinal)); % Fill holes. mask = imfill(mask, 'holes'); % Take largest blob only. mask = bwareafilt(mask, 1); subplot(4, 4, 12); imshow(mask) title('Mask') % Compute the skeleton skelImage = bwmorph(mask,'skel',Inf); subplot(4, 4, 13); imshow(skelImage) title('Thinned') % Compute the Euclidean distance image. edtImage = bwdist(~mask); subplot(4, 4, 14); imshow(edtImage) title('Distance Transform Image'); diameterImage = 2 * edtImage .* single(skelImage); subplot(4, 4, 15); imshow(diameterImage) title('Diameter Image'); % Get the widths. These will be where the image is not zero. widths = diameterImage(diameterImage > 0); % Show histogram of widths. subplot(4, 4, 16); histogram(widths); grid on; xlabel('Width in Pixels'); ylabel('Count'); % Calculating mean width (1st parameter) widthmean = mean(widths) % Drawing line on mean width of red color line([widthmean, widthmean], ylim, 'LineWidth', 2, 'Color', 'r'); caption = sprintf('Histogram of Widths. Mean Width = %.1f Pixels', widthmean); title(caption); %Calculation of Ratio (2nd parameter) ratio = nnz(mask)/numel(mask); %Calculation of Gaussian (3rd Parameter) - to be done [fx,fy] = gradient(diameterImage); [fxx,fxy] = gradient(fx); [~,fyy] = gradient(fy); K = (fxx.*fyy - fxy.^2)./((1 + fx.^2 + fy.^2).^2); figure;mesh(K); title('Gaussian Curvature','FontSize',20); These two parameters are required to calculate gaussian parameters. Once mean and SD have been calculated try to execute the given code to generate a distribution curve. So you just need to calculate SD from your last code. Update me about the results. mean = 10; sd = 4; x = linspace(-4*sd,4*sd,1000); y = 1/(2*pi*sd)*exp(-(x-mu).^2/(2*sd^2)); plot(x,y);

Cite As

Azhar (2023). fasadi (https://www.mathworks.com/matlabcentral/fileexchange/114465-fasadi), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2022a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes