Re: [Jprogramming] identifying vertical and horizontal lines on an image

2014-02-19 Thread Joe Bogner
Yes, I think so...LINE is the number of consecutive black pixels. $ (1,3)$1 1 3 I need to have it match the rank of xb to do the matching in E. (as far as I know) $ xb 58 157 On Wed, Feb 19, 2014 at 1:26 PM, Raul Miller wrote: >lineStarts=:((1, LINE) $ 1) E. y >lineEnds=: |."1

Re: [Jprogramming] identifying vertical and horizontal lines on an image

2014-02-19 Thread Raul Miller
lineStarts=:((1, LINE) $ 1) E. y lineEnds=: |."1 ((1, LINE) $ 1) E. |."1 y (1,3)$1 1 1 1 This matches your intent? (I am not objecting, just making sure I understand.) Thanks, -- Raul On Wed, Feb 19, 2014 at 1:00 PM, Joe Bogner wrote: > I came up with a slightly different approac

Re: [Jprogramming] identifying vertical and horizontal lines on an image

2014-02-19 Thread Joe Bogner
I came up with a slightly different approach that seems to work well on my test cases so far: http://drp.io/jsnW xb =: 600 >: x2 NB. make 1 if less than 600 combined RGB lineDetect=: 4 : 0 LINE=:x lineStarts=:((1, LINE) $ 1) E. y lineEnds=: |."1 ((1, LINE) $ 1) E. |."1 y lD=:lineStarts+.lineEnds

Re: [Jprogramming] identifying vertical and horizontal lines on an image

2014-02-19 Thread Raul Miller
On Wed, Feb 19, 2014 at 11:06 AM, Joe Bogner wrote: > Input: http://drp.io/files/5304d74f7ba1d.jpg > Output: http://drp.io/files/5304d7049f938.jpg Pretty! (Or am I just showing how warped my tastes are?) Thanks, -- Raul --

Re: [Jprogramming] identifying vertical and horizontal lines on an image

2014-02-19 Thread Joe Bogner
Don, Jan-Pieter - Thanks for the other ideas Raul, I will give that a shot. It looks like a much cleaner approach. Just to prove it to myself that something was possible, I hacked together this awful version. It works reasonably well though. Here's a version on the IRS tax table just for fun. Inp

Re: [Jprogramming] identifying vertical and horizontal lines on an image

2014-02-19 Thread Raul Miller
I'd like to introduce you to ~:/\ ~:/\ is an illustration of one of the things I really like about J. It is equivalent to 2 | +/\ ] but without the possibility of overflow. And it turns out to be really handy when reasoning about bit operations. One way of describing it is as a slightly flawed se

Re: [Jprogramming] identifying vertical and horizontal lines on an image

2014-02-19 Thread Jan-Pieter Jacobs
Funny enough I was talking with a colleague about this a few days ago. We came up with these links: http://stackoverflow.com/questions/2596722/is-there-any-super-fast-algorithm-for-finding-lines-on-picture or this one http://en.wikipedia.org/wiki/Hough_transform These tackle the more general pr

Re: [Jprogramming] identifying vertical and horizontal lines on an image

2014-02-19 Thread Don Guinn
You may not be interested in a little reading on seismic convolution. This is a process to recognize lines (horizons, changes in the propagation of sound waves causing a reflection) in seismic data. Seismic recordings of reflections (echoes) from a source (sound generator) to geophones (to record t

Re: [Jprogramming] identifying vertical and horizontal lines on an image

2014-02-19 Thread Joe Bogner
On Wed, Feb 19, 2014 at 7:25 AM, Henry Rich wrote: > Look at > > (1 10$0) E. image > > or > > (10 $ 0) E. line > > Thanks Henry, that worked well. I have a version that seems to work now (albeit clunky) ]lines=: 4 10 $ (0 0), (5 $ 1), (3 $ 0),(5 $ 1), (0 0 0), (1 1), (10 $ 1) lineStarts=:(1 5$1)

Re: [Jprogramming] identifying vertical and horizontal lines on an image

2014-02-19 Thread Henry Rich
Look at (1 10$0) E. image or (10 $ 0) E. line Beware of a previously-reported bug in non-literal E. Henry Rich On 2/19/2014 7:04 AM, Joe Bogner wrote: 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

Re: [Jprogramming] identifying vertical and horizontal lines on an image

2014-02-19 Thread Joe Bogner
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. P

Re: [Jprogramming] identifying vertical and horizontal lines on an image

2014-02-18 Thread Joe Bogner
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 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 pu

Re: [Jprogramming] identifying vertical and horizontal lines on an image

2014-02-18 Thread Raul Miller
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

[Jprogramming] identifying vertical and horizontal lines on an image

2014-02-18 Thread Joe Bogner
I'm testing out OCRing PDF tables using Tesseract OCR. I'm borrowing the concept from here: http://craiget.com/extracting-table-data-from-pdfs-with-ocr/ I've made good progress using the PPM examples on rosetta code and am having fun with it. (NOTE: I am starting off with an image resized down to