MATLAB【十四】————调用深度库生成exe,批量运行三层文件夹下图片,保存结果
生活随笔
收集整理的這篇文章主要介紹了
MATLAB【十四】————调用深度库生成exe,批量运行三层文件夹下图片,保存结果
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
?運行路徑:D:\matlab\cmd_batch_processing
文件夾架構(gòu):
clear;
clc;
close all;%% crop the im into 256*256oriDataPath = 'D:\matlab\cmd_batch_processing\data\';
targetPathOri = 'D:\matlab\cmd_batch_processing\result\';report_path ='D:\matlab\cmd_batch_processing\report.txt';
tracejson_path ='D:\matlab\cmd_batch_processing\trace.json';imgDataDirList = dir(oriDataPath); % 遍歷所有文件
layer_1_list = imgDataDirList(3:end);
%
for i = 1:length(layer_1_list)layer_1_list_folder =layer_1_list(i,:).folder; layer_1_list_name =layer_1_list(i,:).name; layer_2_list = dir( fullfile(layer_1_list_folder,layer_1_list_name));layer_2_list = layer_2_list(3:end); for i2 = 1:length(layer_2_list)layer_2_list_folder=layer_2_list(i2,:).folder; layer_2_list_name =layer_2_list(i2,:).name; layer_3_list = dir( fullfile(layer_2_list_folder,layer_2_list_name));layer_3_list = layer_3_list(3:end); for i3 = 1:length(layer_3_list)layer_3_list_folder=layer_3_list(i3,:).folder; layer_3_list_name =layer_3_list(i3,:).name; data_type=split(layer_3_list_name,'.');if((strcmp(data_type(2),'bmp')))image_path = [layer_3_list_folder,'\',layer_3_list_name]; [status,result] = system(['D:\matlab\cmd_batch_processing\RelWithDebInfo\depth_magic_runner.exe "',image_path,'" --config "D:\matlab\cmd_batch_processing\config"']) ;
% [status,result] = system(['D:\softinstall\msys2\home\Administrator\workplacwe\build\bin\RelWithDebInfo\generate_reference_data.exe "D:\matlab\vescl\gauss\0.png" --config "D:\matlab\vescl\gauss\vcsel_config(single_plane)"'],'-echo') ;
% [status,result] = system(['D:\matlab\cmd_batch_processing\RelWithDebInfo\depth_magic_runner.exe "Z:\junfeng\temprature_compensate_figures\fatman mini#25\data\',num2str(x(t),'%.0f'),'\.*.raw" --config "C:\Users\Administrator\Desktop\data\晚上\Thinmanmini#071#0420\Thinmanmini#071#0420"']) ;
% [status,result] = system(['D:\matlab\cmd_batch_processing\RelWithDebInfo\depth_magic_runner.exe "Z:\junfeng\temprature_compensate_figures\fatman mini#25\data\',num2str(x(t),'%.0f'),'\.*.raw" --config "D:\matlab\cmd_batch_processing\config"']) ;pause(0.001);
% image_name_str = strsplit(image_name,'.');new_name= ([layer_1_list_name,'_',layer_2_list_name,'_',data_type(1)]);new_name=strcat(new_name(1),new_name(2),new_name(3),new_name(4),new_name(5));%%修改圖片保存文件的名稱movefile("debug_output",string(new_name),'f');%改名pause(0.001);movefile(string(new_name),targetPathOri,'f');%移動
% movefile(report_path,targetPathOri,'f');
% movefile(tracejson_path,targetPathOri,'f');pause(0.001); end endend
end
?
clc;
close all;
clear % file_path = 'C:\Users\Administrator\Desktop\vescl\base_5scene_6yoffset\';% 圖像文件夾路徑
file_path = 'C:\Users\Administrator\Desktop\vescl\master_test\';% 圖像文件夾路徑
img_list = dir(strcat(file_path,'*.bmp'));%獲取該文件夾中所有jpg格式的圖像
img_list_length = length(img_list);%獲取圖像總數(shù)量sourcePath='D:\matlab\vescl\debug_output';%數(shù)據(jù)保存路徑
targetPathOri=file_path;
% targetPathOri='C:\Users\Administrator\Desktop\vescl_after\result\';if img_list_length > 0 %有滿足條件的圖像for j = 1:img_list_length %逐一讀取圖像image_name = img_list(j).name;% 圖像名image = imread(strcat(file_path,image_name));fprintf('%d %d %s\n',j,strcat(file_path,image_name));% 顯示正在處理的圖像名%圖像處理過程 省略
% [status,result] = system('D:\softinstall\msys2\home\Administrator\workplacwe\build\bin\RelWithDebInfo\depth_magic_runner.exe "C:\Users\Administrator\Desktop\vescl_test\basesample_5scene3distance\400to3\result1\ref.bmp" --config "C:\Users\Administrator\Desktop\vescl_test\vcsel_config_ref"','-echo');
% [status,result] = system(['D:\softinstall\msys2\home\Administrator\workplacwe\build\bin\RelWithDebInfo\depth_magic_runner.exe "C:\Users\Administrator\Desktop\vescl\result1\',image_name,'" --config "C:\Users\Administrator\Desktop\vescl_test\vcsel_config_ref"']) ; [status,result] = system(['D:\matlab\vescl\master_test\depth_magic_runner.exe "D:\data\N101\aquaman-N101方塊件#0923\30\raw\',image_name,'" --config "D:\data\N101\config_new_proj"']) ; pause(0.001);image_name_str = strsplit(image_name,'.');movefile("debug_output",string(image_name_str(1)),'f');%改名pause(0.001);movefile(string(image_name_str(1)),targetPathOri,'f');%移動pause(0.001); end
end
?
?
總結(jié)
以上是生活随笔為你收集整理的MATLAB【十四】————调用深度库生成exe,批量运行三层文件夹下图片,保存结果的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 树多少钱一棵啊?
- 下一篇: 【C++】【四】企业链表