码迷,mamicode.com
首页 > 其他好文 > 详细

批量处理_cmd_matlab

时间:2015-07-27 20:53:55      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:

cd cd D:\Projects_Face_Detection\Datasets\afw
d:
dir /b/s/p/w *jpg > Path_Images.txt

1.ground_truth矩阵转pts文件

shape = phisTr;
for i = 1:1345
    imgpathlistfile = strcat(‘C:\Users\Administrator\Desktop\COFW\‘,int2str(i), ‘.pts‘);
    file = fopen(imgpathlistfile,‘w‘);
    fprintf(file,‘%s\n‘,‘version: 1‘);
    fprintf(file,‘%s\n‘,‘n_points:  29‘);
    fprintf(file,‘%s\n‘,‘{‘);
    for j = 1:29
     fprintf(file, ‘%f\t‘, shape(i, j));
     fprintf(file, ‘%f\n‘, shape(i, 29+j));
    end
     fprintf(file,‘}‘);
    fclose(file);
end

2.raw2bmp

% fid = fopen(‘w-041-14.raw‘, ‘r‘);
% data = fread(fid, ‘*uint8‘);
% image = reshape(data, 768, 576, 3);
% image = imrotate(image, -90);
% imshow(image);
% imwrite(image, ‘m-001-1.bmp‘); 
 imgpathlistfile = strcat(‘D:\AR database\dbf1‘,  ‘\1.txt‘);
 imgpathlist = textread(imgpathlistfile, ‘%s‘, ‘delimiter‘, ‘\n‘);
 for i = 1:length(imgpathlist)
     fid = fopen(imgpathlist{i}, ‘r‘);
     data = fread(fid, ‘*uint8‘);
     image = reshape(data, 768, 576, 3);
     image = imrotate(image, -90);
     imgename = strcat(imgpathlist{i}(1:end-3), ‘bmp‘);
     imwrite(image, imgename); 
 end

 

批量处理_cmd_matlab

标签:

原文地址:http://www.cnblogs.com/xuanyuyt/p/4680993.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!