daharoni / Miniscope_DAQ_Software

Data acquisition source code for Miniscope project.
MIT License
15 stars 16 forks source link

control the miniscope with matlab #17

Open s12754 opened 5 years ago

s12754 commented 5 years ago

Currently I am trying to control the miniscope with MATLAB ,the camera can be found and controls by using Image Acquisition Tool, but I didn't find a way to control the excitation LED . Can anyone helps me to control the excitation LED with matlab, thanks!

fxpena commented 5 years ago

This would be really neat if you make it work!

daharoni commented 5 years ago

Hi @s12754, Sorry for the slow response. The Miniscope should be able to be controlled by any software capable of connecting to it or a webcam. The controls for excitation power, gain, and exposure are handled through the adjustment of standard webcam/UVC camera properties. In other words, the Miniscope hijacks HUE, BRIGHTNESS, and one other camera property to adjust its custom properties. I cannot remember off the top of my head which UVC properties match which Miniscope properties but you can find this information on the Miniscope discussion board or by skimming through the Miniscope DAQ firmware code or the Miniscope DAQ Software code. Just search for "GAIN" or "HUE" and you should find the relevant portion.

DenisPolygalov commented 5 years ago

CAP_PROP_SATURATION is used to control frame rate CAP_PROP_BRIGHTNESS is used to control exposure CAP_PROP_GAIN is used to control gain and CAP_PROP_HUE is used to control the excitation LED power. Be careful however, Miniscope's firmware react to these settings to being set() but does not return their values when OpenCV's get() called returning only garbage instead. The chance to get of the same behavior in Matlab is quite high. There are more tricky stuff to keep in mind while trying to control Miniscope from PC+OpenCV+Python but in the case of Matlab it might be different.

s12754 commented 5 years ago

@daharoni @DenisPolygalov Thanks for your reply,I tried to change the HUE value by using MATLAB, the brightness of excitation LED was changed. Now I can simultaneously control the miniscope , behavior camera and signal input by using matlab ! Thanks again!