Finds the cropped image inside the original image.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # Waldo!
  2. [![Build Status](https://travis-ci.org/Alir3z4/waldo.svg?branch=master)](https://travis-ci.org/Alir3z4/waldo)
  3. [![codecov](https://codecov.io/gh/Alir3z4/waldo/branch/master/graph/badge.svg)](https://codecov.io/gh/Alir3z4/waldo)
  4. Finds the cropped image in the original one.
  5. Made with ❤ and powered by [OpenCV](https://opencv.org/).
  6. ### Installing
  7. Clone the repo and install.
  8. * `$ git clone git@github.com:Alir3z4/waldo.git && cd waldo`
  9. * `$ python setup.py install`
  10. ### Usage via CLI
  11. The usage via CLI is pretty simple:
  12. ```
  13. Usage: subimage image1.jpeg image2.jpeg --display[Optional]
  14. ```
  15. Args `--display` will give you a nice tiny graphical window to show the result.
  16. Once installed, the binary `subimage` will be available in the path.
  17. To find the top left position:
  18. ```
  19. $ subimage images\landing.JPG images\landing-face.JPG
  20. ```
  21. You can also pass `--display` arg to enable graphical interface to show the result.
  22. ```
  23. $ subimage images\landing.JPG images\landing-face.JPG
  24. ```
  25. ## Using as Library
  26. You can use functionality as an standalone library as well in other programs.
  27. ```
  28. >>> from subimage import SubImage
  29. >>> sub_image = SubImage(first_image_path='images/puzzle.png', second_image_path='images/waldo.png')
  30. >>> sub_image.find_match()
  31. >>> sub_image.tell_top_left()
  32. Top Left: (1300, 852)
  33. >>> sub_image.display() # It will open up a graphical window and shows the result
  34. Exit with pressing 0 (zero).
  35. ```
  36. To find more detailed examples of how to use the library you may have a look at `tests/test_sub_images.py` test case
  37. file.
  38. ### Development
  39. In case you don't want to install the library would like to try it:
  40. * `$ git clone git@github.com:Alir3z4/waldo.git && cd waldo`
  41. * `$ pip install -r requirements-dev.txt`
  42. Since you have not installed it, therefore no `subimage` binary/script will be available, in order to access it, call
  43. the `sumimage.py` as follow:
  44. ```
  45. $ python subimage.py image1.jpeg image2.jpeg --display[Optional]
  46. ```
  47. #### Tests
  48. The implementation is well tested and all the tests can be run via:
  49. ```
  50. $ python setup.py test
  51. ```
  52. #### Code Coverage
  53. To review the code coverage report run:
  54. ```
  55. $ python setup.py coverage
  56. ```
  57. It will generate the code coverage, printed on screen and saved in HTML format under `htmlcov/` dir.
  58. ### CI
  59. On every push travis-CI will trigger the tests and report the code coverage.