halcon-list_files讀取文件夾下所有文件路徑


在HDevelop中

list_files('D:/bb/tu','files',files)
*作用:列出文件夾中的所有文件路徑
*參數1:文件夾路徑
*參數2:‘files’             指定搜索的格式為文件
*       ‘directories’       指定搜索的格式為文件夾
*        ‘recursive’        指定可以遍歷子文件夾下的文件
*        ‘follow_links’
*        ‘max_depth 5’      指定遍歷的深度
*        'max_files 1000'   最大讀取文件個數
*參數3:文件路徑數組
* files--> ['D:\\bb\\tu\\3.jpg', 'D:\\bb\\tu\\ma.jpg']


for i:=0 to  |files| - 1 by 1
    *|files|  數組總數
     read_image (Image, files[i])
    
endfor

*注意:只保留最后一個圖像

 

在QtCreator中 

    HTuple  hv_files;
    ListFiles("D:/bb/tu", "files", &hv_files);//作用:列出文件夾中的所有文件路徑
      //參數1:文件夾路徑
      //參數2:‘files’             指定搜索的格式為文件
      //      ‘directories’       指定搜索的格式為文件夾
      //       ‘recursive’        指定可以遍歷子文件夾下的文件
      //       ‘follow_links’
      //       ‘max_depth 5’      指定遍歷的深度
      //       'max_files 1000'   最大讀取文件個數
      //參數3:文件路徑數組

    std::cout<<hv_files[0].S()<<std::endl;
    std::cout<<hv_files[1].S()<<std::endl;

 

 

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM