How to shift rows of a matrix with a specific number

조회 수: 4 (최근 30일)
sadiqa ilyas
sadiqa ilyas 2020년 3월 22일
댓글: Image Analyst 2020년 3월 22일
Hi I want to shift(row) pixels of an image with specific number of rotation e.g 10 or 45
I1=imread('lina512.bmp');
I2=imresize(I1,[16 16]);figure;imshow(I2)
I=I2(:,:,1);figure;imshow(I)
% column shift
csm = @(I,Col) circshift(I(:,Col),[3 1-Col]);
callcsm = @(I) csm(I, 1:size(I,2));
HH = callcsm(I);
%row shift.
%Problem is here
% I want shift each row 3 positions to its right but it shifts
%only one position
csm1 = @(row,I) circshift(I(row,:),[1-row,3]);
callcsm1 = @(I) csm1(1:size(I,1),I);
HH1 = callcsm1(I);
  댓글 수: 1
Image Analyst
Image Analyst 2020년 3월 22일
When you call it you don't pass in any row or column. Why are you creating and using an anonymous function anyway instead of just calling circshift() directly? Why complicate things?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 NaNs에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by