# Matlab Call Micro-Manager
## Setting Matlab and Micro-Manager
We almost follow [Micro-Manager wiki](https://micro-manager.org/wiki/Matlab_Configuration).
We tested on Matlab(2017b, 2020) and Micro-Manager 2.0-gamma(20210312), but should work
on other version.
1. Install Micro-Manager and Andor Driver(just for andor camera) in same folder
2. Add all MM jar files into Matlab classpath.txt by running:
```matlab
cd C:\Program Files\Micro-Manager-2.0gamma
StartMMStudio('-setup')
```
3. Run `edit librarypath.txt` in Matlab command prompt. Append the location of
the dll files
`C:/Program Files/Micro-Manager-2.0gamma` in opening file.
4. Add the location of the dll files to the system path. This is not required
for all device drivers but is required to access the Andor driver. For example,
append `C:\Program Files\Micro-Manager-2.0gamma` to system environment `PATH` or
`Path`
5. Restart Matlab and computer(I don't know whether it is required to refresh
System environment)
6. Test with simple code:
```matlab
>> import mmcorej.*;
>> mmc = CMMCore;
>> mmc.load('C:\user\qblab\documents\MMConfig_Ti.cfg')
```
We once troubled to load Andor driver:
```matlab
```
Typically, in this case, Micro-Manager fail to find other Andor dll files inside
current Matlab working directory. If you just change current working directory
to Micro-Manager installation directory, Andor driver could be loaded normally.
For permanent setting, you should check step 4.
IMPORTANT NOTE:
If camera set to 16 bit, `mmc.getImage()` will returen a 1D array of signed
integers in row-major order in Matlab, we must interpreted it as unsigned integers.
```matlab
>> mmc.snapImage();
>> img = mmc.getImage(); % returned as a 1D array of signed integers in row-major order
>> width = mmc.getImageWidth();
>> height = mmc.getImageHeight();
>> if mmc.getBytesPerPixel == 2
pixelType = 'uint16';
else
pixelType = 'uint8';
end
>> img = typecast(img, pixelType); % pixels must be interpreted as unsigned integers
>> img = reshape(img, [width, height]); % image should be interpreted as a 2D array
>> img = transpose(img); % make column-major order for MATLAB
>> imshow(img);
```

matlab科研助手
- 粉丝: 3w+
- 资源: 5994
最新资源
- 84105929555134世界网络收音机 .apk
- 【毕业设计】基于Python的Django-html人脸表情的分类算法的设计源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 中移铁通操作手册.docx
- 【毕业设计】基于Python的Django-html人信息管理系统及安全策略分析系统源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 狮子座12025年一定要.txt
- 【毕业设计】基于Python的Django-html深度学习文本相似度检测系统(bert)源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 【毕业设计】基于Python的Django-html深度学习的web端多格式纠错系统源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 【毕业设计】基于Python的Django-html图像取证技术研究与实现系统源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 【毕业设计】基于Python的Django-html手写数字识别系统源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 2025误差理论作业参考.zip
- 【毕业设计】基于Python的Django-html图像去雾算法研究系统源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 【毕业设计】基于Python的Django-html图像信息隐藏技术设计源码(完整前后端+mysql+说明文档+LW+PPT).zip
- esp32配置 light-sleep 和 adc button 运行一段时间后系统重启
- 龙岩市乡镇边界,shp格式
- 宁德市乡镇边界,shp格式
- 景德镇市乡镇边界,shp格式
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


