Microscopy set of images and stitching them by using Hugin without image deformation

924 views
Skip to first unread message

Mario Modesto

unread,
Mar 20, 2014, 2:30:17 PM3/20/14
to hugi...@googlegroups.com
Hello everybody,

As the title sais, I recently obtained several images from a simple sample with a microscope. And I would like to stitch them without deforming them. How can it be done using Hugin?

Thanks
Mario

Carlos Eduardo G. Carvalho (Cartola)

unread,
Mar 21, 2014, 9:21:11 AM3/21/14
to hugi...@googlegroups.com
Hi Mario,

have you tried something yet?

Hugin has many tutorials on its page: http://hugin.sourceforge.net/tutorials/index.shtml

You might look on mosaic ones maybe, but if you have no experience with hugin you might take a look at others.

If you don't want to make any distortion on any picture you can do only position optimization, but in my opinion that may lead you to a bad stitching. Anyway, I haven't done many mosaics, so maybe you can achieve a good result.


Cheers,

--
A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
---
You received this message because you are subscribed to the Google Groups "hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hugin-ptx+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hugin-ptx/8678bc14-fb6c-4769-9cae-4ab0702a2cf4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Haberthür

unread,
Mar 21, 2014, 2:32:21 PM3/21/14
to hugi...@googlegroups.com
Ciao Mario
Even though hugin can sitich a set of flat scanned images like microscopy images together [1], you’re probably better off by using one of the stitching plugins of ImageJ/Fiji [2], which are especially written and adapted for microscopy images.
You can find more information on the Fiji website here: http://fiji.sc/Image_Stitching or here: http://fiji.sc/Stitching_2D/3D.

For large *3D* datasets you might want to take a look at http://www.xuvtools.org/download

If you choose to use hugin, please ask back if you find problems with the tutorial.
Greetings,
Habi

[1]: See tutorial here: http://hugin.sourceforge.net/tutorials/scans/en.shtml
[2]: http://imagej.nih.gov/ij/ or, with batteries included: http://fiji.sc

Marius Loots

unread,
Mar 24, 2014, 2:12:43 AM3/24/14
to hugi...@googlegroups.com
Hallo Mario,

Thursday, March 20, 2014, 8:30:17 PM, you wrote:
Mario> As the title sais, I recently obtained several images from a simple sample
Mario> with a microscope. And I would like to stitch them without deforming them.
Mario> How can it be done using Hugin?

It is relatively easy and you get good results. This is a workflow I
use, written up (in 2007) for an older version of hugin, but easily adapted for
the newest versions. As mentioned, it is based on the tutorial for
scans. I am not at the moment able to update for the
newest version, but have added some comments in brackets where I can
remember changes from the older version. Will update as soon as I can:

---------------------------------------
I am stitching microscope images on a daily basis and think I have
sorted out most of the glitches in this regard with the current
version of hugin on the windows platform. The results can be seen at:
http://histoweb.co.za/
Not all of these are stitches, and this is a scratch-pad of projects,
but look at the links labeled "Lae vergroting" or "Oorsig".

This is the workflow I follow, based on and modified from the
scanning tutorial at http://hugin.sourceforge.net/tutorials/scans/:

1. Software used: Windows XP, Hugin 0.7 beta 4, autopano 1.03 and
enblend 3.0
(now using the 2012 version of hugin and on a newer machine; hugin
2013 has changes in the layout that makes the workflow a lot more
difficult for slides; using hugin's CPFind without Celeste and NOT
looking for vertical control points. Steps 2, 3 and 4 is skipped and
control points generated after step 10)

2. Images: 2880 x 2304 pixels in all sorts of orientations and
directions. I have used both tiff and jpeg but have settled on jpeg
in favour of smaller initial sizes as a compromise in favour of
storage and handling. The quality difference are small if not
unnoticeable.
(faster pc now means faster stitches, so image dimensions not relevant
anymore)

3. Place all images into a directory together with autopano. Run
autopano with the following command: autopano.exe /project:hugin

4. Open the resulting project file in hugin

