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

  • 相关阅读:
    bzoj2815: [ZJOI2012]灾难
    bzoj1188: [HNOI2007]分裂游戏
    bzoj4538: [Hnoi2016]网络
    bzoj3594: [Scoi2014]方伯伯的玉米田
    bzoj2595: [Wc2008]游览计划
    bzoj3277: 串
    Django开发:(3.2)ORM:多表操作
    Django开发:(3.1)ORM:单表操作
    Django:(2)视图层&模板层
    Django开发:(1)django基础 & url控制器
  • 原文地址:https://www.cnblogs.com/love6tao/p/12174526.html
Copyright © 2011-2022 走看看