Giter VIP home page Giter VIP logo

maptrace's People

Contributors

mzucker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

maptrace's Issues

Error in Example pa-counties.png

Glad to see that last update was a few months back and the project is not completely dead. I am having an issue replicating the pa-counties.svg from the examples provided in the README.md. Below is the traceback I get on the error when running maptrace.

Traceback (most recent call last):
  File "/home/reese/Projects/python/maptrace/maptrace.py", line 1264, in <module>
    main()
  File "/home/reese/Projects/python/maptrace/maptrace.py", line 1248, in main
    num_labels, labels, slices, colors = get_labels_and_colors_outlined(mask, opts)
  File "/home/reese/Projects/python/maptrace/maptrace.py", line 730, in get_labels_and_colors_outlined
    save_debug_image(opts, 'regions', colors[labels])
IndexError: index 81 is out of bounds for axis 0 with size 71

While my python skills are not very good, I tried looking through those section and nothing obvious stood out to me. Poking around and trying a few different things, it looks like the issue may be something surrounding the new '-S' option that was added in September 2020. Still testing and debugging.

Issue with contours against the edge of the image

At least that is my hypothesis.

Using the attached derived from some height data of mt st helens I experience the output:

 python maptrace.py -S -y -c ../new30-binned-screenshot.png
(576, 575, 4) uint8
unique: [[240 240 240 255]
 [226 226 226 255]
 [212 212 212 255]
 [198 198 198 255]
 [184 184 184 255]
 [170 170 170 255]
 [155 155 155 255]
 [141 141 141 255]
 [127 127 127 255]
 [113 113 113 255]
 [ 99  99  99 255]
 [ 85  85  85 255]
 [ 70  70  70 255]
 [ 56  56  56 255]
 [ 42  42  42 255]
 [ 28  28  28 255]
 [ 14  14  14 255]
 [  0   0   0 255]]
ulabels: [[15 15 15 ... 13 13 13]
 [15 15 15 ... 13 13 13]
 [15 15 15 ... 13 13 13]
 ...
 [15 15 15 ... 14 14 14]
 [15 15 15 ... 14 14 14]
 [15 15 15 ... 14 14 14]]
found 1 sublabels for [226 226 226]
found 1 sublabels for [212 212 212]
found 1 sublabels for [198 198 198]
found 3 sublabels for [184 184 184]
found 1 sublabels for [170 170 170]
found 1 sublabels for [155 155 155]
found 1 sublabels for [141 141 141]
found 1 sublabels for [127 127 127]
found 2 sublabels for [113 113 113]
found 4 sublabels for [99 99 99]
found 2 sublabels for [85 85 85]
found 4 sublabels for [70 70 70]
found 7 sublabels for [56 56 56]
found 8 sublabels for [42 42 42]
found 4 sublabels for [28 28 28]
found 1 sublabels for [14 14 14]
found 1 sublabels for [0 0 0]
building boundary representation...
  processing label 1/43 with area 5358
  processing label 2/43 with area 6580
  processing label 3/43 with area 8326
  processing label 4/43 with area 9664
  processing label 5/43 with area 350
  processing label 6/43 with area 6
  processing label 7/43 with area 13887
  processing label 8/43 with area 14323
  processing label 9/43 with area 16922
  processing label 10/43 with area 20246
  processing label 11/43 with area 24319
  processing label 12/43 with area 136
  processing label 13/43 with area 33742
  processing label 14/43 with area 496
  processing label 15/43 with area 596
  processing label 16/43 with area 184
  processing label 17/43 with area 1407
  processing label 18/43 with area 53606
Traceback (most recent call last):
  File "maptrace.py", line 1264, in <module>
    main()
  File "maptrace.py", line 1257, in main
    brep = build_brep(opts, num_labels, labels, slices, colors)
  File "maptrace.py", line 1110, in build_brep
    cpoints, clabels = follow_contour(l_subrect, cur_label,
  File "maptrace.py", line 890, in follow_contour
    assert l_subrect[opp] != cur_label
AssertionError

new30-binned-screenshot

Much digging has determined that the cur_pos location is at the edge of the image, and that the "opposite" point is actually wrapping around to the bottom side of the sub slice which is ALSO part of the feature. Imagine a c or an o shape, where the top wraps to the bottom.

I'm not positive that this is the reason for the error, but I can tell that the opp value referenced here contains negative numbers, which it probably shouldn't

Parameter guide

Hi,

I am using your project to "vectorize" some images I am generating with edge detection. I want to vectorize these files cleanly as you have done in your examples but I am not getting results I am happy with. I think in part this has to do with the parameters I am choosing. Can you point me to the place where the parameters are defined? Alternatively if you have some tips towards successfully doing this I would love to hear it.

See the attached for an example image and output. It seems to me that your work here would be able to achieve my goals pretty easily. The first image attached here is the input and the second is the output.

RETRY
Screen Shot 2020-09-05 at 4 40 11 PM

Best regards and thanks for creating this wonderful little piece of code.

Specific image requirements

Hi,

This looks quite impressive but I can't seem to be able to get it to work for any image other than your examples.
Parts.90_boundaries_outer.zip. For the cases where it does work, the output looks quite different to the image. I was wondering if the input data has to be of a certain format, colour etc.

error trace for my own image as below:

python maptrace.py -c Parts.90_boundaries_outer.tif

found 0 labels
computing areas... Traceback (most recent call last):
File "maptrace.py", line 1109, in
main()
File "maptrace.py", line 1094, in main
num_labels, labels, slices, colors = get_labels_and_colors(mask, opts)
File "maptrace.py", line 625, in get_labels_and_colors
areas, bins = np.histogram(labels.flatten(), bins=num_labels, range=(1, num_labels + 1))
File "C:\Anaconda3\lib\site-packages\numpy\lib\function_base.py", line 721, in histogram
raise ValueError('bins must be positive, when an integer')
ValueError: bins must be positive, when an integer

Sanjay.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.