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

Complete Edge Detect Module #771

Merged
merged 45 commits into from Mar 17, 2019
Merged

Complete Edge Detect Module #771

merged 45 commits into from Mar 17, 2019

Conversation

harshkhandeparkar
Copy link
Member

@harshkhandeparkar harshkhandeparkar commented Feb 14, 2019

Fixes #176

  • Hysteresis is implemented(it slows down the browsers very significantly)
  • Black background
  • General refactoring

It Works!!

Old:
edge-detect 6

  • This output had a lot of transparency(alpha = 0)
  • Thick edges
  • No hysteresis

New:
edge-detect 5

  • Black background
  • No transparency
  • Pure white edges
  • Thin edges
Note: The default high and low threshold ratio values are not necessarily meant to be the best. They are to be found empirically for different cases.
Note: Higher high threshold takes less time to process but it's lossier (some edges are neglected).
Note: Lower low/high threshold takes very long to process and can render a browser unresponsive.
Note: Low threshold ratio can be greater than the high threshold ratio since it is multiplied to the high threshold value. i.e low_threshold_ratio = low_threshold_value/high_threshold_value and high_threshold_ratio = high_threshold_value/maximum_gradient
Note: Here value is the actual value which is compared to the gradients and ratio is a relative ratio of different values.

It is slow though

too-slow-edge-detect

It takes very long to iterate through all the edges. This algorithm/module should be mainly used on servers. This can benefit a lot from the REST API project which is under development.

@publiclab/is-reviewers @jywarren

Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!

  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with npm test
  • code is in uniquely-named feature branch and has no merge conflicts
  • PR is descriptively titled
  • ask @publiclab/reviewers and @publiclab/is-reviewers for help, in a comment below

Thanks!

tech4GT and others added 30 commits December 27, 2018 19:00
Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

dist update

Revert "dist update"

This reverts commit 9ee2a98.
Conflicts:
	dist/image-sequencer-ui.min.js
	dist/image-sequencer.js
	dist/image-sequencer.min.js
	src/modules/PaintBucket/info.json
	src/modules/Rotate/info.json
* default sequencer ui test

* default step ui test suite

* intermediate step ui test

* preview ui test suite

* url methods test suite

* add set url params method test suite

* argument call tests

* test directory refactor

* travis fix
* CLI refactor

* es6 rollback

* Travis fix

* syntax fix

* clustered require statements

* travis debug

* travis debug
)

* Added line making module selection correct after adding a step

* Added line with appropriate module selection
* WIP

* module testing harness

* adjustments
* changes

* changes

* changes

* changes

* changes

* changes
@harshkhandeparkar harshkhandeparkar requested review from a team and removed request for Mridul97 March 14, 2019 17:02
@jywarren
Copy link
Member

Ah, did you manage to add the addition so that hysteresis defaults to false, and is an option (with checkbox?) Thank you!!!

@harshkhandeparkar
Copy link
Member Author

I will add everything as soon as I get time so I was asking for all the required suggestions.

@harshkhandeparkar
Copy link
Member Author

@jywarren I have rebased and made all the changes. A demo will be available here

@harshkhandeparkar
Copy link
Member Author

Please try to merge this before the others. Thank you!

@harshkhandeparkar
Copy link
Member Author

Oh yea, please be sure to clear the cache.

@harshkhandeparkar
Copy link
Member Author

harshkhandeparkar commented Mar 17, 2019

An updated link demo will be available here. Sorry for the inconvenience.

@harshkhandeparkar
Copy link
Member Author

@jywarren I think this is ready to merge. I have checked everything. It works. Below is hysteresis v/s non-hysteresis comparison(left image is without hysteresis).

Screenshot from 2019-03-17 11-12-40

Thank You!

cc @tech4GT @publiclab/is-reviewers

@harshithpabbati
Copy link

Hey Harsh the UI looks different in mobile.

@harshkhandeparkar
Copy link
Member Author

Hello harshith, try clearing the cache and do not use the new UI. And css will be fixed by @aashna27

@harshithpabbati
Copy link

harshithpabbati commented Mar 17, 2019

EDIT: image removed as it covers the whole screen
check this out. I cleared the cache.

@harshkhandeparkar
Copy link
Member Author

I removed your image because it was covering the screen. That issue will be fixed by @aashna27 in #867

@harshithpabbati
Copy link

If you want I can make the changes in css.

@harshkhandeparkar
Copy link
Member Author

Atleast not now. As I turned off my pc and won't be able to do anything. You can open a pr in my gh-pages branch if you want

@harshkhandeparkar
Copy link
Member Author

This current PR focuses on edgeDetect so css isn't much important. If you still want to improve the demo, you can. Thank you.

Copy link
Member

@jywarren jywarren left a comment

Choose a reason for hiding this comment

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

This looks great; I did find a small typo. Did you want to add a quick test to this using looks-like to protect it against future bugs? I think that's a really good idea now that the project is becoming more complex. Thanks!

src/modules/EdgeDetect/Module.js Show resolved Hide resolved
@jywarren
Copy link
Member

And noting that it passed in almost the same amount of time:

this branch: Module edge-detect ran in: 2672 milliseconds
main: Module edge-detect ran in: 2709 milliseconds

@harshkhandeparkar
Copy link
Member Author

It takes a lot less time without hysteresis. Maybe it ran faster here as there is no different gradient and there are less pixels to be preserved. I.e binary image. I'm not sure though.

@harshkhandeparkar
Copy link
Member Author

For the tests, maybe we can open an issue for creation of looks-same tests for all modules.

@jywarren
Copy link
Member

Hi Harsh, i'm OK with merging this without a test, but I think in general we should be transitioning to requiring a test with every module before merging it, rather than doing it in follow-up, as a matter of policy. What do you think?

@harshkhandeparkar
Copy link
Member Author

Yes sure. Thanks. I can add tests to all the remaining modules once I am free and maybe add the new policy to the contributing file.

@jywarren jywarren merged commit c645732 into publiclab:main Mar 17, 2019
@jywarren
Copy link
Member

Great, thank you! Really nice work here!

@harshkhandeparkar
Copy link
Member Author

Thanks a lot!!! @harshithpabbati this was just merged. Try running tge update script when you get time. Let's see if the changes are visible there.

@harshithpabbati
Copy link

Sure @harshkhandeparkar I will run it now.

@harshkhandeparkar harshkhandeparkar deleted the complete-edge-detect branch June 7, 2019 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants