dev_close_window ()
ImageDir := 'E:/客户与项目/精驰技术/hphsinpstect/HPHS.INSPECT/bin/x64/Debug/DeepLearning/ROI-CCD3图像运算/contamination'
list_image_files (ImageDir, [], ['recursive','follow_links'], ImageFilesTmp)
for ImageDirIndex := 0 to |ImageFilesTmp| - 1 by 1
read_image (Image, ImageFilesTmp[ImageDirIndex])
get_image_size (Image, Width, Height)
dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
rgb1_to_gray(Image,GrayImage)
write_image(GrayImage,'jpeg',0,ImageFilesTmp[ImageDirIndex])
dev_display (GrayImage)
endfor