小编Yan*_*ang的帖子

高级方形检测(连接区域)

如果方块在图像中连接了区域,我该如何检测它们.

我测试了OpenCV C++/Obj-C中提到的方法 :高级方形检测

它运作不佳.

有什么好主意吗?

具有连接区域的正方形

import cv2
import numpy as np

def angle_cos(p0, p1, p2):
    d1, d2 = (p0-p1).astype('float'), (p2-p1).astype('float')
    return abs( np.dot(d1, d2) / np.sqrt( np.dot(d1, d1)*np.dot(d2, d2) ) )

def find_squares(img):
    squares = []
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    # cv2.imshow("gray", gray)

    gaussian = cv2.GaussianBlur(gray, (5, 5), 0)

    temp,bin = cv2.threshold(gaussian, 80, 255, cv2.THRESH_BINARY)
    # cv2.imshow("bin", bin)

    contours, hierarchy = cv2.findContours(bin, cv2.RETR_CCOMP, cv2.CHAIN_APPROX_SIMPLE)

    cv2.drawContours( gray, contours, -1, (0, 255, 0), 3 )

    #cv2.imshow('contours', gray)
    for cnt …
Run Code Online (Sandbox Code Playgroud)

python opencv image-processing object-detection computer-vision

9
推荐指数
1
解决办法
8061
查看次数

如何在WinRT中获取文件大小?

在WinRT中没有FileInfo类,只有一个StorageFile类.

如何使用StorageFile该类获取文件的大小?

c# filesize winrt-async

8
推荐指数
2
解决办法
6363
查看次数