天天看点

Halcon读取文件中图像方式

第一种:

  1. ImagePath := []
  2. ImagePath[ ] := 'D:/halcon_test/读取多张图片的方式/ .jpg'
  3. ImagePath[ ] := 'D:/halcon_test/读取多张图片的方式/ .jpg'
  4. ImagePath[ ] := 'D:/halcon_test/读取多张图片的方式/ .jpg'
  5. ImagePath[ ] := 'D:/halcon_test/读取多张图片的方式/ .jpg'
  6. ImagePath[ ] := 'D:/halcon_test/读取多张图片的方式/ .jpg'
  7. for Index := to by
  8. dev_close_window ()
  9. read_image (Image, ImagePath[Index])
  10. get_image_size (Image, Width, Height)
  11. dev_open_window ( , , Width, Height, 'black', WindowHandle)
  12. dev_display (Image)
  13. endfor

第二种:

  1. for i := 1 to 5 by 1
  2. dev_close_window ()
  3. read_image (Image, 'D:/halcon_test/读取多张图片的方式/'+i+'.jpg')
  4. get_image_size (Image, Width, Height)
  5. dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
  6. dev_display (Image)
  7. endfor

第三种:

  1. for I := to by
  2. dev_close_window ()
  3. *I$表示引用I的值,而 '1d'的 'd'则表示采用十进制数表示,取一位数,如 、 、 此类,
  4. *故 '3d'则表示为取三位十进制数,如 、 、 诸如此类
  5. read_image (Image, 'D:/halcon_test/读取多张图片的方式/'+I$' d ')
  6. get_image_size (Image, Width, Height)
  7. dev_open_window (0, 0, Width, Height, 'black ', WindowHandle)
  8. dev_display (Image)
  9. endfor

第四种:

第四种方法  (读取一个文件夹下的所有图片)

【助手】-->【打开新的image acquisition 】-->【图像助手】-->【选择路径】-->【代码生成】-->【插入代码】

第一种:

  1. ImagePath := []
  2. ImagePath[ ] := 'D:/halcon_test/读取多张图片的方式/ .jpg'
  3. ImagePath[ ] := 'D:/halcon_test/读取多张图片的方式/ .jpg'
  4. ImagePath[ ] := 'D:/halcon_test/读取多张图片的方式/ .jpg'
  5. ImagePath[ ] := 'D:/halcon_test/读取多张图片的方式/ .jpg'
  6. ImagePath[ ] := 'D:/halcon_test/读取多张图片的方式/ .jpg'
  7. for Index := to by
  8. dev_close_window ()
  9. read_image (Image, ImagePath[Index])
  10. get_image_size (Image, Width, Height)
  11. dev_open_window ( , , Width, Height, 'black', WindowHandle)
  12. dev_display (Image)
  13. endfor

第二种:

  1. for i := 1 to 5 by 1
  2. dev_close_window ()
  3. read_image (Image, 'D:/halcon_test/读取多张图片的方式/'+i+'.jpg')
  4. get_image_size (Image, Width, Height)
  5. dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
  6. dev_display (Image)
  7. endfor

第三种:

  1. for I := to by
  2. dev_close_window ()
  3. *I$表示引用I的值,而 '1d'的 'd'则表示采用十进制数表示,取一位数,如 、 、 此类,
  4. *故 '3d'则表示为取三位十进制数,如 、 、 诸如此类
  5. read_image (Image, 'D:/halcon_test/读取多张图片的方式/'+I$' d ')
  6. get_image_size (Image, Width, Height)
  7. dev_open_window (0, 0, Width, Height, 'black ', WindowHandle)
  8. dev_display (Image)
  9. endfor

第四种:

第四种方法  (读取一个文件夹下的所有图片)

【助手】-->【打开新的image acquisition 】-->【图像助手】-->【选择路径】-->【代码生成】-->【插入代码】

继续阅读