我使用的程序squares.c的OpenCV库的样本中找到.它适用于每个图像,但我真的无法弄清楚为什么它不能识别该图像中绘制的正方形
http://desmond.imageshack.us/Himg12/scaled.php?server=12&filename=26725680.jpg&res=medium
CANNY之后:http: //img847.imageshack.us/img847/6787/canny.jpg
在DILATE之后:http: //img593.imageshack.us/img593/3010/dilate.jpg
在RESULT图像(红色) http://img267.imageshack.us/img267/8016/resultuq.jpg
如您所见,未检测到方形.
在检测之后,我需要提取广场中包含的区域......没有投资回报率怎么可能?
我试图检测这张图片中的管道数。为此,我使用 OpenCV 和基于 Python 的检测。基于对类似问题的现有答案,我能够提出以下步骤
当我们手动计数时,管道的总数约为 909给或取 4。
应用过滤器后
import cv2
import matplotlib.pyplot as plt
import numpy as np
img = cv2.imread('images/input-rectpipe-1.jpg')
blur_hor = cv2.filter2D(img[:, :, 0], cv2.CV_32F, kernel=np.ones((11,1,1), np.float32)/11.0, borderType=cv2.BORDER_CONSTANT)
blur_vert = cv2.filter2D(img[:, :, 0], cv2.CV_32F, kernel=np.ones((1,11,1), np.float32)/11.0, borderType=cv2.BORDER_CONSTANT)
mask = ((img[:,:,0]>blur_hor*1.2) | (img[:,:,0]>blur_vert*1.2)).astype(np.uint8)*255
Run Code Online (Sandbox Code Playgroud)
我得到这个蒙面图像
这在显示的可见矩形数量方面看起来相当准确。但是,当我尝试进行计数并在图片顶部绘制边界框时,它也会选择很多不需要的区域。对于圆,HoughCircles 有一种定义最大和最小半径的方法。矩形是否有类似的东西可以提高准确性。另外,我愿意接受有关解决此问题的替代方法的建议。
ret,thresh = cv2.threshold(mask,127,255,0)
contours,hierarchy = cv2.findContours(thresh, 1, 2)
count = 0
for i in range(len(contours)):
count = count+1
x,y,w,h = cv2.boundingRect(contours[i])
rect = cv2.minAreaRect(contours[i])
area …Run Code Online (Sandbox Code Playgroud) python opencv image-processing object-detection computer-vision
几周来我一直在尝试解决这个问题。我使用 Google Colaboratory是因为我的 MacBook Pro 配备了TensorFlow 不支持的Apple 芯片。这是具有评论权限的 Google Colaboratory 链接。 点击这里。
我尝试过使用旧版本的 TensorFlow,但没有任何改变,我已准备好 TensorFlow 记录和训练管道文件。
python object-detection data-science tensorflow tensorflow2.0
我一直在玩OpenCV,并且有很多试验和错误已经设法学习如何检测照片中的圆圈(硬币).一切都很好,除非我直接将硬币放在一起(如下所示,忽略了第二张图像倒置的事实).

