2

image stitching with a reference image.

I have multiple images of subject(bone), the images are of different sections of the subject as on a 3x3 matrix. I would like to stitch them together but the problem is they don't have any common feature, as the subject was cut into these sections using a saw. What i have is the image of subject before cutting and want to use it as a guide to stitch the images of sections together.

I have tried using Fiji imagej and searched the web for an alternative. imageJ can only do the job if it has common feature between images to work with. can someone point to some code in python or matlab that can do this or any software that could help.

'[Reference image][1] section (11) section (12) section (13) section (21) section (23) section (31)'

' [1]: https://i.stack.imgur.com/wQr09.jpg I'm not able to add more than 8 links due to SO's policy. There are two more remaining, I'll add them soon. And the "section (22)" i.e centre position in the 3X3 matrix is empty.

Palash
  • 21
  • 3
  • 1
    welcome to SO! Provide some code for your question: what you tried, etc See also https://stackoverflow.com/help/how-to-ask – cccnrc Aug 10 '19 at 14:22
  • i haven't coded anything, but used a plugin in fiji imagej "stitching", please let me know if you need images of rest of the sections. – Palash Aug 10 '19 at 14:28
  • 1
    I suspect adding the missing images might result in higher chances of a better answer. – Mark Setchell Aug 10 '19 at 16:30
  • You've provided two images, but it's unclear what you mean about stitching those together. Could you provide a drawing or sketch indicating how the two images are related and would be stitched together? Typically, stitching involves combining 2D images by finding common overlap. 3D clouds can be combined by finding 3D points (and maybe colors) in common. – Rethunk Aug 12 '19 at 12:12
  • @Rethunk i have added 7 images of 3X3 matrix with name - "section (position in matrix)" and now i want to use the reference image as a guide to stitch the sections together. – Palash Aug 13 '19 at 05:25
  • @Palash: I'm going to try to provide an answer, but without knowing whether you need a "quick" script, or whether you're moving toward more complete lab automation software it's difficult to give you a complete answer. The more frequently you're going to perform this image stitching (really: image matching) task, and the better the output quality needs to be, the more time you need to spend writing down requirements as explicitly as you can. – Rethunk Aug 14 '19 at 11:57

1 Answers1

0

Solutions for image processing needs like this vary wildly depending on whether you need a script to use just a few times, a software tool you'll use for a few weeks, or what could become lab automation software.

This seems to be a problem more of image matching rather than image stitching. By image matching I mean you need to find out how a subimage such as the bone section at (row 2, column 1) would match what is labeled as "4," the center left section, in the reference bone image.

The basic process:

  1. Load your reference image as a 2D array (first converted to grayscale)
  2. Load your first sample image of a subsection of bone.
  3. Use an algorithm such as SIFT to determine the location, orientation, and scale to fit the bone subsection image onto the reference image.
  4. Apply the fit criteria (x,y,rotation,scale) to the bone subsection image, transform it, and past it into a black image the same size as the reference image.
  5. Continue the process above to fit all subsections.
  6. (Optional) With all bone subsections fitted in place, perform additional image processing operations to improve the fit, fill in gaps, etc.

From your sample images it appears that the reference and the bone section images area taken using different lighting, sometimes with the flat portion of the bone slightly tilted relative to the camera's optical axis, etc., all of which makes the image match more difficult.

SIFT is an algorithm that could help here. Note that "scale invariant" is part of the algorithm name.

https://en.wikipedia.org/wiki/Scale-invariant_feature_transform

Given all that, your reference image and bone subsection images appear to be taken under very different circumstances, and that makes solving the problem harder than it needs to be. You'll have an easier time overall if you can control the conditions under which images are captured.

  • Capture all images with the same camera, with the same lighting, at roughly the same distance
  • For lighting, use something like a high-frequency diffuse fluorescent
  • Use the same background for every image (e.g. matte black)

Making this image match a robust process means paying attention to the physical setup as well as creating your image processing algorithm.

If you need a good reference for traditional image processing techniques, find a copy of Digital Image Processing by Gonzalez and Woods. Some time spent with that book will give you better answers faster than learning image processing piecemeal online.

For practical image processing that addresses real-world concerns for implementing even simple image processing algorithms, look for Machine Vision by Davies.

I would strongly urge that you NOT look into machine learning, or try to find an answer in a more advanced image processing textbook until you run into a roadblock with more traditional methods.

Rethunk
  • 3,976
  • 18
  • 32