Closed dhuzard closed 4 years ago
I'm curious what the width/height of your videos are. If they are on the small size, they may not be visible in Jupyter Notebook. Increasing "%%output size = 100", located at the top of 7b, to something greater than 100 (try 200, or even 1000), can make the images large enough to be displayed.
Thanks for you feedback. The original video is 1024, 1280: I crop it to select my area and I tried different %%output size (from 50 to 2000) but still no display. I have proper display of the cropped arena on previous points with %%output size = 150. Even with the video not cropped it does not display the 7b graphs.
Dear ZachPenn, I ran a test on a different (and more powerful) computer and it worked ! I guess the problem only (?) resides in my workstation being too weak to properly display the graphs (if that even mean anything?). I just added a images (or images.cols(2)) on a separate jupyter entry and it works! Sorry for disturbing you with such a stupid issue!
Now that it is fixed I can ask my real questions :):
Thanks again for your time! really appreciated! Cheers, Damien
Hi Damien,
Glad to hear that worked out. Although ezTrack generally doesn't require any special computing power, depending upon video size issues can arise. Eventually we might get around to implementing a downsampling strategy to alleviate this (since typically high res videos are not necessary) but we'll see when this happens.
1) You can currently crop videos in whichever way you'd like, provided the region to be included in the video is rectangular in shape. If you want a particular region masked from the video (e.g. a square region within a square), ezTrack currently does not support this, but I'd be happy to give you some guidance as to how you might do this yourself.
2) Definitely. In the latest release of ezTrack we actually removed the horizontal cropping tool in the Freeze Analysis Module and cropping is now done by selecting any rectangular portion of the field of view.
Best, Zach
Hi Zach,
thanks for your quick response!
Thank you! Damien
Le mar. 19 nov. 2019 à 15:52, Zach Pennington notifications@github.com a écrit :
Hi Damien,
Glad to hear that worked out. Although ezTrack generally doesn't require any special computing power, depending upon video size issues can arise. Eventually we might get around to implementing a downsampling strategy to alleviate this (since typically high res videos are not necessary) but we'll see when this happens.
1.
You can currently crop videos in whichever way you'd like, provided the region to be included in the video is rectangular in shape. If you want a particular region masked from the video (e.g. a square region within a square), ezTrack currently does not support this, but I'd be happy to give you some guidance as to how you might do this yourself. 2.
Definitely. In the latest release of ezTrack we actually removed the horizontal cropping tool in the Freeze Analysis Module and cropping is now done by selecting any rectangular portion of the field of view.
Best, Zach
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DeniseCaiLab/ezTrack/issues/7?email_source=notifications&email_token=ALTW3XSSDRMJIZIKLGAEEN3QUP4RRA5CNFSM4JMGJER2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEOORSQ#issuecomment-555542730, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALTW3XRSHJ37P2JIHRRHLG3QUP4RRANCNFSM4JMGJERQ .
The place to do this is within the Locate
function, contained within LocationTracking_Functions.py. This is where each frame is read in, cropping is applied, and the center of mass is found.
In your situation, what I would do is mask the area to not be considered by setting the pixels in that region to 0 for every frame. Provided the area to be excluded is rectangular it is as simple as adding one line to the following segment of code:
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
frame = cropframe(frame,crop)
frame[cymin:cymax, cxmin:cxmax] = 0 #the new line
Here cymin/cymax and cxmin/cymax should be the bounds of the region to be ignored.
Because the dictionary, tracking_params
, is passed to the Locate
function, you could add cymin/cymax/cxmin/cxmax and their associated values in the Location Tracking notebook file, and they would be passed to the Locate function.
This requires manually putting in x/y coordinates and if you'd prefer to select a region with tools similar to the interactive cropping tools, you could do this too. If you run the line:
image,crop2,video_dict = lt.LoadAndCrop(video_dict,stretch,cropmethod='Box')
crop2
will be a Holoviews Stream Object holding the x and y coordinates of the vertices for the box that you draw. You could then assign the values contained in crop2
to cymin, etc.
If it is not rectangular region you need to exclude I'd look into the ROI_plot
function to see how I create masks using interactive tools, and how I then apply them using the ROI_Location
function. This is admittedly a bit more complicated but you could just copy much of the code from ROI_plot
; it's very similar to the cropping function above, returning the x,y coordinates of each vertex. Then you extract these vertices and make a boolean mask using cv2's polyfill tool, where the region to be excluded has True values. Finally you'd pass this boolean mask to the Locate function and put [frame[boolean_mask]=0
.
Hi @DeniseCaiLab ,
Thanks for this amazing tool!
I used it successfully for different videos, however, I am now analyzing "long" videos (1h50min) and I have no longer the display of the Examples of Location Tracking (step 7b). When I execute step 7b, I have "Wall time: 218 ms" printing out, but no graphs with the tracking examples. There is no errors and I can then still analyze properly the entire video and display the Distance/Location. Do you have any idea why this is happening?
Thanks in advance for your help! Damien