How to center an image
6 次查看(过去 30 天)
显示 更早的评论
hi
im new in the matlab world ..And I have a problem regarding image processing..
I have a image(matrix size: mXn)that in IJ coordinate system (origin at the upper left) and i want to center the image (that the origin will be at the center of the image - XY coordinate system)...
How can I do this? There is a matrix which I can multiply the image and the result is a centered image?
thanks
1 个评论
dpb
2013-8-18
If you're talking simply of the numbering of the pixels' location in the image, that's simply a translation of round([m|n]/2) in addressing.
Matlab stores everything in 1-based arrays so you can't actually change the addressing directly to be -m/2...0...+m/2 instead of 1...m You could write a helper function that hides the addressing manipulation, of course.
回答(1 个)
Image Analyst
2013-8-18
Use circshift() to translate the image. You need to know the number of rows and columns in the "canvass" and the number of rows and columns in the portion you want to shift, then calculate the shift amounts (in rows and columns) and then call circshift() to do the translation.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!