0

I had built opencv and opencv_contrib using this pyimagesearch guide and was getting an attribute error :

AttributeError: 'module' object has no attribute 'createLBPHFaceRecognizer'

On trying to checkout opencv_contrib which seemed to be the problem, this is what my terminal shows :

git checkout 3.2.0  
Note: checking out '3.2.0'.  

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.  

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:  

     git checkout -b <new-branch-name>

HEAD is now at 86342522... Merge pull request #701 from LaurentBerger:DericheFilter

Considering the fact that I have zero knowledge of git and scarce knowledge of opencv, what should I do to fix the detached head if that could be the problem for the attribute error?

alroc
  • 27,574
  • 6
  • 51
  • 97
momo
  • 1,052
  • 5
  • 16
  • 34
  • You don't need to worry about it, as you are not going to contribute directly to this contrib repo, for building your OpenCV code, it seems fine to me – ZdaR Apr 08 '17 at 17:02
  • Do you have a link to this guide or does it cost something? – qräbnö Apr 08 '17 at 17:08
  • @uav added the link. – momo Apr 08 '17 at 17:19
  • @ZdaR I guessed so,but then what could be the reason for the attribute error. – momo Apr 08 '17 at 17:30
  • Thanks momo. Maybe checkout an older version like 3.0.0 and hope that createLBPHFaceRecognizer is in it. – qräbnö Apr 08 '17 at 17:44
  • I know opencv 2 doesn't give these errors, I guess will have to uninstall opencv 3..great. thanks though! @uav – momo Apr 08 '17 at 18:08
  • 1
    @CodeWizard thank you for your answer, but although very informative it doesn't 'exactly' answer my question. I'd be glad if you could remove the duplicate tag since that may hinder my chances of getting help. Thank you. – momo Apr 09 '17 at 01:37

1 Answers1

0

Considering the fact that I have zero knowledge of git and scarce knowledge of opencv, what should I do to fix the detached head if that could be the problem for the attribute error?

You are in detached HEAD since you have checked out a tag name.
The commit which the tag is pointing to is not the latest commit so you are in detached HEAD.

Read here how to "fix" it How to move HEAD back to a previous location? (Detached head)

or if you just want to work on this tag so check it out as new branch as the help shows you

# check it out as master
git checkout -b <new-branch-name>
Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167