Closed aaronlange closed 10 years ago
@aaronlange
My apologies!
A few things:
1) The video reading code was me hacking around and testing things out here and there. I never really cleaned it up to the point that it was meant to run and have everything work. I instead shifted my focus to the feature processing since we absolutely need that for the simulations. All of this was meant to be very temporary code as we transitioned over to Python.
2) Some of the code is still a hold over from the MRC code, beware! These files may or may not actually be used in processing.
3) I found videoReader everywhere in the old code. Rather than rewrite everything I created a 'videoReader' function that had the same interface as the old code but that called my code.
4) Their videoReader was an old toolbox that had a lot of compiling steps to it that seemed way too complicated: http://sourceforge.net/p/videoio/code/HEAD/tree/trunk/ Instead I wrote an AVI parser and linked that in with a JPEG decoder. The AVI parser isn't great but it works for that particular file.
5) Any time you see "sl" in the code that's a reference to: https://github.com/JimHokanson/matlab_standard_library
The repo isn't very stable yet. If you have any problems with it please let me know.
6) All of the original code, minus some toolboxes (apparently) can be found at: https://github.com/openworm/SegWorm
7) Finally, I started throwing everything in a package towards the end of this whole endeavor, rather than at the beginning of working on the video parsing. At one point I had a @videoReader class in the path. This was moved to seg_worm.videoReader.
I don't have time tonight but I'll try and get my mac out soon and make sure I can run through most of the code (up to the point that I completed).
Jim
@aaronlange
I updated the code with a function: seg_worm.parseWormFromVideo
I remember now that I had stopped in the middle of getting orientation handling to work.
I haven't tested it yet with my mac but let me know if you have any troubles.
Jim
P.S. Looking over the code I was still in the process of translating the code and I never got around to refactoring. In other words, the overall layout isn't great, although I think it is better than the original ...
@JimHokanson
Thanks for the update! I gave it a test run and on first appearances it seemed to process the video successfully this time. Haven't got around to looking at the output in detail yet though
On my first attempt, using the example worm video: mec-4 (u253) off food x_2010_04_2117_19_201.avi, I got the following:
So first off, I think "videoReader" in seg_worm.segWormFrames needs to change to "VideoReader" (I am using Matlab 2012b and I think function name case-sensitivity is enforced in this version of Matlab)
I made this change in my copy of the repo and tried again:
Looking into this, it seemed the issue was related to the video being in .avi format rather than a format supported by QuickTime on my mac such as .mov
So I converted the video to .mov and ran it again:
I had a look at VideoReader.m and saw that the varargin argument to the 'set' function call on line 136 consisted of the second argument to the 'VideoReader' function call on line 82 in seg_worm.segWormFrames. I.e. in this case varargin consisted of only a boolean with value 'true'. I typed "help set" into matlab and noticed that having a boolean as the second of two arguments to the 'set' function didn't seem to fit the correct usage of the function. So, not seeing any apparent purpose for the boolean argument, I changed
to
in seg_worm.segWormFrames and tried again:
I checked the details of each argument of 'reshape' and found the following:
which explains why matlab was complaining about how 'reshape' was being used.
I recalled that when I converted the .avi to a .mov, I allowed the program that did the conversion to set the dimensions of the output video to 640x480, which explained why width=640 and height=480 (given that width=video_reader.width etc). However, I did not know why the size 'temp' should equal width*height, given that 'temp' seemed to consist of the entire video file (line 61 of vignette.m), rather than just one frame.
I thought maybe the issue had something to do me using the .mov format, but a quick search for answers didn't yield anything straightforward. I started to look at the .mov format specification, but then thought I must be getting off-track. I also couldn't work out why this code would have worked for Jim when using a .avi file. This is as far as I got.
I hope that's clear enough. Any ideas on why this repo might not be working for me or where I've gone wrong? :)