フィルターのクリア

How to center an image

2 ビュー (過去 30 日間)
david
david 2013 年 8 月 18 日
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
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
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.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by