Hey, i'm new to matlab please help me understand the following statement.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Fatima Rashid
am 26 Jun. 2018
Bearbeitet: Jonathon Gibson
am 26 Jun. 2018
Ix = [diff(S,1,2) , S(:,1,:) - S(:,end,:)];
Note: S is an image
1 Kommentar
Akzeptierte Antwort
Jonathon Gibson
am 26 Jun. 2018
Bearbeitet: Jonathon Gibson
am 26 Jun. 2018
diff(S,1,2) will return the difference between each adjacent pair of columns in S, this is approximating the x-derivative of the image using finite differences, f(x+1)-f(x). But if your matrix is m x n, then diff will return an m x (n-1) matrix. So what the second part, S(:,1,:) - S(:,end,:), is doing is concatenating another column to get an m x n matrix back. That last column in Ix is the difference between the first and the last column of S, effectively doing the same thing that diff did, but wrapping around the edge of the image.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!