In trying to work more on this problem I have come
up with the following intermediate problem for which I would
like some help.
x=: adverb define
:
m
xcorners=: 0,:$x
ycorners=: m+"1 ]0,:$y
)
0 0$(3 4$1)3 _1 x [ 5 6$3
xcorners ,: ycorners
0 0
3 4
3 _1
8 5
((<0;0),(<1;1)){xcorners (<.`>.`:0 )/"2 ycorners
0 _1
8 5
That is, I would like the final result above, but
computed more simply (without the fancy takes at the end).
I have developed an adverb `merge` which reproduced
the 2D example given by Alexander.
NB. ndx catalogs indices from x offset and y shape
ndx=: {@:(<@:([+ i.@])" 0)
merge=: adverb define
:
xcorners=. 0,:$x
ycorners=. m+"1 ]0,:$y
corners=. ((<0;0),(<1;1)){xcorners (<.`>.`:0 )/"2 ycorners
baseshape=. -~/corners
base=. $&0 baseshape
offset=. corners-~&{."2 xcorners,:ycorners
i=. offset <@:ndx"1 ($x),:$y
xx=. x (>{.i)}base
yy=. y (>{:i)}base
xx((%&2@+)`(>./)@.(0=<./))"0 yy
)
(3 4$1)2 _3 merge 5 6$3
0 0 0 1 1 1 1
0 0 0 1 1 1 1
3 3 3 2 2 2 1
3 3 3 3 3 3 0
3 3 3 3 3 3 0
3 3 3 3 3 3 0
3 3 3 3 3 3 0
On Wed, 30 May 2012, Alexander Mikhailov wrote:
The specific problem which I'm working on right now is stitching. Also known as
"making panoramas from several independent shots". I'm having a simplified
version of the problem - I control the environment where pictures are taken. In my case
the pictures are taken with a camera which images samples under an optical system, and
the camera shifts linearly between shots - but of course I wouldn't mind a more general
solution.
I don't think it's very unusual task in the image processing area... and I
don't think, for example, that this is the only task which enlarges images -
making from two nice rectangles, for example, a convex octagon.
Unfortunately, averaging is just a simple option... I'd like to be able to "fade out" one
image and "fade in" another along, say, a gaussian curve. But let's not have this as a
requirement know.
My problems seems to me to be geometrical - making a combined array. It's not about
"merging" individual points per se. For example, let's have 3 4$1 and then 5 6$3 and then
"combine" them, overlaying the second array with shift 2 _3 on top of the first with
averaging...
1 1 1 1 3 3 3 3 3 3 0 0 0 1 1 1 1
1 1 1 1 "operation" 3 3 3 3 3 3 -> 0 0 0 1 1 1 1
1 1 1 1 3 3 3 3 3 3 3 3 3 2 2 2 1
3 3 3 3 3 3 3 3 3 3 3 3 0
3 3 3 3 3 3 3 3 3 3 3 3 0
3 3 3 3 3 3 0
3 3 3 3 3 3 0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm