I am trying to build a microscope that can accommodate multiple cameras simultaneously and I was wondering if anybody could provide an example on how to do this using the ImSwitch library.
Hey @Derek8202, thanks a lot for reaching out to us! Integrating two cameras in ImSwitch is actually relatively simple. You can have a look at this example:
"detectors": {
"WidefieldCamera": {
"ExtPackage": "imswitch_det_webcam",
"analogChannel": null,
"digitalLine": null,
"managerName": "GXPIPYManager",
"managerProperties": {
"cameraListIndex": 1,
"isRGB": 0,
"cameraEffPixelsize": 0.327,
"gxipycam": {
"exposure": 20,
"gain": 0,
"blacklevel": 10,
"image_width": 1000,
"image_height": 1000,
"flipX": true,
"flipY": true
}
},
"forAcquisition": true,
"forFocusLock": true
},
"Observer": {
"managerName": "OpenCVCamManager",
"managerProperties": {
"cameraListIndex": 1,
"cameraListIndexWIN": 0,
"cameraEffPixelsize":100,
"cameraPixelSize":100,
"isRGB":1,
"opencvcam": {
"exposure": 10
}
},
"forAcquisition": false
}
},
Where there are two cameras, one overview camera (actually a USB web-camera) and the actual microscope camera. Both of them can be operated individually. If you want to retreive frames there is the snapImage
function (e.g. via fastapi ImSwitch/imswitch/imcontrol/controller/controllers/RecordingController.py at 89e06ec2f3009f212970210c479e564ae7c10e5b · openUC2/ImSwitch · GitHub) that lets you choose the detector name you want to retreive the images from.
I hope that makes sense.