Weighted adjacency matrix of an image using energy function
Creates a weighted adjacency matrix from a energy matrix (E) for an image. Average, similarity and dissimilarity between the nodes i,j can be computed. If a custom energy matrix is provided, the same functions can be used to fill the adjacency matrix with edge weights.
Type | Images |
---|---|
4-noded unidirection | |
4-noded bidirection | |
8-noded, six edges, vertical and cross directions | |
8-noded, eight edges, unidirection | |
8-noded, eight edges, bidirection |
MATLAB
Please use the demo.m
to run the program.
Change the hyper parameters accordingly if needed.
% Inputs
h = 3; w = 6; % Image size [height x width]
edgeDirection = 1; % Edge direction 1 - uni | 2 - bi
noded = 8; % Nodes 4-noded, 6-direction, 8-noded (pixels)
weight_type = 'Average'; % Average (E(i), E(j)) / 2
% Similarity (E(i) - E(j))
% Dissimilarity 1 / (E(i) - E(j)).
% Where E is the energy at node i, j.
flowDirection = 'col_wise'; % 'row_wise' | 'col_wise'
- Sometimes
plot(G)
orplot(G,'Layout','force')
produces strange looking graphs.
Some of the MATLAB adjacency functions are adapted from the Stack Overflow.
Please rate and provide feedback for the further improvements.
Cite As
Preetham Manjunatha (2024). Weighted adjacency matrix of an image using energy function (https://github.com/preethamam/Weighted-Adjacency-Matrix-of-Image/releases/tag/1.3.3), GitHub. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.3.3 | See release notes for this release on GitHub: https://github.com/preethamam/Weighted-Adjacency-Matrix-of-Image/releases/tag/1.3.3 |
||
1.3.2 | See release notes for this release on GitHub: https://github.com/preethamam/Weighted-Adjacency-Matrix-of-Image/releases/tag/1.3.2 |
||
1.3.0 | See release notes for this release on GitHub: https://github.com/preethamam/Weighted-Adjacency-Matrix-of-Image/releases/tag/1.3.0 |
||
1.0.1 | See release notes for this release on GitHub: https://github.com/preethamam/Weighted-Adjacency-Matrix-of-Image/releases/tag/1.0.1 |
||
1.0.0 |