Shifting pixel colums in an image

10 views (last 30 days)
Hamza Ahmed
Hamza Ahmed on 8 Sep 2014
Edited: Hamza Ahmed on 9 Sep 2014
I have an image having pixel values in rows: 350-1000, and columns: 100-250
I want to shift these pixel values from columns 100-250 to 130-280.
which command should I use?
Thanks!

Accepted Answer

Iain
Iain on 8 Sep 2014
shifted = zeros(size(original));
shifted(:, 130:280,:) = original(:,100:250,:);
  3 Comments
Image Analyst
Image Analyst on 8 Sep 2014
Get rid of the final ",:" (comma colon).
Hamza Ahmed
Hamza Ahmed on 9 Sep 2014
Edited: Hamza Ahmed on 9 Sep 2014
I ended up using this: I = circshift(I, [30 30]);
Both methods do the same thing I guess. Problem solved. Thanks!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!