From: Ironic Prata on
http://drop.io/qzyofo6

Given this example i want to add A and B images. I have a given point in A, and want to add the images so that the center of B goes on the given point in A.
And i want to discard the result outside of A´s original area.

My approach is to check witch areas of B that are outside of A, crop them, obtain the new overlap area, and add them.

This works, but seems inefficient.

Is there a better/faster way of doing this?

Thank You.
From: ImageAnalyst on
No. You may be able to add the correct portion of B to A directly
rather than cropping out and storing the cropped region of B in a new,
separate image, but that's about it.

How inefficient is it? That is, exactly how much time is this
taking? It should happen in the blink of an eye.
From: Ironic Prata on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <93523bab-7c5a-446c-b94c-807ba8b9043f(a)q8g2000vbm.googlegroups.com>...
> No. You may be able to add the correct portion of B to A directly
> rather than cropping out and storing the cropped region of B in a new,
> separate image, but that's about it.
>
> How inefficient is it? That is, exactly how much time is this
> taking? It should happen in the blink of an eye.

I meant code-wise. When i look around, matlab usually has a "smart" way to solve this problems, but couldn´t find any for this case.

You mean something like A=A+B(xstart:xend,ystart:yend); ?
I am doing something similar to this, but was hoping to avoid to calculate the start and end values.

Thank You
From: ImageAnalyst on
Yes, and that is doing it code wise. Of course you have to define
starting and ending positions. Otherwise how could it know what
portion to overlap? (Unless of course you have a beta version of
their Mind Reading Toolbox.) By the way, you reversed x and y. x
refers to columns and thus comes second in the (row, column) indexing,
and so y of course comes first since y is the row.

You didn't say how long it was taking. I bet it's pretty fast so I
wouldn't worry about it. Now if you're talking about overlapping
hundreds of megabytes worth of voxels in 3D, then you might have
something to be concerned about, but even then I think you're going to
have to do what you're doing.
From: Ironic Prata on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <e81805f5-e234-4489-9d1a-af8cbb9b739a(a)g21g2000yqk.googlegroups.com>...
> Yes, and that is doing it code wise. Of course you have to define
> starting and ending positions. Otherwise how could it know what
> portion to overlap? (Unless of course you have a beta version of
> their Mind Reading Toolbox.) By the way, you reversed x and y. x
> refers to columns and thus comes second in the (row, column) indexing,
> and so y of course comes first since y is the row.
>
> You didn't say how long it was taking. I bet it's pretty fast so I
> wouldn't worry about it. Now if you're talking about overlapping
> hundreds of megabytes worth of voxels in 3D, then you might have
> something to be concerned about, but even then I think you're going to
> have to do what you're doing.

Ok.
tks