MATLAB codes to import or read multiples data and plot it on multiple images simultaneously
1 回表示 (過去 30 日間)
古いコメントを表示
I have a folder that contain about 120 face images with their coordinates in txt formats. I need a matlab code that can read or import each of the coordinates and plot it on a face images. E.g, read or import coordinates for image 1 and plot it on image 1, then read or import coordinates for images 2 and plot it on image 2 and so on till the end. I can do it for individual images but i want a code that can do all at once simultaneously (read/import and plot, read/import and plot). Please help. An example of the coordinates in txt format is shown below. To see the data better, i have uploaded the a sample of the data file in txt format. (1-1.txt)
X Y 0.35763609 0.64077979 0.36267641 0.68243247 0.3747732 0.72945964 0.39896673 0.78051776 0.42215222 0.81679589 0.4594506 0.84769946 0.4907006 0.85441762 0.53707159 0.83963764 0.56428933 0.81007773 0.58243448 0.77245593 0.59755546 0.72811604 0.60763609 0.6904943 0.61469257 0.65018529 0.5844506 0.50776005 0.56932962 0.49298009 0.5532006 0.48760554 0.5310232 0.49029282 0.5229587 0.50641644 0.54110384 0.51179093 0.55622482 0.51582187 0.57235384 0.51582187 0.39291835 0.50507277 0.41106352 0.48894918 0.43021673 0.48088738 0.4483619 0.49163646 0.46449092 0.50507277 0.44634578 0.51044732 0.4282006 0.51179093 0.41005543 0.50910372 0.50783771 0.47551286 0.52094257 0.44864017 0.57336187 0.4378911 0.60561997 0.45670196 0.61166835 0.50238556 0.47658771 0.47282559 0.45743448 0.44460928 0.40501511 0.43386021 0.37578124 0.44864017 0.36973286 0.49298009 0.43424898 0.69452518 0.47658771 0.68646336 0.48969254 0.69452518 0.50279737 0.68511975 0.54513609 0.68646336 0.50884575 0.72408509 0.4907006 0.72542876 0.47255543 0.72408509 0.47457156 0.50910372 0.47557965 0.56016177 0.45340222 0.59240901 0.45138609 0.6246562 0.4685232 0.63271803 0.4907006 0.63137436 0.51388609 0.63271803 0.52900708 0.61525077 0.52094257 0.58569086 0.50884575 0.56150544 0.50682962 0.51179093
2 件のコメント
Jan
2018 年 7 月 1 日
There is no chance to reconstruct a "face" based on the example data you gave us. The meaning of the values has not been defined. Are these points?
What have you tried so far?
回答 (1 件)
Paolo
2018 年 7 月 1 日
編集済み: Paolo
2018 年 7 月 1 日
If I understand correctly, you want to process multiple text files which contain X,Y coordinates. Try:
files = dir('*.txt');
nfiles = numel(files);
yourdata = cell(1,nfiles);
for i=1:nfiles
fileID = fopen(files(i).name);
yourdata{1,i} = textscan(fileID,'%f%f','HeaderLines',1);
fclose(fileID);
end
yourdata is a cell array, where every cell contains X and Y data from each .txt file. You may then use the data for plotting.
for i=1:nfiles
figure
plot(yourdata{i}{1}, yourdata{i}{2});
end
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!