python识别图片坐标查看器_Opencv/python图像处理后如何获取检测区域的坐标

这段代码展示了如何使用OpenCV在Python中读取图像,并通过颜色过滤找到蓝色像素。它找到了蓝色像素的轮廓,计算了轮廓的中心坐标,并将这些坐标保存在数据框中。最后,它在图像上显示了这些中心点。
摘要由CSDN通过智能技术生成

这是我使用的代码。最后,我不得不重新调整我的数据帧,但只是为了更好地阅读。我认为我的代码有很多可能的改进,但是我很高兴我的代码行为足够好地满足我的需要。在import cv2

import numpy as np

import pandas as pd

img = cv2.imread('full_snap.png')

"""

some of my blue pixels

R: between 98 and 128

G: between 176 and 211

B: between 255

h: between 210 and 200

s: between 100 and 48

v: between 68 and 100

hsv/2 in opencv and opencv uses BGR not RGB

"""

blue_MIN = np.array([255, 176, 98])

blue_MAX = np.array([255, 211, 128])

"""

https://pythonprogramming.net/color-filter-python-opencv-tutorial/

"""

# find the blue pixels and save it in frame_threshed

frame_threshed = cv2.inRange(img, blue_MIN, blue_MAX)

# find contours in the thresholded image

cnts = cv2.

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值