Filter löschen
Filter löschen

How to center an image

2 Ansichten (letzte 30 Tage)
david
david am 18 Aug. 2013
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 Kommentar
dpb
dpb am 18 Aug. 2013
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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Image Analyst
Image Analyst am 18 Aug. 2013
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