Gradient Computation of Matrix
조회 수: 25 (최근 30일)
이전 댓글 표시
Given a Matrix for example:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/641405/image.png)
I need two Compuation Matrix such that
Gx = ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/641410/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/641410/image.png)
Gy = ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/641415/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/641415/image.png)
I am trying using gradient but not getting the exact results.
I also need to calculate the Magnitude of Gx and Gy such that my final matrix results as:
Resultant Matrix :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/641420/image.jpeg)
Also need to caluclate the Angle of Gx and Gy (arctan(Gy/Gx)) degree.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/641440/image.png)
All element values should be rounded off in all the matrix.
I need a general code which do not depend(size of input matrix) on matrix rows and coloumns of the given input matrix.
Please help with MATLAB Code.
댓글 수: 0
답변 (1개)
Sulaymon Eshkabilov
2021년 6월 3일
[Gx, Gy] = gradient(G)
And dont forget elementwise operation: ./
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!