TypeError: 'cv2.face_EigenFaceRecognizer' object is not callable - opencv3.1

I ran into an error which i do not know where and what is causing it.
Please i need help.
def train(self,images,lables, recogType=0):
self.images = images
self.lables = np.array(lables)
'arg = recogType:[cv2.face.LBPHFaceRecognizer_create(),cv2.face.FisherFaceRecognizer_create(),cv2.face.EigenFaceRecognizer_create()'
recogs = cv2.face.LBPHFaceRecognizer_create(),cv2.face.FisherFaceRecognizer_create(),cv2.face.EigenFaceRecognizer_create()
self.recognizer = recogs[recogType]()
self.recognizer.train(self.images,self.lables)

The specific problem is with this line:
self.recognizer = recogs[recogType]()
By placing braces () on the end, you are trying to call the recognizer, as the error says. Change this to
self.recognizer = recogs[recogType]
//Disclaimer - there may be other problems.

Related

Problem implementing function with input as string in octave

I'm trying to implement a function astronomical_constants but its giving me error
'name' undefined near line 2 column 10
function val = astronomical_constants(name)
switch name
case 'gravitational_constant'
val.name = 'gravitational_constant';
val.value = 6.667e-11;
val.uncertainity = 1e-12;
case 'equitorial_radius_earth'
val.name = 'equitorial_radius_earth';
val.value = 6*10^(20);
val.uncertainty = 1e-12;
endswitch
endfunction
a = astronomical_constants('gravitational_constant').value
I'm not able to understand how I can implement it correctly. Pls help

I'm having trouble with sending a form using POST to retrieve data in R

I'm having trouble collecting doctors from https://www.uchealth.org/providers/. I've found out it's a POST method but with httr I can't seem to create the form. Here's what I have
url = url = 'https://www.uchealth.org/providers/'
formA = list(title = 'Search', onClick = 'swapForms();', doctor-area-of-care-top = 'Cancer Care')
formB = list(Search = 'swapForms();', doctor-area-of-care = 'Cancer Care')
get = POST(url, body = formB, encode = 'form')
I'm fairly certain formB is the correct one. However, I can't test it since I yield an error when trying to make the list. I believe it is because you can't use "-" characters when naming although I could be wrong on that. Could somebody help please?
I am unable to comment properly but try this to create an list. Code below worked for me.
library(httr)
url = 'https://www.uchealth.org/providers/'
formB = list(Search = 'swapForms();', `doctor-area-of-care` = 'Cancer Care')
get = POST(url, body = formB, encode = 'form')
When you are creating names with spaces or some other special character you have to put it into the operator above.

Compile error: method or data member not found

When I try to compile, I have been getting this error saying "Method or data member not found".
This is the code:
Set db = CurrentDb
Set rec = db.OpenRecordset("Select * from SuppliersT")
rec.AddNew
rec("SupplierName") = Me.SupplierAddNameTxt
rec("Address") = Me.SupplierAddAddressTxt
rec("City") = Me.SupplierAddCityTxt
rec("ProvinceState") = Me.SupplierAddProvinceStateTxt
rec("PostalZip") = Me.SupplierAddPostalZipTxt
rec("Phone") = Me.SupplierAddPhoneTxt
rec("Fax") = Me.SupplierAddFaxTxt
rec("Email") = Me.SupplierAddEmailTxt
rec("Notes") = Me.SupplierAddNotesTxT
rec.Update
It highlights the Me.SupplierAddNameTxt in
rec("SupplierName") = Me.SupplierAddNameTxt
I have a textbox named SupplierAddNameTxt on the form the button is located on, and that's why I am trying to set that up to. Not sure why it's doing this. Help would be much appreciated!
I created a form frmTest, added the control SupplierAddNameTxt, with your code, there is no compiling error.
So please check orthograph of the word SupplierAddNameTxt of the control name on the form.
You might type SupplierAddNameTxt in caption instead of the property name.

ActionwithAction and ActionwithDuration method giving error

I have an old code .I am trying to port it to new version of Cocos2dx It is giving me errors in the following lines.
CCSequence * pulseSequence = CCSequence::actionOneTwo(CCFadeIn::actionWithDuration(1), CCFadeOut::actionWithDuration(1));
CCRepeatForever* repeatAction = CCRepeatForever::actionWithAction(pulseSequence);
In ActiononeTwo, ActionwithDuration, and ActionwithAction method.It is telling me they are not the part of CCSequence.
CCSequence * pulseSequence = CCSequence::createWithTwoActions(CCFadeIn::create(1), CCFadeOut::create(1));
CCRepeatForever* repeatAction = CCRepeatForever::create(pulseSequence);
This should work.

How can I use function callback ('StopFcn' , 'TimerFcn' )for audiorecorder object in MATLAB?

I want to execute the function 'get_pitch(samples,fs,winsize,winshift)' while during recording through audiorecorder object. To do that, I found that 'function callback' would be helpful to do that.
So I try to this code.
% assume fs,winsize,winshift is given.
T = 0.1; % in seconds
samples = cell{100,1};
r = audiorecorder(fs,16,1);
k=1;
r.TimerPeriod = 0.1;
r.StopFcn = 'samples{k} = getaudiodata(r);';
r.TimerFcn = {#get_pitch,samples{k},winsize,winshift};
while 1
record(r,T);
k=k+1;
end
But following exception occurs during execution.
1) after record(r,T) is executed. (StopFcn is now called)
??? Error using ==> eval
Undefined function or variable 'r'.
2) after StopFcn is called (TimerFcn is now called)
In this phase, get_pitch function have totally wrong parameters. For example, parameter
in the position samples{k} change to 'audiorecorder object'.
It seems that I do not know exact use of 'StopFcn' & 'TimerFcn'.
Is there anyone who can give me some advice? I really appreciate all of your comments.