Realigning an image in a series of pictures
1 view (last 30 days)
Show older comments
Sarah Burnett
on 9 Feb 2015
Commented: Sarah Burnett
on 9 Feb 2015
So I am taking a series of pictures of fluorescent solute moving through a pipe. I would like to realign these pictures of the center of mass stays in the center as it moves through the pipe. Then I will crop theses pictures. I already have codes working to crop/rotate/move through the images. I was just wondering if there is a center of mass function and an easy way to readjust each photo.
Thanks!
0 Comments
Accepted Answer
Image Analyst
on 9 Feb 2015
You have to first make a canvass that is large enough to hold the various images as they shift and wiggle around as they are aligned. So your canvass might have to be as large as three times your image in each dimension. Use regionprops() to find the "WeightedCentroid". Find the distance of that from the center of your canvass. Then find the starting and ending columns to paste down that image so that the weighted centroid is at the center of the canvass.
See my Image Segmentation Tutorial if you need to find out how to find weighted centroid. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862. For you, you would probably use the entire image if you want the weighted centroid of the whole image. Otherwise use a mask if you want just part of the image, like a circular portion in the middle.
See attached demo for how to paste an image onto another one.
More Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!