根据.mat数据挑出第一列序号的图

根据.mat数据挑出第一列序号的图

clc;
A = load('H:\5mm余高熔深mat\熔深电流组5mm定位\20-38.mat');
fpath = 'H:\2019-6-19熔深实验\2019-06-19熔深黑白-板厚5mm\20-38\';
name = dir(fpath);
fpath1_img = 'H:\2019-6-19熔深实验\2019-06-19熔深黑白-板厚5mm\基值\20-38\';
A_struct = struct2cell(A);
A_num = A_struct{1,1}(:,1);
%A_len = A_struct{1,1}(:,2);
%depth = A_struct{1,1}(:,3);

[a,b] = size(A_num);

cc = 1;
for id = 3:length(name)
    wholename=strcat(fpath,name(id).name);
    
    img_name = name(id).name;
    img_len = length(img_name);
    img_num = str2double(img_name(1:img_len-4));
    
    for i = 1:a
        A_num_int = A_num(i,:);

            A_num_num = A_num(i,:);
            if(img_num==(A_num_num))
                img = imread(wholename);
                %img = demosaic(img,'bggr');
%                 figure(1);imshow(img);

                if( A_num_num>99&&A_num_num<1000)                  
                    filePath1 = strcat(fpath1_img,'00', num2str(A_num_num),'.bmp');
                elseif(A_num_num < 100 && A_num_num>9)                 
                    filePath1 = strcat(fpath1_img,'000', num2str(A_num_num),'.bmp');
                elseif(A_num_num < 10)                 
                    filePath1 = strcat(fpath1_img,'0000', num2str(A_num_num),'.bmp');
                elseif(A_num_num > 999 && A_num_num<10000)              
                    filePath1 = strcat(fpath1_img,'0', num2str(A_num_num),'.bmp');
                else
                    filePath1 = strcat(fpath1_img, num2str(A_num_num),'.bmp');
                end
             
                wholename_test=sprintf('%s',filePath1);
                imwrite(img,wholename_test);
            end
        end
    end




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值