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 with OpenCV javascript #2689

Merged
merged 36 commits into from
Feb 3, 2021
Merged

Intelligent scissors with OpenCV javascript #2689

merged 36 commits into from
Feb 3, 2021

Conversation

bsekachev
Copy link
Member

@bsekachev bsekachev commented Jan 20, 2021

Motivation and context

Integration of OpenCV.js library into CVAT. Now Intelligent Scissors have been added (resolved #336), but we expect more functions in the future.

Threshold maintenance using ctrl + mousewheel
Screenshot from 2021-01-20 13-55-29
Screenshot from 2021-01-20 13-55-52

How has this been tested?

Manual testing

Checklist

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.
  • I have updated the license header for each file (see an example below)

@nmanovic
Copy link
Contributor

Great!
/cc @dkurt @alvoron @SimpleVlad

cvat/apps/opencv/static/opencv/js/opencv.js

It would be nice to store somewhere some instructions how to update this file in the future

@alalek , do you think we can place information about the integration somewhere on OpenCV site? For example, tutorial or demo page? Let's say a statement like "the feature is integrated into CVAT annotation tool and you can try it online on cvat.org".

}

public async initialize(onProgress: (percent: number) => void): Promise<void> {
const response = await fetch(`${baseURL}/opencv/opencv.js`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider it as server API and add into server-proxy?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@nmanovic
Copy link
Contributor

@bsekachev , build bs/opencv and got the following error:

image

@nmanovic
Copy link
Contributor

commit b20f5028dfa74b8e63bc7a4180aa064e5ed4dda7 (HEAD -> bs/opencv, origin/bs/opencv)
Author: Boris Sekachev <boris.sekachev@intel.com>
Date:   Thu Jan 28 12:22:59 2021 +0300

    Fixed corner case

@ActiveChooN
Copy link
Contributor

Most works really fine, but have some thoughts.

  1. If we have no script on related path, click on load button will be completed with success icon.
  2. Threshold can be configurated with consts or state for larger working area for example.
  3. Sometimes i've got an error message when move pointer fast enough. It quite rare and i connot record this case.
  4. Guess we can improve interactivity by starting interactor if only previous interaction has finished. Without it you can only achieve interaction result when mouse pointer stops moving.

@bsekachev
Copy link
Member Author

@bsekachev , build bs/opencv and got the following error:

@nmanovic Forgot to setup server & proxy, fixed.

@bsekachev
Copy link
Member Author

@ActiveChooN

If we have no script on related path, click on load button will be completed with success icon.

Fixed.

Threshold can be configurated with consts or state for larger working area for example.

Ideally it should be configurated in UI, but it would be difficult to unify UI for all possible thresholds with different tools from OpenCV. Now we also do not have thresholds for automatic annotation, maybe it will be done in the future.

Guess we can improve interactivity by starting interactor if only previous interaction has finished. Without it you can only achieve interaction result when mouse pointer stops moving.

I am not sure I understand you correct

@nmanovic
Copy link
Contributor

nmanovic commented Feb 3, 2021

@bsekachev , an alternative way to implement the feature https://www.photoshopessentials.com/basics/selections/magnetic-lasso-tool/. What do you think?

Looks like it is a polygon feature with "shift" pressed but you don't need move the mouse along the boundary precisely.

nmanovic
nmanovic previously approved these changes Feb 3, 2021
Copy link
Contributor

@nmanovic nmanovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Server part looks good for me. I think we can merge it as is for now.

@bsekachev
Copy link
Member Author

Okay, let's merge it as an initial version and look how we can improve it in the future patches.

@jahaniam
Copy link
Contributor

jahaniam commented Feb 12, 2021

@bsekachev @nmanovic Hi guys,
I've tested this feature. It looks great although it mostly works well when there is a clear boundary between background and foreground.

I have these two suggestions:

  1. removing points is done using ctrl + clicking. It is not consistent with normal polygon drawing which is right-clicking. It would have been nicer to be consistent.
  2. It would have been great to automatically draw a point when it is at the end of the rectangle (like how magnetic lasso tool does in photoshop. or how it is done in current cvat when holding shift.)

Thanks again for your work.

@bsekachev
Copy link
Member Author

@jahaniam

Hi, thanks for your feedback. Please, address your comment to dedicated issue #2800

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Intelligent scissors
6 participants