看起来因为硬币是如此接近,cvFindContours认为它们是同一个对象.我的问题是如何将这些轮廓分成单独的对象,或者获得已经分离的轮廓列表.
我用于cvFindContours的参数是:
cvFindContours( img, storage, &contour, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE, cvPoint(0, 0) );
Run Code Online (Sandbox Code Playgroud)
任何帮助或建议将不胜感激.
我正在尝试深入学习图像.我有来自不同相机的约4000张图像,具有不同的光线条件,图像分辨率和视角.
我的问题是:什么样的图像预处理有助于改善对象检测?(例如:对比度/颜色标准化,去噪等)
这个问题可能已得到解答,但我没有找到一个简单的答案.我使用Keras创建了一个convnet来对"辛普森一家"字符进行分类(这里是数据集).
我有20个类并给出一个图像作为输入,我返回字符名称.这很简单.我的数据集包含图片中主要字符的图片,并且只有字符的名称作为标签.
现在我想添加一个对象检测问题,即在图片中的字符周围绘制一个边界框并预测它是哪个字符.我不想使用滑动窗口,因为它真的很慢.所以我考虑使用更快的RCNN(github repo)或YOLO(github repo).我是否应该为训练集的每张图片添加边界框的坐标?有没有办法在没有给出训练集的坐标的情况下进行物体检测(并在我的测试中得到边界框)?
总之,我想创建一个简单的对象检测模型,我不知道是否有可能创建一个更简单的YOLO或更快的RCNN.
非常感谢您的帮助.
python model_main.py --model_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2
_pets.config
WARNING:tensorflow:Estimator's model_fn (<function create_model_fn.<locals>.model_fn at 0x00000155CFDB5C80>) includes params argument, but params are not passed to Estimator.
WARNING:tensorflow:num_readers has been reduced to 1 to match input file shards.
WARNING:root:Variable [SecondStageBoxPredictor/BoxEncodingPredictor/biases] is available in checkpoint, but has an incompatible shape with model variable.
WARNING:root:Variable [SecondStageBoxPredictor/BoxEncodingPredictor/weights] is available in checkpoint, but has an incompatible shape with model variable.
WARNING:root:Variable [SecondStageBoxPredictor/ClassPredictor/biases] is available in checkpoint, but has an incompatible shape with model variable.
WARNING:root:Variable [SecondStageBoxPredictor/ClassPredictor/weights] is available in checkpoint, …Run Code Online (Sandbox Code Playgroud) 我想在照片中提取人物的轮廓并删除背景.照片可以拍摄全身,只有上半身或仅下半身.
到目前为止我所做的是使用Haar Cascades追踪脸部,但我使用的算法在脸上做了一个矩形,我需要整个身体的形状.我也尝试了HOG,但它也给了我一个矩形,它不适用于所有照片.
如果有人可以帮助我会很棒.我正在使用OpenCV和C++.
我按照这里找到的例子.但每当我输入命令"C:/ Program Files/protoc/bin/protoc"object_detection/protos/.proto --python_out =.我收到一个错误,上面写着object_detection/protos / .proto:没有这样的文件或目录.我无法创建名为*.proto的目录.所以我遗漏了一些关于如何做到这一点的基本信息.由于我找不到任何人抱怨这个问题,它必须非常简单.我正在使用Windows操作系统.
有人在另一个论坛上问我这个问题,但我想将它发布给任何在TFRecords上遇到麻烦的人。
如果TFRecord文件中的标签与labels.pbtxt文件中的标签不对齐,TensorFlow的对象检测API可能会产生奇怪的行为。它会运行,损失可能会减少,但网络将无法产生良好的检测结果。
另外,我总是会在XY,行列空间之间感到困惑,因此我总是想仔细检查以确保我的注释实际上在注释图像的正确部分。
我发现最好的方法是解码TFRecord并用TF工具绘制它。下面是一些代码:
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from object_detection.utils import visualization_utils as vu
from object_detection.protos import string_int_label_map_pb2 as pb
from object_detection.data_decoders.tf_example_decoder import TfExampleDecoder as TfDecoder
from google.protobuf import text_format
def main(tfrecords_filename, label_map=None):
if label_map is not None:
label_map_proto = pb.StringIntLabelMap()
with tf.gfile.GFile(label_map,'r') as f:
text_format.Merge(f.read(), label_map_proto)
class_dict = {}
for entry in label_map_proto.item:
class_dict[entry.id] = {'name':entry.display_name}
sess = tf.Session()
decoder = TfDecoder(label_map_proto_file=label_map, use_display_name=False)
sess.run(tf.tables_initializer())
for record in tf.python_io.tf_record_iterator(tfrecords_filename):
example = decoder.decode(record) …Run Code Online (Sandbox Code Playgroud) object-detection ×10
opencv ×4
python ×4
tensorflow ×4
c ×2
c++ ×1
data-science ×1
geometry ×1
keras ×1
protoc ×1
tfrecord ×1