Undefined function or variable "TimeStamps"

2 次查看(过去 30 天)
Hi everyone,i really need help with my masters thesis. I need to post process video from a high speed camera in order to find out the penetration of jet flow thorugh nozzle. I dont have much experience with Matlab. I am using Sandia Laboroties algorithm to solve it. there is an example in it that how to solve for it. The example is working with the code. The files which is of interest is aviVSD.m and readcin.m. The example file is bklda183short.cine
[time,vapPen,tan2,JB,maxV] = aviVSD('C:\Users\User\Documents\MATLAB\schlierenProcessCodeECN12-11\bklda183short.cine',12:48,[32 130],[0 2500],[0.45 0.55],[3 0 511 0 0 60 1 2 1/5.4 0 8 50 0 1 1 -1 1 23]);
it is working as it stated in the program, But i have having difficulty apply this code to my experiment. The code is too big to check what is wrong here, but the error which i am getting are
Undefined function or variable "TimeStamps".
Error in readcin (line 340)
ImageData.TimeStamps=TimeStamps;
Error in aviVSD (line 82) imdata = readcin(cineFilePath,[1,1]);
the function i am using to solve is
[time,vapPen,tan2,JB,maxV] = aviVSD('C:\Users\User\Documents\MATLAB\Final Images\test\test.cine',2:10,[0 0],[0 2500],[0.45 0.55],[3 0 0 0 0 500 0 0 0 0.101 0 2 80 1 1 -1 1 2.58309])
so i tried to see where TimeStamps have been defined but unofrunately got no luck with that.
example file has framerate of 3.8023e04 while my file has framrate of 1000. May be its because of this, Anyways if someone can help me with thi that would be great. I know it will require little time. Thanks
  1 个评论
Gopichandh Danala
From the error, it simply says "TimeStamps" is not available. In function 'readcin' line-340, when it tried to evaluate:
ImageData.TimeStamps=TimeStamps
The structure ImageData doesn't have any field by the name 'TimeStamps'.
I suggest you put a breakpoint at line 340 in function- 'readcin'. run the code again and when it stops at breakpoint click on ImageData structure to check if it has a field by name TimeStamps.
Maybe your file didn't have this field (TimeStamp) in your file whereas the original file had it

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2017-6-9
There are some difficulties in the code, and in your file, and also in how you call the code.
First, your call: you have
[time,vapPen,tan2,JB,maxV] = aviVSD('C:\Users\User\Documents\MATLAB\Final Images\test\test.cine',2:10,[0 0],[0 2500],[0.45 0.55],[3 0 0 0 0 500 0 0 0 0.101 0 2 80 1 1 -1 1 2.58309])
The third parameter, which you have as [0 0], needs to be the x and y coordinates of the muzzle origin. The values must be positive integers.
Secondly, the last parameter, which you provided as a numeric vector, needs to be a cell array instead. Use {} instead of [] . Yes, this does disagree with the examples, and No, there does not appear to be any good reason for it, but it is less work to call it with {} than to fix up the code to use () indexing instead of {} indexing.
Thirdly: your test file does not contain any timestamp information in it.
Fourthly: while reading the file, the code properly tests to see whether timestamp information is present, but when it is not present then it fails to assign anything to the TimeStamps variable and then later it crashes when it tries to use the variable. This happens both in readcin and in readcin90 . Both routines need to be slightly repaired for that case.
Fifthly: the aviVSD code assumes that time information is available. Perhaps readcin and readcin90 should be made responsible for figuring out appropriate information for all of the fields in this case, but it was easier to change aviVSD to guess at times. In this case, I decided that frame #1 should correspond to time 0 and that the frames should be considered to be 1/FrameRate seconds apart.
Sixthly: there is a routine in aviVSD dealing with muzzle spray that uses the x and y origin information (that you supplied as 0). It tries to detect something in the image, but in your image it does not find it. It notices that it is not present and scribbles some small data into the image so the algorithm will have something to work with, but when it does so it confuses x and y and it subtracts 1 from the origin coordinates when it should not. The line needed to be changed.
Seventhly: after all of the above fixes, you are going to get a bunch of warnings
Warning: Polynomial is badly conditioned. Add points with distinct X values, reduce the degree of the polynomial, or try centering and scaling as
described in HELP POLYFIT.
It appears those could be triggered by having provided nozzle origin coordinates that are not where the nozzle actually is, leading the code to be unable to detect the center of mass properly. I did not make any changes having to do with this, as it looks to be a matter of you needing to provide better coordinates.
I have attached the repaired files.

更多回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by