Plotting Delaunay Triangulation Upright
1 view (last 30 days)
Show older comments
I have been able to read an image, plot its coordinates and did the delaunay triangulation to get the shape model. I got my results but the delaunay triangulation is upside down. How can i make it upright and maybe fit it to the image. Here are my codes.
clc; I = imread('06-5m.jpg'); subplot (1,3,1), imshow(I), title('Face image') filename = 'C:\Users\ENGR. KAYODE\Desktop\IMM DB4\6-5.txt'; delimiter = '\t'; startRow = 2; formatSpec = '%f%f%[^\n\r]'; fileID = fopen(filename,'r'); dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'HeaderLines' ,startRow-1, 'ReturnOnError', false); fclose(fileID); X = dataArray{:, 1}; Y = dataArray{:, 2};
hold on; a=size(I); x=X(:,1); y=Y(:,1); subplot (1,3,2) plot(((a(2)*x)-1),((a(1)*y)-1),'r.','LineWidth',2,'MarkerSize',10) title('Face Coordinates') hold off; subplot(1,3,3) TRI = delaunay((a(2)*x),(a(1)*y)); trimesh(TRI,(a(2)*x),(a(1)*y),zeros(size(x))); view(2) title ('Delaunay Triangulation')
Attached is the picture of the result.
0 Comments
Answers (0)
See Also
Categories
Find more on Delaunay Triangulation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!