Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How to do interpolation on a surface?

Subject: How to do interpolation on a surface?

From: Wenlong

Date: 19 Apr, 2012 10:43:21

Message: 1 of 2

Dear all,

I have a 3D face model which I'd like to display its depth map. The model has 5000 points. Here is what I do (many thanks to Image Analyst for his/her demo)


%---------------------- Create Depth Map -----------------------------------

face = load('face.txt'); % face is a 3x5000 matrix

for i = 1:5000
    x(i) = int16(face(1,i)-minx+1); % Transform from double to integer
    y(i) = face(2,i)-miny;
    y(i) = abs(int16(face(2,i)- maxy))+1;
    z(i) = face(3,i)-minz;
end

for i = 1:5000
    im(y(i), x(i)) = z(i); % Fill the depth value into the depth map image
end

imshow(im, []) % Dispaly depth map
%--------------------------------------------------------------------------------------

The depth image after imshow() is an image with black background and white dots which indicate the depth value. Although the dots form the shape of a face, it is scattered.

My goal is to make it a continuous depth image of the face. How can I make it? My version of matlab is Version7.1.0, therefore I guess TriScatteredInterp() is not included in my compiler. Can you write me some demo code please? As I am a newbie of matlab that the demo can help me understand better.

Many thanks in advance. I do appreciate you kindly help.

Best wishes
Long

Subject: How to do interpolation on a surface?

From: Richard Crozier

Date: 19 Apr, 2012 11:26:12

Message: 2 of 2

"Wenlong" wrote in message <jmoq89$756$1@newscl01ah.mathworks.com>...
> Dear all,
>
> I have a 3D face model which I'd like to display its depth map. The model has 5000 points. Here is what I do (many thanks to Image Analyst for his/her demo)
>
>
> %---------------------- Create Depth Map -----------------------------------
>
> face = load('face.txt'); % face is a 3x5000 matrix
>
> for i = 1:5000
> x(i) = int16(face(1,i)-minx+1); % Transform from double to integer
> y(i) = face(2,i)-miny;
> y(i) = abs(int16(face(2,i)- maxy))+1;
> z(i) = face(3,i)-minz;
> end
>
> for i = 1:5000
> im(y(i), x(i)) = z(i); % Fill the depth value into the depth map image
> end
>
> imshow(im, []) % Dispaly depth map
> %--------------------------------------------------------------------------------------
>
> The depth image after imshow() is an image with black background and white dots which indicate the depth value. Although the dots form the shape of a face, it is scattered.
>
> My goal is to make it a continuous depth image of the face. How can I make it? My version of matlab is Version7.1.0, therefore I guess TriScatteredInterp() is not included in my compiler. Can you write me some demo code please? As I am a newbie of matlab that the demo can help me understand better.
>
> Many thanks in advance. I do appreciate you kindly help.
>
> Best wishes
> Long

Is gridfit any use to you?

http://www.mathworks.com/matlabcentral/fileexchange/8998

Richard

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us