Conversation
I wrote some codes in part 3.1&3.2, realize the calculation of the lowest cost path.
troussil
reviewed
Apr 10, 2017
| % Calculat the cost function | ||
| % The gradient strength cost Fg | ||
| dImg = double(dImg); | ||
| [dY, dX] = gradient(dImg); |
Owner
There was a problem hiding this comment.
please document what does the 'gradient' function
troussil
reviewed
Apr 10, 2017
| dFg = 1 - dFg./max(dFg(:)); | ||
|
|
||
| % The zero-crossing cost Fz | ||
| lFz = ~edge(dImg, 'zerocross'); |
Owner
There was a problem hiding this comment.
please recall what does the 'edge' function in a comment
troussil
reviewed
Apr 10, 2017
| % The zero-crossing cost Fz | ||
| lFz = ~edge(dImg, 'zerocross'); | ||
|
|
||
| % The gradient direction Fd ?? |
troussil
reviewed
Apr 10, 2017
|
|
||
| % The gradient direction Fd ?? | ||
| % The Sum: | ||
| dF = dWz.*double(lFz)+ dWg.*dFg; |
Owner
There was a problem hiding this comment.
Do not forget that costs are defined at pixel p from its 8 neighbors (horizontal, vertical and diagonal). Fg is for instance scaled by 1 for diagonal neighbors and by 1/sqrt(2) for horizontal and vertical neighbors. See the paper (eq. 3 and text around).
Owner
|
Nice. Please, modify the code according to my comments and think about testing your code. |
last time I used Fz and Fg to calculate the l(q). this time I add Fd to calculate the l(p,q). and with l(p,q) I modify some code in other functions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I wrote some codes in part 3.1&3.2, realize the calculation of the lowest cost path.