ppwwyyxx / OpenPano

Automatic Panorama Stitching From Scratch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to create equirectangular/ 360x180 panorama

kumar-jitendra opened this issue · comments

If you met an unexpected problem using the code, please include the following information:

  1. I tried to stitch two rows of images vertically (means overlapping region is first image's bottom side and second image's top side) but result were distorted image.

  2. i have also attached the example for the same along with its distorted output.
    cb1
    ct1
    out

  3. please try to resolve my issue asap , and also tell me, is it possible to 360x180 images from this repo or not ? if possible how

  4. run the code on mac in vs code on images taken from the phone

Have a good day @kumar-jitendra , as it could be seen by running ./image-stitching match image1.jpg image2.jpg the match.jpg shows that the method is confused because of the repeated pattern shown at the curtains, where left curtain pattern points are matched to the right curtain pattern points. I am trying to arrive to a solution for your problem.

When using ./image-stitching inlier image1.jpg image2.jpg things get better but some details appear, as an slope appears at the top-part image perspective distortion frame (attaching image with marked frame). That slope needs to be diminished in order to accomplish the task. I would try with new parameters and would let you know.

image

I adjusted some settings in the configuration file in order to have some results. I attach the configuration file and the solution here.
image


Configuration file

# [general modes]: if no modes is set, will use naive mode
CYLINDER 0
ESTIMATE_CAMERA 1
TRANS 0
# if no modes above is set, use naive mode

ORDERED_INPUT 0				# set this option when input is ordered
CROP 1								# crop the result to a rectangle
MAX_OUTPUT_SIZE 8000	# maximum possible width/height of output image
LAZY_READ	1						# use images lazily and release when not needed.
											# save memory in feature stage, but slower in blending

# focal length in 35mm format. used in CYLINDER mode
#FOCAL_LENGTH 37 # from jk's camera
#FOCAL_LENGTH 40
FOCAL_LENGTH 15
#FOCAL_LENGTH 24 # my sony camera
#FOCAL_LENGTH 25.83 # for Mi3 phone, focal length * 7.38

# [keypoint related parameters]:
SIFT_WORKING_SIZE 800	# working resolution for sift
NUM_OCTAVE 4
NUM_SCALE 7
SCALE_FACTOR 1.4142135623
GAUSS_SIGMA 1.4142135623
GAUSS_WINDOW_FACTOR 7	# larger value gives less feature

# These parameters are tuned for images of about 0.7 megapixel
# For smaller images, you may need to change parameters for more features
CONTRAST_THRES 8e-2  #Lowe: 3e-2. smaller value gives more feature

JUDGE_EXTREMA_DIFF_THRES 2e-3 # smaller value gives more feature
#!! making it small could result in low-quality keypoint

EDGE_RATIO 6  #lowe: 10. larger value gives more feature

PRE_COLOR_THRES 5e-2
CALC_OFFSET_DEPTH 4
OFFSET_THRES 0.3 # 0.3 is still good, this settings has big impact
# lowe used 0.5. smaller value gives more feature
# ----

# [descriptor and matching related]:
ORI_RADIUS 4.5 # this radius might be large?

ORI_HIST_SMOOTH_COUNT 2
DESC_HIST_SCALE_FACTOR 3
DESC_INT_FACTOR 512

MATCH_REJECT_NEXT_RATIO 0.8

# use more iteration if hard to find match
RANSAC_ITERATIONS 4000 # lowe: 500
RANSAC_INLIER_THRES 5.0 #3.5 # inlier threshold corresponding to 800-resolution images

INLIER_IN_MATCH_RATIO 0.05 #0.1	# number of inlier divided by all matches in the overlapping region
INLIER_IN_POINTS_RATIO 0.04 # number of inlier divided by all keypoints in the overlapping region
# ----

# [optimization and tuning]
STRAIGHTEN 0
SLOPE_PLAIN 8e-3
LM_LAMBDA 5
MULTIPASS_BA 2
# 0: only perform one-pass bundle adjustment for all images and connections (fast)
# 1: perform BA for each image added (suggested)
# 2: perform BA for each connection found (best quality, slow)
# ---

# [blending]
MULTIBAND 2	# set to 0 to disable, set to k to use k bands

FYI I came across a similar result at one point when doing some stitching. It could be completely unrelated BUT are you normalizing your EXIF data before processing the images? Many cameras will shoot photos landscape while storing information so the OS knows to rotate it.

Details below on how to fix that but again, might not be your issue at all.

You can use exiftool to normalize them like this:

exiftool -all:all= -tagsfromfile @ -exif:Orientation ./images/

or with imagemagik

for f in *.JPG *.jpg; do convert $f -auto-orient $f; done