DeepLabCut Pixels vs ImageJ Pixels

@DeepLabCut

I am trying to determine the length of time a point spent in a specific area of an open field based on X,Y positional data. Unless I am doing something wrong, it appears that the pixels given as the XY information from DLC does not seem to be the same as the ImageJ pixels for the same spot. Is there any way to know what pixel number correlates in terms of actual distance in the video as seen by DLC? Any help you can give would be appreciated, thanks!

Matt

Hi Matt,

it might be that the corner is indexed differently. Without a more specific example it’s hard for me to know (and I don’t use ImageJ in this way). You can also check out this notebook which does this analysis: https://github.com/AlexEMG/DLCutils/blob/master/Demo_loadandanalyzeDLCdata.ipynb

image

Thanks so much! It seems this notebook will be really helpful. I’ve attached a photo to help demonstrate my question, I should have done that in the first place. I am interested in the region in the box of the photo, is there any way to determine exactly what X/Y pixels the corners are in based on the DLC output or experimental setup? Thanks!

Hi, Matt:

You can get different pixel measurements between two programs because either they start at different indices (e.g. Python uses a zero-index, Matlab uses a one-index for the first item), or different origins. In some applications (like DLC), the upper left is the origin, positive x to the right, positive y down. In others, the origin is in the lower left corner. You can translate between those by subtracting your y-coordinate from the vertical resolution of the image.

I see two fairly quick ways to make sure you are getting the exact same coordinates as your recordings.

  1. Create a new DLC project, extract one frame, in that one frame “label” the corners. Save. Look at the labeled data csv.
  2. Even better, on the chance the coordinates could move between recordings (camera moves, walls move, etc), just label the actual corners and have DLC track them in every frame while also tracking your animal.

Brandon

2 Likes

Hi Brandon,

Thanks so much! I really appreciate your help.

Matt