久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 python opencv 跟蹤白色

Tracking white color using python opencv(使用 python opencv 跟蹤白色)
本文介紹了使用 python opencv 跟蹤白色的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

I would like to track white color using webcam and python opencv. I already have the code to track blue color.

_, frame = cap.read()
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)

# define range of blue color in HSV
lower_blue = np.array([110,100,100])
upper_blue = np.array([130,255,255])

#How to define this range for white color


# Threshold the HSV image to get only blue colors
mask = cv2.inRange(hsv, lower_blue, upper_blue)
# Bitwise-AND mask and original image
res = cv2.bitwise_and(frame,frame, mask= mask)

cv2.imshow('frame',frame)
cv2.imshow('mask',mask)
cv2.imshow('res',res)

what values should I give as lower bound and upper bound to track white color!!?? I tried changing values and I got other colors but no luck with the white color!!!

is that HSV values or BGR values specified as lower and upper bounds???

PS : I must get the last result as a binary image for further processing!!

Please help me !!!

解決方案

I wrote this for tracking white color :

import cv2
import numpy as np

cap = cv2.VideoCapture(0)

while(1):

    _, frame = cap.read()
    hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)

    # define range of white color in HSV
    # change it according to your need !
    lower_white = np.array([0,0,0], dtype=np.uint8)
    upper_white = np.array([0,0,255], dtype=np.uint8)

    # Threshold the HSV image to get only white colors
    mask = cv2.inRange(hsv, lower_white, upper_white)
    # Bitwise-AND mask and original image
    res = cv2.bitwise_and(frame,frame, mask= mask)

    cv2.imshow('frame',frame)
    cv2.imshow('mask',mask)
    cv2.imshow('res',res)

    k = cv2.waitKey(5) & 0xFF
    if k == 27:
        break

cv2.destroyAllWindows()

I tried to track the white screen of my phone and got this :

You can try changing the HSV values You might also try HSL color space as Legat said, it would be more accurate

這篇關于使用 python opencv 跟蹤白色的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to draw a rectangle around a region of interest in python(如何在python中的感興趣區域周圍繪制一個矩形)
How can I detect and track people using OpenCV?(如何使用 OpenCV 檢測和跟蹤人員?)
How to apply threshold within multiple rectangular bounding boxes in an image?(如何在圖像的多個矩形邊界框中應用閾值?)
How can I download a specific part of Coco Dataset?(如何下載 Coco Dataset 的特定部分?)
Detect image orientation angle based on text direction(根據文本方向檢測圖像方向角度)
Detect centre and angle of rectangles in an image using Opencv(使用 Opencv 檢測圖像中矩形的中心和角度)
主站蜘蛛池模板: 在线a视频 | 国产做a爱免费视频 | 中文字幕一区在线观看视频 | 在线一区| 国产午夜精品一区二区三区嫩草 | 久久久综合精品 | 欧美888| 亚洲国产精品va在线看黑人 | 日韩一级 | 午夜一区二区三区在线观看 | 色五月激情五月 | 精品国产欧美一区二区 | 古装三级在线播放 | 99久久婷婷国产综合精品电影 | 久久国产精品视频免费看 | 国产最新精品视频 | 四虎影视1304t | 亚洲精品一二区 | 欧美一区二区大片 | 日本不卡一区二区三区在线观看 | 新91 | 亚洲天堂中文字幕 | 国产精品久久久久久久久久久久久 | 国产精品99| 欧美视频在线看 | 亚洲成人一级 | 亚洲精品一区中文字幕 | 欧美精品久久 | 国内自拍第一页 | 午夜国产羞羞视频免费网站 | 精品国产一区二区三区久久久蜜月 | 婷婷在线视频 | 午夜爱爱毛片xxxx视频免费看 | 亚洲日本视频 | 日韩视频在线观看 | 国产精品69久久久久水密桃 | 美女一级黄 | 国产精品毛片久久久久久 | 色资源站 | 亚洲精品久久久久中文字幕欢迎你 | 成人午夜高清 |