Issue with CalibrateTrackingData
Opened this issue · 6 comments
Hi @lukasvonziegler, @plger and others,
I'm trying to use these functions to analyze some mouse behavior data, but am running into an issue with calibrating my arena with my data. I get the error message "Invalid points entered, can not calibrate" every time I try to use CalibrateTrackingData. I've looked at the function code, and still can't really tell what I am doing wrong.
I am trying to calibrate for an arena that is rectangular, width = 91 cm and length = 103 cm. The camera view is only of the arena, no extra video in the frame. My cleaned tracking object is called SpotFind. I modified the code from the example given in the page markdown:
SpotFind <- CalibrateTrackingData(SpotFind, method = "area", in.metric = , points = c("tl","tr","br","bl"))
I guess I'm not quite sure what the points are indicating? Am I supposed to set them up somewhere separately?
Thanks in advance.
Hi there.
First of i noticed an issue with your code that you pasted here that will make it break for sure
SpotFind <- CalibrateTrackingData(SpotFind, method = "area", in.metric = , points = c("tl","tr","br","bl"))
you do not specify in.metric. i.e
in.metric =
should be something like
in.metric = 20 * 30
if the height of the arena would be 20 cm and the length 30 cm.
Due to the error i assume it could also be one of the following problems (and that in.metric was not empty when you ran the code). In this case two more points may be the problem:
- your DLC network tracks the mouse, but not the arena. In order to calibrate automatically you need to track parts of the arena (in our case we had the points "tl" (top left arena corner), "tr" (top right arena corner), "br" (bottom right arena corner), and "bl" (bottom left arena corner) in addition to the points that track the mouse)
- you do track the arena in your DLC network, however the names for the arena does not agree with the points = c("tl","tr","br","bl"). i.e if your names would be "mycorner1", "mycorner2", "mycorner3", "mycorner4" you need to tell DLCAnalyzer to use these points by changing this part of the code to points = c("mycorner1","mycorner2","mycorner3","mycorner4").
Hope this helps you to fix your issue
Best,
Lukas
Oh okay, thank you! It was not clear to me from the tutorial where the points "tl" etc were coming from, or that they were tracked in addition to the positions of the animal. That will probably solve it.
there is any way to calibrate without the arena points? maybe using some manual variable, like px/mm?
greetings and thanks for your code.
This is implemented already, however not included in the examples of the function description.
you can directly specify the pixel to cm ratio with the following command.
Tracking <-CalibrateTrackingData(Tracking, method = "ratio", ratio = 5)
in this case the px to cm (px/cm) ratio would be set to 5 and the data calibrated with this ratio
Dear Lukas,
New DLC/DLCAnalyzer user here. After reading previous posts and the tutorial notes, I'm still not sure where the points of the apparatus (tl, tr, ctr, rt, rb, cbr, br, bl, cbl, lb, lt, ctl) should be specified. Do I need to track all these points when I train the network, so that these are incoporated in the DLC output CSV file? Or is it possible to define these coordinates manually in R? Any advice will be very much appreciated
eric T.
Hi there,
I still get confused by this question. My arena is: length 60cm, width 40cm. the picture grap from the video is 1920 x 1080(resoluation). How can i convert it to the px/xm ratio? Thanks