PDA

View Full Version : pftrack ASCII tracker text file to max


splinterD
06-19-2011, 01:27 PM
hey guys

im trying to get 2d tracking data from pftrack 2011
to 3dsmax
the only way i can find for now to export the data fast
is by exporting it to ascii text file

i cant import into max or after

is it posible to do it vie max script ???
or is there another way?

here is a sample of a file:

# "Name"
# clipNumber
# frameCount
# frame, xpos, ypos, similarity

"Null_001"
1
924
0 192.000000 510.750000 1.000000
1 192.000000 510.750000 -1.000000
2 190.747025 508.957520 -1.000000
3 190.710312 508.697418 -1.000000
4 190.808624 508.255066 -1.000000
5 191.121292 508.484161 -1.000000
6 191.931137 508.433838 -1.000000
7 191.155853 508.437500 0.936175
8 190.832977 509.182068 -1.000000
9 190.746475 509.122803 -1.000000
10 190.645721 509.392761 -1.000000
11 190.671677 509.316772 -1.000000
12 190.638367 509.636078 -1.000000
13 190.457062 510.084320 -1.000000
14 190.396042 510.148041 -1.000000
15 190.374603 510.218750 0.920438
16 190.383316 510.290100 -1.000000
17 190.386795 510.239838 -1.000000
18 190.396088 510.262604 -1.000000
19 190.432693 510.103455 -1.000000
20 190.427826 509.829803 -1.000000
21 190.465027 509.706207 -1.000000
22 190.624603 509.625000 0.920398

really hope u guys can help

lo
06-19-2011, 03:54 PM
In your text file there is only X & Y position data and no Z... what should happen?

edit: sorry, you said you were after 2D tracking data.

What is the relevance of the similarity parameter for each frame?

lo
06-19-2011, 04:16 PM
ignoring the similarity parameter, this seems to work, but I will need you to upload an actual file with more than one object to test.

Also keep in mind there is no error handling, this is just a quick flimsy solution.

fn importPFTrack2D fName =
(
local allLines = for l in ((dotNetClass "System.IO.File").readAllLines fName) where l[1]!="#" and l.count>0 collect l
local pos = 1
while pos < allLines.count do
(
with animate on
(
local obj = point name:(substituteString allLines[pos] "\"" "")
pos+=2
local frames = allLines[pos] as integer
pos+=1
for i = 1 to frames do
(
local vals = filterString allLines[pos] " "
at time (vals[1] as integer) obj.pos = [vals[2] as float, vals[3] as float, 0]
pos+=1
)
)
)
)

splinterD
06-20-2011, 04:09 AM
Wow thanks man , I didn't except to get a reply so soon!
As soon as I get to th office I'll upload the file.
That is super helpful , thanks alot !

splinterD
06-20-2011, 06:16 AM
thanks again rotem , i really appreciate your help .
i have uploaded the file to here (http://www.mediafire.com/?rabh1v6t9g1a7x9)
thanks!!

lo
06-20-2011, 07:55 AM
You're quite the early bird...

fn importPFTrack2D fName =
(
local allLines = for l in ((dotNetClass "System.IO.File").readAllLines fName) where l[1]!="#" and l.count>0 collect l
local pos = 1
local quot = "\""
local space = " "
while pos < allLines.count do
(
with animate on
(
local obj = point name:(substituteString allLines[pos] quot "")
pos+=2
local frames = allLines[pos] as integer
pos+=1
for i = 1 to frames do
(
local vals = filterString allLines[pos] space
at time (vals[1] as integer) obj.pos = [vals[2] as float, vals[3] as float, 0]
pos+=1
)
)
)
)
usage:

importPFTrack2D @"C:\test.txt"


The function seems to work fine for me, have you tried it?

splinterD
06-20-2011, 05:29 PM
yea it works !!
tank you so much!!

lo
06-20-2011, 05:47 PM
sure, glad to help

m3dps
08-31-2011, 04:34 PM
Hello IO, helloSplinter.
i'm looking at your exchange. great great.
but i'm junior about scipt.

and i tried t your script for import x.y position from pftrack to an object in 3dsmax.
when i running your sricp i get an error message on the line " usage".
a factor is atteming(waiting) ?

how to for apply the script to my object ?
regards
sorry for my english...

m3dps
08-31-2011, 07:57 PM
I m sorry but i don't see my request for this thread. posted 3 hours ago i m trying by this post to understand.

splinterD
09-02-2011, 08:27 AM
ok im not sure if i understand the problem or what you are trying to do
try this :



------------------------------------------------------------------------------------
if PFtrackimport != undefined do (destroyDialog PFtrackimport)
global

--reaction manager veriables---

FD_trackFile = ()
FD_mergeFile = ()

fn importPFTrack2D fName =
(
local allLines = for l in ((dotNetClass "System.IO.File").readAllLines fName) where l[1]!="#" and l.count>0 collect l
local pos = 1
local quot = "\""
local space = " "
while pos < allLines.count do
(
with animate on
(
local obj = point name:(substituteString allLines[pos] quot "")
pos+=2
local frames = allLines[pos] as integer
pos+=1
for i = 1 to frames do
(
local vals = filterString allLines[pos] space
at time (vals[1] as integer) obj.pos = [vals[2] as float, vals[3] as float, 0]
pos+=1
)
)
)
)


rollout PFtrackimport "PFtrack import" width:136 height:40
(
button FD_btn_import_PFtrack "Import PFtrack Data" pos:[8,8] width:112 height:16


on FD_btn_import_PFtrack pressed do
(
try
(
FD_trackFile = getopenFileName caption:"PFtrack tracking data File" types:"pfteack (*.txt)|*.txt|All Files (*.*)|*.*|"
(
importPFTrack2D (FD_trackFile)
)
FD_layer = layermanager.newLayerFromName "FD_Tracking Data" -- creates a new layer with name
select $tracker*
for helper in selection do FD_layer.addNode helper
) catch ()
)
)

createdialog PFtrackimport
------------------------------------------------------------------------------------------



copy and paste the text in the maxscript editor window (maxscript,new script)
run the script , a window with a button should open .
press on the button , find the file you want to import ( has to be a save file from pftrack from the user track node).
the data should open in max as points with x and y animation baked on them .

i hope it helps you

m3dps
09-03-2011, 02:36 PM
Thanks a lot Splinter !!
great
it's running. i have a problem with offset position.
i exported camera from pftrack as fbx and export user track .
i think that i need to open help pftrack for using one user track with solver camera. ...

grea,t thanks again
regards

CGTalk Moderation
09-03-2011, 02:36 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.