temporalecologylab / TreeRings

Project developing methods and tools needed to collect tree ring dendrology data
0 stars 0 forks source link

image stitching #9

Open lizzieinvancouver opened 5 months ago

lizzieinvancouver commented 5 months ago

From @afong3

The first step probably depends on your comfort level with Python or C++ and the OpenCV library. For the sake of environment setup, it'll probably be easiest to get moving with Python - making sure to use either a virtualenv or Anaconda environment for portability later on.

Panoramic Stitching

A crash course into image stitching and an example Python OpenCV implementation can be found here. For previous work tasks, I've read through a few tutorials from PyImageSearch and I found them to be pretty decent overviews.

Grid Stitching

The problem with using OpenCV is that I haven't been able to find any documentation about stitching a grid of images together - putting a row of images seems to be the main use case. But because of how robust their image stitching pipeline is, I wouldn't be completely surprised if a grid could be stitched with the same panorama stitching function.

The CaptuRING workflow references a section 3.6 from a guidelines paper on best practices for image stitching in the context of wood anatomy. They suggest a 20-40% overlap of images to find sufficient key-points / features in each image.

To reproduce this, I suggest to create your own test data set. With the data in the drive there's a few options. One would be to take the individual images, stitch them together with the same OpenCV method, and compare the stitched image to the big .tif files that are already stitched in the drive.

Another way would be to start off with the combined .tif file and make smaller images with a rolling window approach. In this rolling window it's important to have the sufficient 20-40% overlap between the windows. Ideally, there would be a nonconstant amount of overlap based on a random integer to add a bit of variability.

If for some reason the stitching does not work, it wouldn't hurt to try using PTGui to verify that the image set can theoretically be stitched.

If the OpenCV function doesn't work, it will be a little more difficult to find the key points then match them ourselves. But if it does come to this we can reconvene to brainstorm other approaches.

lizzieinvancouver commented 5 months ago

@sandyie @soleil-nocturne123 @afong3 I was just looking up Capturing citations and found this possibly useful paper.

This paper provides a proof of concept of an automated scanning system for high-resolution images of wooden samples. This includes a 3D digitization for the further path planning of a high-resolution scan by an industrial robot as well as a web-based user interface connected to the robot control via Robot Operating System (ROS).With the use of focus stacking and coherent image stitching, the image processing pipeline delivers a final result image of the wooden samples with a theoretical maximum resolution of 1359 pixels/mm under ideal circumstances. Future work contains the integration and evaluation of additional sensors for better camera alignment to the surface.

lizzieinvancouver commented 5 months ago

And some more refs:

Another CaptuRING paper

Automation of tree-ring detection and measurements using deep learning

Tree ring segmentation using UNEt TRansformer neural network on stained microsections for quantitative wood anatomy

Ultra-high-resolution reflected-light imaging for dendrochronology -- seems less useful, but I am not sure so sharing anyway.

@soleil-nocturne123 @sandyie @afong3

lizzieinvancouver commented 2 months ago

Update from @sandyie today over email:

For a short tree-ring update from me: The image stitching code is now updated to support images from 1) local computer folder, 2) Google Drive, and 3) drag and drop to collab file. The "flip and stitch" approach also works with some test photos (landscape photos) online as shown in the mini demo last time. I am starting to look into possible methods for tree ring identification in the meantime.

lizzieinvancouver commented 1 month ago

@sandyie @afong3 See notes from a meeting I had yesterday and feel free to pester me in 2 weeks if I have not sent the images (and then I can ask Valentina again).