小编Ark*_*rka的帖子

支持库VectorDrawable Resources $ NotFoundException

我使用的是Design Support Library版本23.4.0.我启用了gradle标志:

defaultConfig {
    vectorDrawables.useSupportLibrary = true
}
Run Code Online (Sandbox Code Playgroud)

我正在使用构建工具版本23.0.2,但仍然,我正在Resources$NotFoundException使用KitKat或更低版本.

它发生在我使用android:drawableLeft或时imageView.setImageResource(R.drawable.drawable_image).

是的,我把它放在我使用drawables的每个活动上

static {
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
Run Code Online (Sandbox Code Playgroud)

这是支持库的错误吗?

android android-support-library androiddesignsupport android-vectordrawable

67
推荐指数
8
解决办法
3万
查看次数

Firebase离线时setValue上没有CompletionListener

我有这个代码库,我设置了一个值.在脱机模式下,它成功写入但未调用CompletionListener.onComplete回调函数.

newOrderRef.setValue(order, (firebaseError, firebase) -> {
            if (firebaseError != null) {
                Timber.e(firebaseError.toException(), "Order create failed, id: %s", order.getOrderId());
                subscriber.onError(firebaseError.toException());

            } else {
                Timber.i("Order created, id: %s", order.getOrderId());
                newOrderRef.setPriority(0 - timestamp);
                subscriber.onNext(firebase.getKey());
                subscriber.onCompleted();
            }
        });
Run Code Online (Sandbox Code Playgroud)

回调永远不会被调用.但写得很好.

在另一种情况下,即使在取消订阅onDestroy使用后CompositeSubscription,即使片段未运行,当值写入firebase服务器时也会调用订阅者.

这是正确的行为吗?

      Subscription orderSubscription = OrderManager.createOrder(order)
                        .subscribe(s -> {
                            fabShowSuccess();
                            showSnackbar("onnext Order created " + order.getOrderId());
                        }, throwable -> {
                            showSnackbar("Order failed. Make sure your are connected to internet.");
                            fabShowFailed();
                        }, () -> {
                            fabShowSuccess();
                            showSnackbar("Order created " + order.getOrderId());
                        }); …
Run Code Online (Sandbox Code Playgroud)

java android firebase rx-java

6
推荐指数
1
解决办法
1247
查看次数

如何从图像中仅提取字符?

我有这种类型的图像,我只想提取字符.

在此输入图像描述

二值化之后,我得到了这张图片

img = cv2.imread('the_image.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
thresh = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY, 11, 9)
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

然后在此图像上找到轮廓.

(im2, cnts, _) = cv2.findContours(thresh.copy(), cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
cnts = sorted(cnts, key=cv2.contourArea, reverse=True)
for contour in cnts[:2000]:
    x, y, w, h = cv2.boundingRect(contour)
    aspect_ratio = h/w
    area = cv2.contourArea(contour)
    cv2.drawContours(img, [contour], -1, (0, 255, 0), 2) 
Run Code Online (Sandbox Code Playgroud)

我正进入(状态

在此输入图像描述

我需要一种方法来过滤轮廓,以便它只选择字符.所以我可以找到边界框并提取roi.

我可以找到轮廓并根据区域的大小过滤它们,但源图像的分辨率不一致.这些图像来自移动相机.

此外,框的边框是断开的.我无法准确检测到这些盒子.

编辑:

如果我取消选择宽高比小于0.4的盒子.然后它在某种程度上起作用.但我不知道它是否适用于不同分辨率的图像.

for contour in cnts[:2000]:
    x, y, w, h = cv2.boundingRect(contour)
    aspect_ratio = h/w
    area = cv2.contourArea(contour)

    if aspect_ratio < 0.4:
        continue …
Run Code Online (Sandbox Code Playgroud)

python opencv image-processing computer-vision mnist

5
推荐指数
1
解决办法
1780
查看次数