(drag and drop images into hugin,


5. Go to the Camera and Lens tab.
6. Select all the images.
7. Change degrees of view to 40.
8. None of the inherit boxes are ticked and all values are 0. Focal
length and crop factor will change to some value, which I ignore
(out of ignorance?).
9. Go to the Stitcher tab.
10. Change projection to rectilinear, Field of view Horizontal to 90
and Field of view vertical to 90.

(generate control points here)

11. Go to the Optimizer tab.
12. Select Custom Parameters.
13. Clear Yaw (y), Pitch (p), Distortion(a), Barrel (b) and Distortion
(c).
14. Select all images EXCLUDING the anchor image for each of roll (r),
view (v), x-shift (d) and y-shift (e). The anchor image will, in
each case, be the first image in the column.

In my setup this display the bug where, in the lens parameter
sections, all the images are labeled as the total number of images
in the project. But as the anchor image is the first in the
column, it is easy to tick the other boxes. I have never
experimented with making any of the other images the anchor, as my
process works fine for me.
15. Optimize.
16. The results are never 100% on, but am average control point
distance of more than 5 means something is wrong. Also see note
below on stitching many images.
17. Preview the result.
18. In the preview, NEVER touch the center icon.
19. Click the Fit icon to see the complete image.
20. Adjust the sliders if necessary to see all the edges of the image.
21. Go to the Camera and Lens Tab and select the first (anchor) image.
22. Adjust the Image Center Shift - Horizontal (d) and Vertical (e)
values to move the image across the field of view to get the
complete image into the center of the field. Optimize after each
adjustment and check the result.
23. Go to the Stitcher Tab.
24. Click Calculate optimal size.
25. Output options Image format: TIFF
26. Output options: Soft Blending
27. Compression LZW (although the result is not compressed).
28. Click Stitch now!

If you have a large number of images (large being an undetermined
number that I have been unable to quantify, the result will look
distorted. In this case, there are two approaches that I have
followed.

Case 1.
1. Optimize and accept the result.
2. Preview the result.
3. Click on the None Icon to remove all images, then add Image 0 and
Image 1, by clicking on buttons below displayed images.
4. In the Hugin preferences, Misc Tab, make sure to tick the box that
says Optimize and stitch only images selected in preview window.
5. Now Optimize as described above.
6. Go to the preview and add the next image.
7. Optimize, Preview, Add next, Rinse, Repeat.
8. As a final step, adjust the Image Center Shift as above.

Case 2 is the same as above, except do no optimize to start. Preview
and select just image 0 to optimize. Then add image 1, and so on.

Unfortunately I cannot speak for a Linux system. This has worked very
well for me and others could probably use this information. The
workflow did change between this and the previous version. I think the
main reason for that being the default boxes that are checked. I also
found that using autopano from inside hugin gave bad results. Exactly
why I have no idea, and unfortunately don't have time to look into
that now.
------------------------------------------------------------------

Hope this help. Will update the workflow as soon as I can.


Groetnis
Marius
mailto:mlo...@medic.up.ac.za
--
add some chaos to your life and put the world in order
http://www.mapungubwe.co.za/
http://www.chaos.co.za/
skype: marius_loots

Hierdie boodskap en aanhangsels is aan 'n vrywaringsklousule
onderhewig. Volledige besonderhede is by
www.it.up.ac.za/documentation/governance/disclaimer/
beskikbaar.

kfj

unread,
Mar 24, 2014, 3:51:36 AM3/24/14
to hugi...@googlegroups.com


On Thursday, March 20, 2014 7:30:17 PM UTC+1, Mario Modesto wrote:
Hello everybody,

As the title sais, I recently obtained several images from a simple sample with a microscope. And I would like to stitch them without deforming them. How can it be done using Hugin?

To put it simply, you want to stitch them in mosaic mode. For your input images, assume a rectilinear lens and assign an arbitrary horizontal field of view - just use a small value. The only parameters you should need to optimize are x and y, I don't think you should have much trouble with lens distortion but if you do you can try optimizing a, b and maybe c, but try without first. I would try using cpfind for the control points, possibly with a setting which will give you more control points than usual - try something like --fullscale --sieve2size 5 -o %o %s

Output would be rectilinear, it shouldn't be difficult to get it to work, since you have so few parameters to play with. I do assume you are using a mechanical stage, if not you need to optimize for r (roll) as well. And you shouldn't refocus from one image to the next, because that will confuse the control point generator, which needs identical bits of image to recognize, and with the very small depth of field of microscopic images a small change in focus may make it impossible for the cpg to do it's job - the problem will be more pronounced with higher magnifications.

One more thing: make sure your microscope is köhlered precisely - see http://en.wikipedia.org/wiki/K%C3%B6hler_illumination

Kay


Thanks
Mario

David Haberthür

unread,
Mar 21, 2014, 4:04:04 AM3/21/14
to hugi...@googlegroups.com
Ciao Mario

On 20 Mar 2014, at 19:30, Mario Modesto <paleom...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages