• halcon 图像路径 写txt


    * Image Acquisition 02: Code generated by Image Acquisition 02
    list_files ('F:/keras-retinanet-master/CSV/JPEGImages', ['files','follow_links'], ImageFiles)
    tuple_regexp_select (ImageFiles, ['\.(tif|tiff|gif|bmp|jpg|jpeg|jp2|png|pcx|pgm|ppm|pbm|xwd|ima|hobj)$','ignore_case'], ImageFiles)


    for Index := 0 to |ImageFiles| - 1 by 1
    read_image (Image, ImageFiles[Index])
    * 分割文件名
    parse_filename(ImageFiles[Index], BaseName, Extension, Directory)
    * Image Acquisition 02: Do something
    threshold(Image, Region, 128, 255)
    dilation_circle(Region, RegionDilation, 20)
    erosion_circle(RegionDilation, RegionErosion, 10)
    connection(RegionErosion, ConnectedRegions)
    select_shape(ConnectedRegions, SelectedRegions, 'area', 'and', 1500, 99999)
    *循环个数
    count_obj(SelectedRegions, Number)
    open_file ('C:/Users/xian/Desktop//scratch.txt', 'append', FileHandle)
    for Index1 := 0 to Number-1 by 1
    select_obj(SelectedRegions, ObjectSelected, Index1+1)
    smallest_rectangle1(ObjectSelected, Row1, Column1, Row2, Column2)
    gen_rectangle1(Rectangle, Row1, Column1, Row2, Column2)
    filename := Directory+BaseName
    string_a := filename+'.bmp'+','+Column1+','+Row1+','+Column2+','+Row2+','+'scratch'
    fwrite_string (FileHandle, string_a)
    fnew_line (FileHandle)

    endfor
    close_file (FileHandle)



    endfor

  • 相关阅读:
    网站后台编辑器怎样才能兼容IE6、IE8
    map area
    纯CSS圆角
    【转】Linux 查看某一进程的占用CPU的Cacti 脚本
    查看/修改Linux时区和时间,更新系统时间
    Centos下安装X Window+GNOME Desktop+FreeNX
    rhel6 kvm做桥接
    Gentoo网络配置
    常用正则表达式
    VS 设置备忘
  • 原文地址:https://www.cnblogs.com/love6tao/p/12174526.html
Copyright © 2020-2023  润新知