rnbguy / FishPyPano

Stitch two fish eye images to get 360° panorama
MIT License
39 stars 8 forks source link

OpenCV Error: Assertion failed (ssize.width > 0 && ssize.height > 0) in resize #1

Open omek77 opened 6 years ago

omek77 commented 6 years ago

Ranadeep Biswas I have made a new python3 installation. The installation of pip3 install -r requirements. txt went through without errors. I also created the dual_points. json file on the html page.

The first stitch with "python3 /fishpypano. py -i /Volumes/500gb/i. JPG -p dual_point. json" worked, but didn't look good. Then I created the calibrated_data. json with the -c option. Now I get the following error code:

macbook-pro:FishPyPano-master omek$ python3 ./fishpypano.py -i /Volumes/500gb/i.JPG -p dual_point.json OpenCV Error: Assertion failed (ssize.width > 0 && ssize.height > 0) in resize, file /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/resize.cpp, line 4044 Traceback (most recent call last): File "./fishpypano.py", line 514, in <module> img0, img1 = dual.warp_img() File "./fishpypano.py", line 401, in warp_img img0 = self.crop_fisheye_img(self.dual_img, self.cir0_c) File "./fishpypano.py", line 309, in crop_fisheye_img (self.fisheye_size, self.fisheye_size)) cv2.error: /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/resize.cpp:4044: error: (-215) ssize.width > 0 && ssize.height > 0 in function resize

omek77 commented 6 years ago

here is the calibrated_data.json: { "left_circle": { "center": [ 1884.4480542107963, 691.8577978805486 ], "hfov": 201.7327825937073 }, "right_circle": { "center": [ 5147.866460398147, 2017.5354814421303 ], "hfov": 189.80178702977022, "rotate": [ -34.58005270784685, -27.23957716408852, -6.747710903765944 ], "translate": [ -0.47050442205286913, 0.7555779568286467, -0.08799055239511876 ] } }

rnbguy commented 6 years ago

It calibrated wrong centers for the images. Thanks for reporting the issue. I will look into it.

omek77 commented 6 years ago

any news?

rnbguy commented 6 years ago

This issue is fixed. But there are other issues in the stitching engine. I may need to rewrite some parts. So I have not pushed the fix yet. I will announce when I will push the reworked code.

omek77 commented 6 years ago

Ok, i hope the best.

rnbguy commented 6 years ago

@omek77 I have pushed a new update. Let me know if that resolves your issue.

omek77 commented 6 years ago

the calibration won't work: macbook-pro:FishPyPano-master omek$ python3 calibrate.py -p i.JPG Traceback (most recent call last): File "calibrate.py", line 39, in <module> points = np.array(json.load(jh)) File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 296, in load return loads(fp.read(), File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/codecs.py", line 321, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

rnbguy commented 6 years ago

you were supposed to pass the JSON file containing matched points. use the HTML page to generate that file.

omek77 commented 6 years ago
macbook-pro:FishPyPano-master omek$ python3 stitch.py  -c calib_data.json -i a.jpg 
Loaded calibration data..
Projecting fisheye images to equirectangular projection..
Projecting left fisheye image..
Projecting right fisheye image..
Done projecting, starting stitching..
Calculating optical flow and Warping..
OpenCV Error: Assertion failed (dims <= 2 && step[0] > 0) in locateROI, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/matrix.cpp, line 991
Traceback (most recent call last):
  File "stitch.py", line 145, in <module>
    warped_overlap1, warped_overlap2 = util.flow_warp(equi1_overlap, equi2_overlap)
  File "/Users/omek/Downloads/FishPyPano-master/util/flow.py", line 32, in flow_warp
    bot_frame_ = _opt_flow_warp(top_frame, bot_frame, False)
  File "/Users/omek/Downloads/FishPyPano-master/util/flow.py", line 13, in _opt_flow_warp
    img1_gray, img2_gray, None, 0.5, 3, 15, 3, 5, 1.2, 0)
cv2.error: /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/matrix.cpp:991: error: (-215) dims <= 2 && step[0] > 0 in function locateROI
rnbguy commented 6 years ago

can you share the calib_data.json and a.jpg with me?

omek77 commented 6 years ago

a

omek77 commented 6 years ago

calib_and_dual.zip

rnbguy commented 6 years ago

I see it didn't calibrate properly. can you share your matched point file too?

omek77 commented 6 years ago

I have uploaded both files as .zip at the github issue

Am 26.02.2018 um 19:50 schrieb Ranadeep Biswas notifications@github.com:

I see it didn't calibrate properly. can you share your matched point file too?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

rnbguy commented 6 years ago

Sorry. Didn't see that. Thank you.

Anyway, I looked into the points, I see the points are not correctly chosen. I will upload a video illustrating how to choose the points. If the points are okay, it should work fine.

omek77 commented 6 years ago

Ok, i will try it again tomorrow. Thank you for the help

Am 26.02.2018 um 20:02 schrieb Ranadeep Biswas notifications@github.com:

Sorry. Didn't see that. Anyway, I looked into the points, I see the points are not correctly chosen. I will upload a video illustrating how to choose the points. If the points are okay, it should work fine.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

arllllll10 commented 6 years ago

@rnbdev Can you upload the video to show how to choose the points for calibration?