91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 3KB
    文件類型: .py
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-05-15
  • 語言: Python
  • 標簽: openmv??

資源簡介

OpenMV形狀識別And顏色識別!

資源截圖

代碼片段和文件信息

#?Blob?Detection?Example
#
#?This?example?shows?off?how?to?use?the?find_blobs?function?to?find?color
#?blobs?in?the?image.?This?example?in?particular?looks?for?dark?green?objects.

import?sensor?image?time

#?For?color?tracking?to?work?really?well?you?should?ideally?be?in?a?very?very
#?very?controlled?enviroment?where?the?lighting?is?constant...
red_threshold_01?=?(120?160?0?40?0?40)

#設置紅色的閾值,括號里面的數(shù)值分別是L?A?B?的最大值和最小值(minL?maxL?minA
#?maxA?minB?maxB),LAB的值在圖像左側三個坐標圖中選取。如果是灰度圖,則只需
#設置(min?max)兩個數(shù)字即可。

#?You?may?need?to?tweak?the?above?settings?for?tracking?green?things...
#?Select?an?area?in?the?framebuffer?to?copy?the?color?settings.

sensor.reset()?#?Initialize?the?camera?sensor.
sensor.set_pixformat(sensor.RGB565)?#?use?RGB565.
sensor.set_framesize(sensor.QQVGA)?#?use?QVGA?for?quailtiy?use?QQVGA?for?speed.
sensor.skip_frames(10)?#?Let?new?settings?take?affect.
sensor.set_auto_whitebal(False)
#關閉白平衡。白平衡是默認開啟的,在顏色識別中,需要關閉白平衡。
clock?=?time.clock()?#?Tracks?FPS.

‘‘‘
??擴寬roi
‘‘‘
def?expand_roi(roi):
????#?set?for?QQVGA?160*120
????extra?=?5
????win_size?=?(160?120)
????(x?y?width?height)?=?roi
????new_roi?=?[x-extra?y-extra?width+2*extra?height+2*extra]

????if?new_roi[0]?????????new_roi[0]?=?0
????if?new_roi[1]?????????new_roi[1]?=?0
????if?new_roi[2]?>?win_size[0]:
????????new_roi[2]?=?win_size[0]
????if?new_roi[3]?>?win_size[1]:
????????new_roi[3]?=?win_size[1]

????return?tuple(new_roi)

while(True):
????clo

評論

共有 條評論