02 find_blobs函数的探究 ---- 效率

本文探讨了OpenMV库中find_blobs函数的使用,特别是在二值化灰度图像中寻找质心的效率。通过代码示例,对比了使用内置函数与自定义算法的时间消耗,发现在256*8的图像中,内置函数只需1ms,而自定义算法耗时37ms。提出了对MicroPython执行速度的疑问,涉及Python解释器和C编译器的效率差异。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

基础怎么用官网说的太多了,但是就博主使用的过程中,有些坑还是要提醒下同样使用OpenMv的同学。

首先贴出官网对于该函数的说明:

image.find_blobs(thresholds[, roi=Auto,x_stride=2, y_stride=1, invert=False, area_threshold=10,pixels_threshold=10, merge=False, margin=0, threshold_cb=None,merge_cb=None])

Finds all blobs (connected pixel regionsthat pass a threshold test) in the image and returns a list of blob objects whichdescribe each blob. Please see the blob object moremore information.

thresholds must be a listof tuples [(lo, hi), (lo, hi), ..., (lo, hi)] defining theranges of color you want to track. You may pass up to 16 threshold tuples inone image.find_blobs call. For grayscale images each tupleneeds to contain two values - a min grayscale value and a max grayscale value.Only pixel regions that fall between these thresholds will be considered. ForRGB565 images each tuple needs to have six values (l_lo, l_hi, a_lo, a_hi,b_lo, b_hi) - which are minimums and maximums for the LAB L, A, and B channelsrespectively. For easy usage this function will automatically fix swapped minand max values. Additionally, if a tuple is larger than six values the rest areignored. Conversely, if the tuple is too short the rest of the thresholds areassumed to be zero.

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值