Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intelligent scissors disabling feature #3510

Merged
merged 21 commits into from
Aug 18, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added comments
  • Loading branch information
klakhov committed Aug 13, 2021
commit 4d16849e5558413650ef3b915b746f231bf84a0e
3 changes: 3 additions & 0 deletions cvat-ui/src/utils/opencv-wrapper/intelligent-scissors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,14 @@ export default class IntelligentScissorsImplementation implements IntelligentSci
const yDiff = prevY - curY;
if (xDiff !== 0 && yDiff !== 0) {
const pathLength = Math.sqrt((xDiff) ** 2 + (yDiff) ** 2);
// absolute offset value
const pathOffsetValue = 0.4;
// get how much absolute offset takes from path length
const pathOffsetRatio = pathOffsetValue / pathLength;
pathSegment.push((curX + offsetX) + xDiff * pathOffsetRatio,
(curY + offsetY) + yDiff * pathOffsetRatio);
} else {
// in case points have the same coordinates just use constant offset
pathSegment.push(curX + offsetX + 0.25, curY + offsetY + 0.25);
}
}
Expand Down