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

test example won't work #16

Open
psihonavt opened this issue Nov 4, 2014 · 4 comments
Open

test example won't work #16

psihonavt opened this issue Nov 4, 2014 · 4 comments

Comments

@psihonavt
Copy link

As notes stated:
Run it on test file: python split.py ../src/puzzle.tif

  1. There is no such file, I was trying with ../src/puzzle.tif:
Processing file ../src/puzzle_small.tif
OpenCV Error: Sizes of input arguments do not match (The lower bounary is neither an array of the same size and same type as src, nor a scalar) in inRange, file /build/buildd/opencv-2.4.2+dfsg/modules/core/src/arithm.cpp, line 2527
Traceback (most recent call last):
  File "split.py", line 162, in <module>
    sheet.export_results_as_html()
  File "split.py", line 103, in export_results_as_html
    img_with_overlay = self.overlay_contours()
  File "split.py", line 92, in overlay_contours
    contours = map(lambda x: x.contour, self.get_shreds())
  File "split.py", line 135, in get_shreds
    return self.sheet.get_shreds(self.feature_extractors, self.sheet_name)
  File "/home/akoval/projects/unshred/unshred/sheet.py", line 93, in get_shreds
    contours, _ = cv2.findContours(self._foreground_mask,
  File "/home/akoval/projects/unshred/unshred/sheet.py", line 242, in _foreground_mask
    self._fg_mask = self._find_foreground_mask()
  File "/home/akoval/projects/unshred/unshred/sheet.py", line 211, in _find_foreground_mask
    mask = cv2.bitwise_or(mask, cv2.inRange(hsv, rng[0], rng[1]))
cv2.error: /build/buildd/opencv-2.4.2+dfsg/modules/core/src/arithm.cpp:2527: error: (-209) The lower bounary is neither an array of the same size and same type as src, nor a scalar in function inRange

So, problem in this guy cv2.inRange(hsv, rng[0], rng[1]). According to documentation src (hsv in our case) should be the same size as upper/lower boundaries (rng[0], rng[1]). But hsv is multidimensional array while ranges are not.

@dchaplinsky
Copy link
Owner

Works just fine on my local instance.

Can you post version of OpenCV lib here?

@psihonavt
Copy link
Author

>>> import cv2
>>> cv2.__version__
'2.4.2'

@dchaplinsky
Copy link
Owner

2.4.9 is required. Try to update your version and let me know if this helped.

@dchaplinsky
Copy link
Owner

Updated README.md. Thanks for pointing it.

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

No branches or pull requests

2 participants