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

Blending? #414

Open
smith6jt-cop opened this issue Oct 27, 2023 · 4 comments
Open

Blending? #414

smith6jt-cop opened this issue Oct 27, 2023 · 4 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@smith6jt-cop
Copy link

Hello! Thank you for your work here.

I was able to stitch my images with the example script, but there is line visible in the overlap. Is there something I can do to change this?
stitched_image.zip
Thanks!

@yfukai
Copy link
Owner

yfukai commented Oct 28, 2023

Hi @smith6jt-cop , thanks for your interest! Unfortunately the image merging is not implemented in the package, but I suspect those lines may be actually due to shading (nonuniform illumination). There are several packages (including ours ) for the shading correction, and it may be worth trying to perform some shading correction before stitching.

I found recently other researchers are trying to build a package for stitching.
https://github.com/multiview-stitcher/multiview-stitcher
There might appear functions for merging in the near future.

I hope this helps!

@yfukai yfukai added enhancement New feature or request question Further information is requested labels Oct 28, 2023
@smith6jt-cop
Copy link
Author

That helps, thanks! I did correct with BaSiCpy, but ran all 17 z-planes at once rather than one z-plane at a time so maybe wasn't the best. I really liked being able to keep the data as a dask array between illumination correction and stitching. However, the best results I've seen so far for stitching come from the Gid/Collection Stitching in FIJI which is also a lot faster.

Thank you for the link; that looks promising!

@yfukai
Copy link
Owner

yfukai commented Oct 28, 2023

Thanks! For now the algorithm uses only a single core, and it is natural that Fiji implementation works faster. I have a will to implement faster stitching (and also blending), but now am prioritizing the other project considering the existence of other ongoing projects such as one I noted. For BaSiCPy, we're now implementing the parameter autotuning which may help more robust performance.

I hope I can make a tutorial colab or Jupyter notebook for standard shading-correction-and stitching workflow.

Anyway thanks for your interest!

@jeffhsu3
Copy link

jeffhsu3 commented Jan 7, 2024

For blending I'm doing something like:

from stitching.blender import Blender
blender = Blender()
bsizes = [(img.shape[1], img.shape[0]) for img in ic_conv]
result_df["y_pos2"] = result_df["y_pos"] - result_df["y_pos"].min()
result_df["x_pos2"] = result_df["x_pos"] - result_df["x_pos"].min()
corners = result_df[['x_pos2', 'y_pos2']].values
masks = [255 * np.ones(img.shape[:-1], np.uint8) for img in ic_conv] 

print('Calculating seam mask')
finder = cv2.detail_DpSeamFinder("COLOR_GRAD")
ic_conv = [cv2.cvtColor(i, cv2.COLOR_GRAY2RGB) for i in img_list]
seam_mask = finder.find(ic_conv, corners, masks)

out, out_mask = blender.create_panorama(ic_conv, seam_mask, corners, bsizes)

Where ic_conv is the arrray of images in cv2.COLOR_GRAY2RGB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants