I'm switching over Matlab, but I have a problem. Matlab has a GUI tool called the "Training Image Labeler" (shown below) that I use all the time to label my training data for my computer vision related work:

enter image description here

It's simple, you just drag rectangles (with a fixed asset ratio) over each of the regions of the images that you need to label and then it neatly generates an xml file that has a list of the bounding boxes per filename. How can I accomplish this in Mathematica? This is a standard a common need.

Right now I'm looking at the image tool in version 10, but I don't see any batch labeling functionality.

  • $\begingroup$ I tried to export/import them but MMA is not importing .mat file. Import["/Users/tom/labelingSession.mat", "LabeledData"] -> Import::unsup: Unsupported type of MAT file. >> $\endgroup$ Feb 26, 2015 at 23:07
  • 1
    $\begingroup$ If it generates a neat XML file, why not simply import that into Mathematica? $\endgroup$
    – C. E.
    Feb 27, 2015 at 8:55
  • $\begingroup$ Because I want to discontinue my license and switch to mathematica @Pickett $\endgroup$ Feb 27, 2015 at 14:00

1 Answer 1


You can achieve almost the same thing by saving coordinates. Place an image in Mathematica, click on it, and choose the "coordinates tool" form the little popup menu. Click on as many points as you want (say the upper left and lower right of a bounding box, if that's what you want). When done, choose "copy coordinates". Then paste them into a list.

  • $\begingroup$ @bill_s This works for a single image, but this is not efficient at scale. I have hundreds of images so I'm not going to import each one and then do this all inline by hand, need to automate the process, you know? $\endgroup$ Feb 27, 2015 at 1:39
  • $\begingroup$ But aren't you doing it by hand in Matlab? Anyway, your problem with .mat import -- it will work for simple matrices, so you may have more complex data structures that don't import well. There is also Matlink (matlink.org) that may be able to handle the communication. $\endgroup$
    – bill s
    Feb 27, 2015 at 1:59
  • $\begingroup$ @bill_s Looks like it's not possible now... I'll probably end up making a tool and posting the code. $\endgroup$
    – M.R.
    Feb 27, 2015 at 2:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.