HBadertscher / Matlab_BaslerCamDriver

A universal MATLAB driver for Basler cameras
MIT License
21 stars 5 forks source link

Problem with baslerSetParameter() for Boolean types #28

Open FloHuber opened 6 years ago

FloHuber commented 6 years ago

Dear Mr. Badertscher I'm a German Student working on a project to design an app which is supposed to do a live-PIV. Used is the camera: Basler acA1300-200um

Now as I was designing the interface i noticed that i have problems with the baslerSetParameter() function in matlab. All other functions work perfectly on my computer as far as i can see. It's possible to set boolean parameters to 1 but not back to 0. If the option verbose is active, the output always tells me that the parameter is being set to 1. There's no difference between typing 1 or 0, the result is always 1. I tried logical(0),logical(false), ~1 and boolean(0). My command looks like this: baslerSetParameter(0,'ReverseX',logical(0),1)

Output: Using camera "acA1300-200um" Set Parameter "ReverseX" to 1

Have you got any idea where this problem comes from or how to solve it? If you are interested in the project I'm more than happy to tell you about it. For the project i use the Pylon Viewer 4. Thank you very much in advance.

Greetings Florian Huber

HBadertscher commented 6 years ago

Hi Florian

Thanks for this bug report, I wasn't aware of this, but could reproduce the problem. Could you test out the following please:

Open the file baslerSetParameter.cpp and change lines 84 to 86 from:

           const bool b_param_value = (const bool)mxGetLogicals(prhs[2]);
            BaslerHelper::set_parameter(&camera, 
                    s_param_name.c_str(), &b_param_value , b_verbose);

to this:

           const bool* b_param_value = (const bool*)mxGetLogicals(prhs[2]);
            BaslerHelper::set_parameter(&camera, 
                    s_param_name.c_str(), b_param_value , b_verbose);

and re-compile the driver by calling make again in MATLAB.

I couldn't fully test this, but this should solve the problem. I'd be happy to hear if this works, then I can include it here on Github.

Grüsse Hannes

FloHuber commented 6 years ago

Thanks for the fast support! Replacing those lines worked, now i can set those parameter to 0 and 1. That's great! Thank you very much!

Gruß Flo