【机器视觉】 dev_open_file_dialog算子
00. 目錄
文章目錄
- 00. 目錄
- 01. 概述
- 02. 簽名
- 03. 描述
- 04. 注意
- 05. 參數(shù)
- 06. 結(jié)果
- 07. 附錄
01. 概述
dev_open_file_dialog - 打開(kāi)文件選擇對(duì)話框。
02. 簽名
dev_open_file_dialog( : : Filter, Mode, Path : Selection)
03. 描述
dev_open_file_dialog打開(kāi)一個(gè)文件選擇對(duì)話框,可以用于讀取一個(gè)文件(Mode =‘read’),讀取一個(gè)或多個(gè)文件(Mode =‘read_multi’),寫(xiě)入(Mode =‘write’)文件或選擇(Mode =‘dir’) 一個(gè)目錄。 如果Mode被設(shè)置為’default’并且Filter被設(shè)置為HALCON算子,則類型被設(shè)置為算子將使用的值。
Filter可以用來(lái)選擇應(yīng)該選擇讀取或?qū)懭氲奈募念愋汀?Filter可以設(shè)置為HALCON算子,例如read_image等可以讀取或?qū)懭脒x定的文件的算子。 在這種情況下,filter被設(shè)置為適合HALCON算子使用的文件。 要選擇JPEG和TIFF類型的圖像,可以將filter設(shè)置為’Images (.jpg .tif .tiff)’ 或’JPEG Files (.jpg);;TIFF-Files (.tif .tiff)’。 在第一種情況下,通過(guò)選擇條目“Images”,所有支持的圖像文件會(huì)一起顯示。 在第二種情況下,可以在JPEG文件或TIFF文件之間進(jìn)行選擇。 Filter不區(qū)分大小寫(xiě),因此‘JPEG Files (.jpg)’ 和’JPEG Files (.JPG)'提供相同的效果。 ‘All Files (*)’ 始終添加。 要組合多個(gè)過(guò)濾器,必須用“;;”分隔它們。
例子:
Filter’Images(* .jpg * .tiff * .tif)'列出了擴(kuò)展名為jpg,tiff和tif的所有文件。
Filter“JPEG文件(* .jpg)”列出所有擴(kuò)展名為jpg的文件
3個(gè)filter的組合:Images (*.jpg .tiff .tif);;JPEG Files (.jpg);;TIFF Files (.tiff *.tif)’
Path可以用來(lái)設(shè)置工作目錄。 如果Path設(shè)置為’default’,則工作目錄被設(shè)置為上次使用Mode類型時(shí)所在的目錄。
成功執(zhí)行后,Selection將包含選定的單個(gè)文件或多個(gè)文件。
原文描述:
dev_open_file_dialog opens a file selection dialog for reading one file (Mode = ‘read’), reading one or more files (Mode = ‘read_multi’), writing (Mode = ‘write’) a file or choosing (Mode = ‘dir’) a directory. If Mode is set to ‘default’ and Filter is set to an HALCON operator the type is set to the value the operator would use.
The Filter can be used to select the types of the files which shall be selected for reading or writing. The Filter can be set to an HALCON operator, for example read_image, which should read or write the selected file. In that case, the filter is set appropriate to the files used by the HALCON operator. To select images of type JPEG and TIFF the filter could be set to ‘Images (.jpg .tif .tiff)’ or 'JPEG Files (.jpg);;TIFF-Files (.tif .tiff)’. In the first case, by selecting the entry ‘Images’ all supported images files are displayed together. In the second case it is possible to choose between JPEG Files or TIFF Files. The Filter is not case sensitive, therefore the same results are supplied by 'JPEG Files (.jpg)’ and 'JPEG Files (.JPG)’. The ‘All Files (*)’ is always added. To combine more than one filter you have to separate them by ‘;;’.
Examples:
The filter ‘Images (*.jpg *.tiff *.tif)’ lists all files with the extensions jpg,tiff und tif.
The filter ‘JPEG Files (*.jpg)’ lists all files with the extension jpg
Combination of 3 filters: ‘Images (*.jpg .tiff .tif);;JPEG Files (.jpg);;TIFF Files (.tiff *.tif)’
The Path can be used to set the working directory. If Path is set to ‘default’ the working directory is set to the last one used for this type of Mode.
After a successful execution the Selection contains the selected files or file.
04. 注意
此算子不支持代碼導(dǎo)出
05. 參數(shù)
Filter (input_control) string → (string)
要選擇的單個(gè)文件或多個(gè)文件的類型。
Mode (input_control) string → (string)
文件選擇對(duì)話框的Mode。
Default value: ‘default’
List of values: ‘default’, ‘dir’, ‘read’, ‘read_multi’, ‘write’
Path (input_control) string → (string)
工作目錄
Default value: ‘default’
Selection (output_control) string(-array) → (string)
選定的文件名。
Default value: ‘default’
HDevelop例程
dev_open_file_selection_dialog.hdev Open modal dialogs to read or write files or a directory in HDevelop
程序示例
dev_open_file_dialog ('read_image', 'default','c:/',Selection) read_image(ToolId, Selection)06. 結(jié)果
如果指定參數(shù)的值正確,則dev_open_file_dialog返回2(H_MSG_TRUE)。 否則會(huì)引發(fā)異常并返回錯(cuò)誤代碼。
07. 附錄
7.1 機(jī)器視覺(jué)博客匯總
網(wǎng)址:https://dengjin.blog.csdn.net/article/details/116837497
總結(jié)
以上是生活随笔為你收集整理的【机器视觉】 dev_open_file_dialog算子的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 【机器视觉】 dev_open_dial
- 下一篇: 【机器视觉】 dev_open_tool