2

I have built the latest version of OpenCV (2.4.6) from source on Ubuntu and have been using it for development for some time. I want to modify one of its libraries (namely the obj_detect one) by editing the source directly.

Is there a way I can do this without having to rebuild the whole opencv library every time I make a change to the objdetect header?

Thanks, Aly

5
  • Are you sure you'll have to modify some inherent part of the code rather than adjusting parameters or passing different values?
    – Mario
    Nov 11, 2013 at 13:18
  • @Mario, yes. I actually want to use internal state of one of the algorithms so need to expose protected and private members. I might be able to do this by extending the class and exposing the protected members that way?
    – Aly
    Nov 11, 2013 at 13:24
  • You can essentially subclass the original class that's in OpenCV. This way you'll gain access to protected members, but not private members.
    – Mario
    Nov 11, 2013 at 13:26
  • @Mario after further thought, this seems to be the best approach. If you answer, I will accept
    – Aly
    Nov 11, 2013 at 13:29
  • There's nothing wrong in answering your own question (and accepting it) if you've got an idea on your own that's working. The site is more about "did someone else have the same problem and how did they solve it?", not scores. :)
    – Mario
    Nov 11, 2013 at 13:42

1 Answer 1

1

You can essentially subclass the original class that's in OpenCV. This way you'll gain access to protected members, but not private members. Yet you won't have to recompile everything. Just keep in mind that this might not work in all cases, especially when not everything is marked as virtual. Haven't touched OpenCV for ages, so not really sure about ist current design.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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