Closed AndSzyShe closed 1 year ago
Cropper(crop = False)
what would be a better error message for you to understand it directly? Should I change it to:
StitchingError: Invalid Contour. Run with --no-crop (using the stitch interface), crop=false (using the stitcher class) or Cropper(False) (using the cropper class)
I might help you if you share the result without cropping. Probably there is a irregular shape
I've tried everything to get the cropper part of the code to work, but I keep getting the same error no matter what I do.
Code works until:
Cropper(crop = True)
from stitching.cropper import Cropper
cropper = Cropper()
mask = cropper.estimate_panorama_mask(warped_low_imgs, warped_low_masks, low_corners, low_sizes)
plot_image(mask, (5,5))
When I run the next section, I get an error:
from largest interiorrectangle import lir, pt1, pt2, lir_basis, lir_within_contour, lir_within_polygon
lir = cropper.estimate_largest_interior_rectangle(mask)
print(lir)
Error:
StitchingError Treaceback(most recent call last)
~\AppData\Local\Temp/ipykernnel_14476/1283171828.py in <module>
----> 1 lir = cropper.estimate_largest_interior_rectangle(mask)
2 print(lir)
~\anaconda3\lib\site-packages\stitching\cropper.py in estimate_largest_interior_rectangle(self, mask)
contours, hierarchy = cv.findContours(mask, cv.RETR_TREE, cv.CHAIN_APPROX_NONE)
if not hierarchy.shape == (1, 1, 4) or not np.all(hierarchy == -1):
raise StitchingError("Invalid Contour. Try without cropping.")
contour = contours[0][:, 0, :]
StitchingError: Invalid Contour. Try without cropping.
Any advice?