与像素处理的轮廓(OpenCV的)? [英] Dealing with pixels in contours (OpenCV)?

查看:141
本文介绍了与像素处理的轮廓(OpenCV的)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已检索到的图像的轮廓,并希望具体工作轮廓中的像素。我需要找到轮廓中的像素值的总和(未区域)。 OpenCV的只支持矩形状的投资回报率,所以我不知道如何做到这一点。 cvSum也只接受完整的图像,没有口罩的选择,所以我有点失去了怎么办。有没有人对如何找到一个特定的轮廓像素值的总和有什么建议?

I have retrieved a contour from an image and want to specifically work on the pixels in the contour. I need to find the sum (not area) of the pixel values in the contour. OpenCV only supports rectangle shaped ROI, so I have no idea how to do this. cvSum also only accepts complete images and doesn't have a mask option, so I am a bit lost on how to proceed. Does anyone have any suggestions on how to find the sum of the values of pixels in a specific contour?

推荐答案

首先让所有的轮廓。使用此信息来创建一个二进制图像的白色部分是轮廓的轮廓和面积。执行AND运算对两幅图像。结果将是在黑色背景上的轮廓和面积。然后,只需总结所有的像素在这一形象。

First get all of your contours. Use this information to create a binary image with the white parts being the contour's outline and area. Perform an AND operation on the two images. The result will be the contours and area on a black background. Then just sum all of the pixels in this image.

这篇关于与像素处理的轮廓(OpenCV的)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