Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Okay, so having thought about this a bit longer, I've got a suggestion that seems like it's too simple to be efficient... I'd appreciate some feedback on whether it seems sensible!</p> <p>1) Since I can easily determine whether each <code>ridge_t</code> ridge segment at is connected to zero, one or two adjacent segments, I could colour each one appropriately (<code>LINE_NONE</code>, <code>LINE_END</code> or <code>LINE_MID</code>). This can easily be done in parallel, since there is no chance of a race condition.</p> <p>2) Once colouring is complete:</p> <pre><code>for each `LINE_END` ridge segment X found: traverse line until another `LINE_END` ridge segment Y found if X is earlier in memory than Y: change X to `LINE_START` else: change Y to `LINE_START` </code></pre> <p>This is also free of race conditions, since even if two threads are simultaneously traversing the same line, they will make the same change.</p> <p>3) Now every line in the image will have exactly one end flagged as <code>LINE_START</code>. The lines can be located and packed into a more convenient structure in a single thread, without having to do any look-ups to see if the line has already been visited.</p> <p>It's possible that I should consider whether statistics such as line length should be gathered in step 2), to help with the final re-packing...</p> <p>Are there any pitfalls that I've missed?</p> <p><strong>Edit:</strong> The obvious problem is that I end up walking the lines twice, once to locate <code>RIDGE_START</code>s and once to do the final re-packing, leading to a computational inefficiency. It's still appears to be O(N) in terms of storage and computation time, though, which is a good sign...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload