- “fprintf" documentation: Display value of variable - MATLAB disp
- “flip” image in MATLAB: Flip order of elements - MATLAB flip
- “imabsdiff” to calculate the difference of two images: Absolute difference of two images - MATLAB imabsdiff
Is there a way to quantify symmetry in a Image or a CAD file
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a image or a CAD file such as below where I want to quantify assymetry. In the image shown as can be seen visually the blue line in the right is assymetric in relation to the other blue line versus the orange line. Is there a assymetricty metric which one can think about ? Any inputs here will be valuable.
0 comentarios
Respuestas (1)
Suvansh Arora
el 4 de Nov. de 2022
One of the possible ways to quantify the symmetry of an image is to calculate the “Manhattan Norm”.
Please look at the helper function below to calculate the “Manhattan Norm”:
%% Manhattan Norm: To check the Symmetry of Image
%
% man_norm = Img - Img_Flipped;
%
% man_norm_per_img = (Img - Img_flipped)/size(Img);
function [man_norm, man_norm_per_img] = imageSymmetry(Img)
% Horizontal Flipping the Image
Img_Flipped = flip(Img, 2);
% Calculate size of image
[height, width, dim] = size(Img);
% Manhattan Norm calculation
man_norm = sum(imabsdiff(Img, Img_Flipped), 'all');
% Manhattan Norm per pixel calculation
man_norm_per_img = man_norm / (height * width * dim);
end
In order to view the symmetry of an image, call the above helper function:
Img = imread('me.jpg');
help imageSymmetry
[man_norm, man_norm_per_img] = imageSymmetry(Img);
fprintf('Manhattan norm: %d / per pixel: %d\n', man_norm, man_norm_per_img);
In order to know more about the functions used, please follow the documentation below:
I hope the above information helps you.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!