how do i create mirror images of images in .mat format

조회 수: 1 (최근 30일)
sara bokhari
sara bokhari 2014년 4월 11일
댓글: Walter Roberson 2014년 4월 14일
I'm basically trying to make a data set for AAM training, I have landmarked several images( video sequence of a frontal pose to moving the head right) and stored them in a .mat format. So now i want a code that will create the mirror image of the annotated images so that i dun have to repeat the process for frontal pose to head moving left on each image.

채택된 답변

Walter Roberson
Walter Roberson 2014년 4월 11일
fliplr() ?
  댓글 수: 6
sara bokhari
sara bokhari 2014년 4월 14일
편집: Walter Roberson 2014년 4월 14일
thanku so much for your help .. but im still getting an error
matfilename = '005.mat';
filedata = load(matfilename);
fn = fieldnames(filedata);
for K = 1 : length(fn)
thisfield = fn{K};
if strncmp(thisfield, 'flip_', 5) %do not re-flip
continue;
end
flip_name = ['flip_' thisfield];
filedata.(flip_name) = fliplr(filedata.(thisfield));
end
save(matfilename, 'filedata', '-struct');
Error using save
The -STRUCT option must be followed by the name of a scalar structure variable.
Also i need to flip over 500 images and i need both the copies the original and flipped.
Walter Roberson
Walter Roberson 2014년 4월 14일
save(matfilename, '-struct', 'filedata');
The code does save both the original and the flipped versions; the flipped ones are prefixed with the word 'flip_'. The code can be run multiple times on the same .mat file, as it will not overwrite an existing flip_ version of an image.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by