简体   繁体   English

相当于mslice []在matlab到python中?

[英]Equivalent of mslice[] in matlab to python?

I've been given some MatLab code and I'm trying to write it in Python. 我已经获得了一些MatLab代码,我正在尝试用Python编写它。 However, I've searched online and I cannot find an equivalent or even documentation for the MatLab (I'm assuming) method 'mslice'. 但是,我在线搜索,我找不到MatLab(我假设)方法'mslice'的等效文件甚至文档。 For context, I'm doing image analysis with cv2, numpy, and matplotlib. 对于上下文,我正在使用cv2,numpy和matplotlib进行图像分析。 I'm pretty new to this, so any help would be appreciated. 我对此很陌生,所以任何帮助都会受到赞赏。

for i in mslice[1:VC.NumObjects]:
    ii = numel(VC.PixelIdxList(i))
    if ii <= 10:
        BWvtemo(VC.PixelIdxList(i)).lvalue = 0
    end
end

After some emailing and some researching around, I've found my answer, so I'm just posting it here for others who might have my problem. 经过一些电子邮件和一些研究,我找到了答案,所以我只是在这里发布给其他可能有我问题的人。 mslice is a method is not defined outside the OMPC matlab to python converter. mslice是一个没有在OMPC matlab之外定义到python转换器的方法。 A similar method one could use would be the range() function or the numpy function arange() for non integer values. 可以使用的类似方法是range()函数或非整数值的numpy函数arange() Thanks to everyone who helped! 感谢所有帮助过的人!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM