zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    响应式一些知识
    自动显示git分支--安装oh-my-zsh(Ubuntu环境)
    一些感受吧
    vim 编辑器笔记
    gitlab 配置 ssh && ubuntu
    css3遇到的一些属性
    ajax 基础教程
    怎么查看浏览器内核
    简单理解锁
    测试项目注意项
  • 原文地址:https://www.cnblogs.com/love6tao/p/12174526.html
Copyright © 2011-2022 走看看