joshmccraney said:
that was great as far as identifying the region I'm interested in
I believe it does more than "identifying the region"-- as you hover over the line of interest you get x,y information for each pixel of interest. Manually, you could have your result in maybe 30 min.
It was not clear in your OP that automation was your intent or generalization for that matter. But not a problem. A couple issues, though.
Clutter removal. The red box you identify has distracting information (part of your "close valve 2 knob", etc.) You could make a smaller box to get past that, but for future images, you must deal with the possibility of image artifacts appearing randomly in your box.
Discontinuities in your "line of interest". I count what looks like at least 3 discontinuities. What constitutes an image-artifact discontinuity vs an actual real "notch" occurring in something that is presumably smooth, is up to you to define and manage.
Concave/Convex (complex line). How nonlinear of an edge to you need to handle?
Search Orientation. You can create something in MATLAB to handle this "horizontal", "bottom-first-encounter" case fairly simply (advised below), but to make it work in a more general manner (horizontal top-first, or vertical left/right first case) is going to require more consideration.
Advice:
This specific problem (hoizontal, bottom-first, no concavities, potential discontinuities, no clutter) lends itself to a search beginning at, say, the leftmost column (c
0) and bottommost row (r
0) of the rectangle. You can come up with a simple inner-outer loop structure: advancing over all columns (c
0 to c
n) in the outer loop, and for each column, increment the row elements (from r
0 to r
n) testing for the first occurrence of a "1" in the inner loop. Store your detection points in a suitable array.
As far as the discontinuities are concerned, you can post-process your result to smooth the result based on a smoothing algorithm of your design. The point being: isolate this process from the search process.