rnbguy / FishPyPano

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

Memory error on stitch #2

Closed kronpano closed 6 years ago

kronpano commented 6 years ago

Hi there, I created two sets of calibration data - one using your web page thingy and the other one by reformatting some PTGui project data. In both cases calibrate works fine but when I try to stitch I always get the following error:

F:\Mi_Sphere_Export\GyroTest\FishPyPano-master> py -3.6 .\stitch.py -d -c .\calib_data.json -i .\test.JPG Loaded calibration data.. Projecting fisheye images to equirectangular projection.. Projecting left fisheye image.. Traceback (most recent call last): File ".\stitch.py", line 84, in equi1 = fisheye_img_to_equirect(img1, np.pi, circles[0]) File ".\stitch.py", line 17, in fisheye_img_to_equirect xy_e = (xy_e / [x_lim / 2, y_lim / 2]) - 1 MemoryError

The zip file contains the image, the control point data created using the web page and the calibration data created from the control points. MemError.zip

Am I doing something wrong here??

Cheers.

P.S.: Interesting - I think you are trying to deform the image so it fits ( and some more clever things CV provides) I was looking into ImageMagick bcmatch (brightness color match), meshwarp (deform) and fisheye2pano to do something similar (all scripts available here: http://www.fmwconcepts.com/imagemagick/bcmatch/index.php )

rnbguy commented 6 years ago

I see the control points are collected correctly, but there are some slight mismatches. Though it gave not so good result because of mismatches, I am able to finish the stitching though. How much RAM does your machine have?

Also, thanks for letting me know about the imagemagick scripts. Right now the flow warping is not very good. This may help.

PS: https://github.com/rnbdev/FishPyPano/blob/master/util/debug.py draws matched point pairs and circles on fisheye image. You can use it to check if the calibration data and control points are good.

kronpano commented 6 years ago

16GB - should be enough. I am not very good with python - is there an option when I call python how much memory I allow it to use for it's environment??

So basically you can run the same command and get a stitched image - some stitch errors but a finished equirectangular image? Hmm, strange.

Had a bit of a play with fisheye2pano imagemagick today - not sure it works with Mi SPhere images but I might be wrong.

kronpano commented 6 years ago

PS F:\Mi_Sphere_Export\PixProTest> py -3.6 Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32

That might be the culprit?? I got a 32bit version on windows 10 Guess I might try to install a 64bit version of Python - see if that helps

kronpano commented 6 years ago

OK, the 64bit python version sorted the memory problem. Now I need to look into the control points and how to create better ones.

I guess this issue can be closed - might be worth saying a 64 bit version of python 3 is needed. Cheers.

kronpano commented 6 years ago

OK - I have produced another control point file using PTGui (saveed the project and extracted the control points from there) and it is looking good - not perfect but quite good. Looking forward to any improvements here!! Great work.

kronpano commented 6 years ago

Can't do anything today any more but this one might be handy to match the colors https://github.com/jrosebr1/color_transfer haven't tried it yet though - just an idea.

rnbguy commented 6 years ago

Awesome! Thanks for the suggestion for color transfer. If you see anything for mesh warping, let me know.

kronpano commented 6 years ago

Was thinking about that - will keep an eye on it

kronpano commented 6 years ago

Imagemagick has https://www.imagemagick.org/Usage/distorts/#shepards and somehow (that is the part I don;t know) you can access all of imagemagick via a python API???