-2
  • i'm working on college computer vision project but stuck at getting coordinates of the bounding box generated by train_object_detector.

    1. i searched through entire documentation but was unable to find the function for getting coordinates in c++. i know about python but i need in c++. studied the abstracts of rectangle.h but of no avail.
    2. been trying on this since yesterday but still no success. what i'm missing?

      rectangle ( const rectangle& rect ); long left ( )

abhishek
  • 11
  • 1
  • 2
  • What's the problem? Converting `dlib::rectangle` to `cv::Rect`? Or what? – Miki Aug 18 '16 at 11:04
  • ok. i got it maybe. you mean i need to first convert dlib rectangle to opencv. right? do you have any link for a example program to do so? – abhishek Aug 18 '16 at 11:06
  • I don't know, it depends on what you want to do.. which is very unclear right now. – Miki Aug 18 '16 at 11:06
  • 2
    it should be as simple as `cv::Rect dlib2cv(const dlib::rectangle& r) {return cv::Rect(r.left(), r.top(), r.width(), r.height());}` – Miki Aug 18 '16 at 11:08
  • i just want to get corner coordinates of the rectangle i.e image so that i can modify that area of image accordingly – abhishek Aug 18 '16 at 11:09
  • sorry, i mistakenly marked it as answer in hurry. i'm having difficulty including both opencv and dlib files. functions are merging kind of. – abhishek Aug 18 '16 at 14:19
  • please improve your question so we can understand what you are asking about. please post your code and describe errors you god. And dlib has a lot of examples - try to start with modifying them – Evgeniy Aug 19 '16 at 06:50

1 Answers1

5

Here is an alternative way to get the coordinates of dlib::rectangle object. Assumption: u're using c++ to do this and the object identifier is A. dlib::rectangle has the ff. methods to access its coordinates.

A.left(), A. top(), A.right() and A.bottom() for x, y, w, and h respectively.

NatiCog
  • 49
  • 3
  • Perhaps you could use a better identifier than `A`. The uppercase variable name is a little bit unconventional too. – byxor Sep 09 '16 at 12:36