Path: news.mathworks.com!not-for-mail
From: "John D'Errico" <woodchips@rochester.rr.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: delaunay
Date: Fri, 24 Apr 2009 14:25:05 +0000 (UTC)
Organization: John D'Errico (1-3LEW5R)
Lines: 73
Message-ID: <gssi41$igm$1@fred.mathworks.com>
References: <ae08d7b0-bcc0-4d20-bc6d-0e1d48c936db@c12g2000yqc.googlegroups.com> <83b5d771-5ab9-45fd-9cb1-4efe819ea633@k2g2000yql.googlegroups.com>
Reply-To: "John D'Errico" <woodchips@rochester.rr.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1240583105 18966 172.30.248.38 (24 Apr 2009 14:25:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 24 Apr 2009 14:25:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: news.mathworks.com comp.soft-sys.matlab:535212


hajoura <fradi.hajer@gmail.com> wrote in message <83b5d771-5ab9-45fd-9cb1-4efe819ea633@k2g2000yql.googlegroups.com>...
> Thank u,
> yes , i know that they used delaunay not delaunay3, but this paper
> contain  a lot of mistakes.

Unfortunate that my French is so poor.

> for example , they use delaunay and  with 3 parametrs X,Y, IT. so, it
> 's so clear it is false,
>  that's why, i think that the command is delaunay3.

It is definitely not appropriate to use delaunay3 here.


> Ok, let's forget this paper, u said that   we  can interpolate within
> that triangulation.; ok,
> i have two low resolution images about the same scene and i want to
> interpolate them
> using the triangulation of delaunay ;how can i do that?

Sorry. I was wrong to say tsearch. You would use
tsearchn.

You have two images, offset from each other.

1. Combine the two sets of pixel coordinates,
each built using meshgrid.

2. Use delaunay to build a triangulation of the
combined image space.

3. Use tsearchn to give the index of the triangle
in the triangulation that contains a given point.
tsearchn also returns a set of barycentric weights
or coordinates for that point within the triangle.
Apply those weights to the image values at the
vertices of the indicated triangle.

For a random example, since I don't have an image...

x = rand(100,1);
y = rand(100,1);
z = exp(x+y);
tri = delaunay(x,y);

Now, interpolate the resulting surface at some
candidate point. For example, (0.5, 0.5).

[T,P] = tsearchn([x,y],tri,[0.5 0.5])
T =
   188
P =
      0.62224    0.0048745      0.37289

The point lies in triangle 188.

zpred = z(tri(T,1))*P(1);
for i = 2:3
  zpred = zpred + z(tri(T,i))*P(i);
end

Our prediction is 

zpred =
       2.7243

How well did we do?

exp(0.5 + 0.5)
ans =
       2.7183

John