OpenCV参考手册(2.4.x)声明初始化MSER的构造函数需要以下参数:
delta,min_area,max_area,max_variation,min_diversity,max_evolution,area_threshold,min_margin,edge_blur_size.
我正在处理灰度图像.参数"delta","max_variation"和"min_diversity"的用途是什么?这些参数有助于控制MSER的哪些属性?
我已经尝试了很多来找到这个的确切答案,我只能在下面的页面上找到一些信息(没有一个在告诉我这3个参数究竟是什么控制时特别有用):1.OpenCV wiki 2. Wikipedia MSER的描述 3. 关于STackOverflow的MSER问题
请帮忙!
我试图在OpenCV 3.0.0 beta中使用MSER算法从图像中提取文本区域.最后,我需要一个带有检测到的MSER区域的二进制掩码,但该算法仅提供轮廓.我试图绘制这些轮廓但我没有得到预期的结果.
这是我使用的代码:
void mserExtractor (const Mat& image, Mat& mserOutMask){
Ptr<MSER> mserExtractor = MSER::create();
vector<vector<cv::Point>> mserContours;
vector<cv::Rect> mserBbox;
mserExtractor->detectRegions(image, mserContours, mserBbox);
for( int i = 0; i<mserContours.size(); i++ )
{
drawContours(mserOutMask, mserContours, i, Scalar(255, 255, 255), 4);
}
}
Run Code Online (Sandbox Code Playgroud)
这是结果:
问题是非凸区域由穿过实际MSER区域的线填充.我想像我从MATLAB获得的区域像素列表detectMSERFeatures
:
任何想法如何从轮廓中获取填充区域(或以其他方式获取MSER掩码)?
我尝试通过 OpenCV 的 MSER 检测在图像上找到对象。但是函数cvExtractMSER
返回的不是轮廓,而是CvSeq
创建图形的一组点 ( ):
(1, 4), (2, 3), (2, 4), (3, 2), (3, 3), (3, 4), (4, 1), (4, 2), (4, 3), (4, 4), ...
Run Code Online (Sandbox Code Playgroud)
但我只需要轮廓点:
(1, 4), (8, 4), (8, 1), (4, 1)
Run Code Online (Sandbox Code Playgroud)
我怎样才能找到这个轮廓?
我认为,最简单(但不是最快)的方法是:
findContours
了新的图像轮廓发现我正在使用MSER识别MSER中的文本区域.我使用以下代码提取区域并将其保存为图像.目前,每个识别的区域都保存为单独的图像.但是,我想合并属于合并为单个图像的文本行的区域.
import cv2
img = cv2.imread('newF.png')
mser = cv2.MSER_create()
img = cv2.resize(img, (img.shape[1]*2, img.shape[0]*2))
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
vis = img.copy()
regions = mser.detectRegions(gray)
hulls = [cv2.convexHull(p.reshape(-1, 1, 2)) for p in regions[0]]
cv2.polylines(vis, hulls, 1, (0,255,0))
Run Code Online (Sandbox Code Playgroud)
如何将属于一行的图像拼接在一起?我得到的逻辑主要是基于一些启发式识别具有附近y坐标的区域.
但是如何在OpenCV中合并这些区域.因为我是openCV的新手,所以我错过了这个.任何帮助,将不胜感激.
我想使用mser检测图像中的文本并删除所有非文本区域.使用下面的代码,我能够检测到文本:
import cv2
import sys
mser = cv2.MSER_create()
img = cv2.imread('signboard.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
vis = img.copy()
regions, _ = mser.detectRegions(gray)
hulls = [cv2.convexHull(p.reshape(-1, 1, 2)) for p in regions]
cv2.polylines(vis, hulls, 1, (0, 255, 0))
cv2.imshow('img', vis)
if cv2.waitKey(0) == 9:
cv2.destroyAllWindows()
Run Code Online (Sandbox Code Playgroud)
如何删除所有非文本区域并获取仅包含文本的二进制图像?我搜索了很多但是找不到任何使用python和opencv的示例代码.
我想BRISK
使用Python和OpenCV实现无人机图像中的特征检测和描述。
由于BRISK
也是一个描述符,我想使用它的描述特征来匹配两个图像。
我该怎么做?
我正在开展一个项目,要求我检测图像中的文本区域.这是我到目前为止使用下面的代码实现的结果.
代码如下:
import cv2
import numpy as np
# read and scale down image
img = cv2.pyrDown(cv2.imread('C:\\Users\\Work\\Desktop\\test.png', cv2.IMREAD_UNCHANGED))
# threshold image
ret, threshed_img = cv2.threshold(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY),
127, 255, cv2.THRESH_BINARY)
# find contours and get the external one
image, contours, hier = cv2.findContours(threshed_img, cv2.RETR_TREE,
cv2.CHAIN_APPROX_SIMPLE)
# with each contour, draw boundingRect in green
# a minAreaRect in red and
# a minEnclosingCircle in blue
for c in contours:
# get the bounding rect
x, y, w, h = cv2.boundingRect(c) …
Run Code Online (Sandbox Code Playgroud) 我正在研究应用于组织学图像的图像配准方法.
我有一个问题.我想使用MSER特征检测器来检测图像上的关键点.在使用opencv提供的MSER函数检索MSER轮廓之后,我计算每个轮廓的质心,以便将其用作有趣点.
如果我直接描述有趣的点,例如使用Surf描述符,描述符的大小就是1,并且不可能比较它们.
因此,有必要用合适的大小修改描述符的大小.
有没有人有想法?
谢谢
mser ×8
opencv ×8
python ×4
bounding-box ×2
c++ ×1
contour ×1
keypoint ×1
matlab-cvst ×1
python-3.x ×1