I can get it aligned, but I'd like to flag the start of the line and not
just when I first detect a line.

For example, I'm saying a line is when 10 consecutive pixels are 0. This
flags the 10th pixel. When I reshape and align, I'm losing the line starts.
I apologize for the poor wording of this. Perhaps a picture and small test
case will help:

http://imgur.com/tvQn6ZD

]lines=: 2 22 $ (0 0), (10 $ 1), (10 $ 0),(5 $ 1), (10 $ 0), (4 $ 1), (6 $
0)
]hlines=:(5 (+/)\"1 lines) = 5
]hlines2=:2 22 {. hlines


(note: the 2nd row only has 1 line since the 2nd block only has 4
consecutive pixels = 1)

   lines
0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0
   hlines
0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   hlines2
0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

I would like hlines2 to be:

   hlines2
0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

So in this case, I find the 1s and make the next 4 pixels 1. I'm not sure
how to go about that or if this is the right way to solve the problem.

I might be able to trigger the start with Outfixes... <\."1 lines, but that
seems inefficient and only gets me partly there. I only considered a state
machine but that also seems heavy. Thanks for any input



On Tue, Feb 18, 2014 at 9:42 PM, Joe Bogner <[email protected]> wrote:

> Raul, thanks! Yes, that solved the mismatched shape problem. Now I just
> need to tinker with getting it aligned.
>
> On Tue, Feb 18, 2014 at 9:20 PM, Raul Miller <[email protected]>wrote:
>
>> It looks like you are losing 9 pixels from each array.
>>
>> The easy answer would be to put them back. Ideally, you would try to put
>> some back on each side so that the result is not too far off center.
>>
>> Thus:
>>    hlines2=: 58 157 {. 58 _152  {. hlines
>>    vlines2=: 58 157 {. _43 157 {. vlines
>>
>> Note that your matched content will be smaller than the original. That's
>> also fixable if it's an issue for you.
>>
>>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to