小编Ste*_*ell的帖子

OpenCV Python - 修复破碎的文本

我正在尝试修复损坏的文本(下面的图像),以便我可以对图像执行OCR.我该如何修复下面的文字?我已经尝试过扩张,侵蚀,形态闭合,以及使用轮廓之间的距离.这些似乎都不起作用.我要感谢任何帮助,谢谢.

破碎的文字:

在此输入图像描述

在此输入图像描述

在此输入图像描述

尝试解决方案(无效):

import cv2
import pytesseract
import numpy as np

img = cv2.imread ("/Users/2020shatgiskessell/Desktop/OpenSlate/FN2.png")

def OCR (img):
    config = ('-l eng --oem 1 --psm 3')
    text = pytesseract.image_to_string(img, config = config)
    return text

def get_countour(img):
        try:
            output = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
            output = output.copy()
        except Exception:
            output = img.copy()
        #imgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
        #ret, thresh = cv2.threshold(output, 127, 255, 0)
        contours, hierarchy = cv2.findContours(output, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
        c = max(contours, key = cv2.contourArea)
        contours.remove(c)
        cv2.drawContours(output, contours, -1, (0,255,0),-1)

        kernel = np.ones((2,1),np.uint8) …
Run Code Online (Sandbox Code Playgroud)

python ocr opencv

12
推荐指数
1
解决办法
671
查看次数

Swift - GoogleMaps SDK获取触摸坐标

我是swift和Google Maps SDK的新手,想知道如何使用Google Maps SDK获取用户点击的位置坐标.例如,如果用户将手指放在地图上的某个位置,则会在那里创建注释.我非常感谢你的帮助,谢谢.

google-maps google-maps-markers google-maps-sdk-ios swift

4
推荐指数
1
解决办法
4044
查看次数

Swift - 更改注释图像不起作用

我已经按照其他堆栈帖子和教程将我的注释图像更改为自定义图像,但它似乎不起作用.不会出现错误或运行时错误,只是注释图像不会改变.

顺便说一下,我在线上设置了一个断点annotationView!.image = UIImage(named: "RaceCarMan2png.png"),它显示了该线被调用,但是没有任何反应.我将衷心感谢您的帮助.谢谢.

func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
    if annotation is MKUserLocation {
        return nil
    }

    let identifier = "MyCustomAnnotation"

    var annotationView = mapView.dequeueReusableAnnotationViewWithIdentifier(identifier)
    if annotationView == nil {
        annotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: identifier)
        annotationView?.canShowCallout = true

        annotationView!.image = UIImage(named: "RaceCarMan2png.png")

    } else {
        annotationView!.annotation = annotation
    }


    configureDetailView(annotationView!)

    return annotationView
}

func configureDetailView(annotationView: MKAnnotationView) {
        annotationView.detailCalloutAccessoryView = UIImageView(image: UIImage(named: "url.jpg"))
}
Run Code Online (Sandbox Code Playgroud)

mkmapview mkannotation ios swift

3
推荐指数
1
解决办法
3275
查看次数