小编Mil*_*vic的帖子

短信广播接收器重启后无法正常工作

我正在尝试从短信中获取电话号码和电话簿名称.当我从应用程序运行它并关闭应用程序时,它可以工作,但是,当我重新启动我的手机时,它不起作用.任何人?

public class IncomingSMSReceiver extends BroadcastReceiver {
    private static final String queryString = "@zovi";
    private static final String SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";

    public void onReceive(Context _context, Intent _intent) {
        if (_intent.getAction().equals(SMS_RECEIVED)) {
            Intent intent = new Intent(_context, IncomingSMSService.class);
            _context.startService(intent);
            Bundle bundle = _intent.getExtras();
            if (bundle != null) {
                Object[] pdus = (Object[]) bundle.get("pdus");
                SmsMessage[] messages = new SmsMessage[pdus.length];
                for (int i = 0; i < pdus.length; i++)
                    messages[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
                for (SmsMessage message : messages) {
                    String msg = message.getMessageBody(); …
Run Code Online (Sandbox Code Playgroud)

service sms android broadcastreceiver

16
推荐指数
2
解决办法
2990
查看次数

从照片opencv中删除眩光

因此,我使用opencv捕获文档,扫描并裁剪文档.当房间里没有灯光时,它可以很好地工作.当房间里有一些灯光,桌子上有眩光并且文件靠近它时,它也会抓住眩光作为矩形的一部分.

如何从照片中消除眩光?

这是我用来获取我想要的图像的代码:

 Mat &image = *(Mat *) matAddrRgba;
    Rect bounding_rect;

    Mat thr(image.rows, image.cols, CV_8UC1);
    cvtColor(image, thr, CV_BGR2GRAY); //Convert to gray
    threshold(thr, thr, 150, 255, THRESH_BINARY + THRESH_OTSU); //Threshold the gray

    vector<vector<Point> > contours; // Vector for storing contour
    vector<Vec4i> hierarchy;
    findContours(thr, contours, hierarchy, CV_RETR_CCOMP,
                 CV_CHAIN_APPROX_SIMPLE); // Find the contours in the image
    sort(contours.begin(), contours.end(),
         compareContourAreas);            //Store the index of largest contour
    bounding_rect = boundingRect(contours[0]);

    rectangle(image, bounding_rect, Scalar(250, 250, 250), 5);
Run Code Online (Sandbox Code Playgroud)

这是我正在谈论的眩光照片:

在此输入图像描述

我发现的东西是使用inRange,找到适当的颜色标量,我们可以去除光线.这是一个代码片段,但它始终崩溃说它需要8位图像与chanels.

Mat &image = *(Mat *) matAddrRgba;

    Mat …
Run Code Online (Sandbox Code Playgroud)

c++ android opencv

12
推荐指数
2
解决办法
8293
查看次数

在Windows Server Core Docker上安装.NET Framework 3.5

我正在努力在docker容器上安装.NET Framework 3.5.我已经安装了4.5,但需要3.5才能运行一个服务.这是我的Dockerfile:

FROM microsoft/windowsservercore
SHELL ["powershell"]


RUN Install-WindowsFeature NET-Framework-45-ASPNET ; \  
    Install-WindowsFeature Web-Asp-Net45

RUN dism /online /enable-feature /featurename:NetFX3 /all

COPY Startup Startup
COPY Service Service



RUN "C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe" WCS.WindowsService.exe


RUN mkdir Temp\Logs

ENTRYPOINT C:\Startup\setupBatch.bat

COPY ContainerApi ContainerApi

RUN Remove-WebSite -Name 'Default Web Site'  
RUN New-Website -Name 'ContainerApi' -Port 80 \  
    -PhysicalPath 'C:\ContainerApi' -ApplicationPool '.NET v4.5'

EXPOSE 80

CMD ["ping", "-t", "localhost"]  
Run Code Online (Sandbox Code Playgroud)

当我尝试构建它时,它会让我在线错误 RUN dism

错误:0x800f081f

找不到源文件.
使用"源"选项指定还原功能所需文件的位置.有关指定源位置的详细信息,请参阅http://go.microsoft.com/fwlink/?LinkId=243077.

现在,即使我dism /online /enable-feature /featurename:NetFX3 /all在docker(docker exec)内部运行,它仍然会给我同样的错误.

有帮助的人吗?

.net c# docker dockerfile

11
推荐指数
2
解决办法
4077
查看次数

RestSharp超时无法正常工作

我有一个restsharp客户端和请求设置如下:

var request = new RestRequest();
request.Method = Method.POST;
request.AddParameter("application/json", jsonBody, ParameterType.RequestBody);
request.OnBeforeDeserialization = resp => { resp.ContentType = "application/json"; };
request.Timeout = -1;
request.ReadWriteTimeout = -1;
var url = $"http://{ipAddress}/api/calculate";
var client = new RestClient();
client.BaseUrl = new Uri(url);
client.Timeout = -1;
client.ReadWriteTimeout = -1;
var response = client.Execute(request);
Run Code Online (Sandbox Code Playgroud)

这个请求需要一段时间才能完成,大约需要30分钟.现在,我知道有更优雅的方法可以做到这一点,但是,对于这个请求,我需要这样做.

此RestSharp客户端和请求在Windows服务中执行.当服务执行请求时,它会抛出TimoutException并且请求最大超时大约为40秒.

出于某种原因,我设置的超时对于这种情况不起作用.

有人有解决方案吗?

.net c# windows-services timeout restsharp

7
推荐指数
3
解决办法
2万
查看次数

使用NDK的Android未定义参考

我正在尝试从实现代码

这里

尝试编译时,出现以下错误:

Error:(339) undefined reference to `ANativeWindow_fromSurface'
Error:(340) und
Error:(349) undefined reference to `ANativeWindow_setBuffersGeometry'
Error:(351) undefined reference to `ANativeWindow_lock'
Error:(353) undefined reference to `ANativeWindow_release'
Error:(406) undefined reference to `ANativeWindow_unlockAndPost'
Error:(407) undefined reference to `ANativeWindow_release'
Error:error: linker command failed with exit code 1 (use -v to see invocation)
Information:BUILD FAILED
Information:Total time: 2.012 secs
Information:8 errors
Information:0 warnings
Information:See complete output in console
Run Code Online (Sandbox Code Playgroud)

ANativeWindow 从2个c ++ .h文件中获取,其中一个是

#include <android/native_window.h>
Run Code Online (Sandbox Code Playgroud)

和别的

 #include <android/native_window_jni.h>
Run Code Online (Sandbox Code Playgroud)

现在,我的CMake文件如下所示:

cmake_minimum_required(VERSION 3.4.1)

# OpenCV stuff
include_directories(D:\\opencv-3.2.0-android-sdk\\OpenCV-android-sdk\\sdk\\native\\jni\\include)
add_library( …
Run Code Online (Sandbox Code Playgroud)

c++ android android-ndk

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

OpenCv C++ 裁剪图像

因此,我设法使用 opencv C++ 代码检测文档边框。现在,我需要裁剪该图像并使其看起来不错。

正如您在这张图片中看到的那样,边界检测看起来不错:

裁剪前

但是现在,当我尝试裁剪它时,它看起来像这样:

裁剪后

现在,这是我使用的代码:

extern "C"
JNIEXPORT void JNICALL
Java_prisca_ctest_ScanActivity_doWithMat(JNIEnv *env, jobject instance, jlong matNumber) {
    //reference to the image from Java
    Mat &image = *(Mat *) matNumber;
    //resize image
    image = GetSquareImage(image);
    //add color effects for better detection
    Mat gray;
    cvtColor(image, gray, CV_BGR2GRAY);
    GaussianBlur(gray, gray, Size(5, 5), 0);
    Mat edged;
    Canny(gray, edged, 75, 200);
    //find contours and sort them from biggest to smallest
    vector<vector<Point> > contours;
    vector<Point> screenCnt;
    findContours(edged, contours, RETR_LIST, CHAIN_APPROX_SIMPLE);
    // sort contours
    sort(contours.begin(), …
Run Code Online (Sandbox Code Playgroud)

c++ android opencv image

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

来自EditText动画的TextView就像在LinkedIn上一样

当你输入你的用户名和密码时,我想知道在登录界面的Linkedin android应用程序中使用哪个ui视图,当你输入时,editText提示会以文本视图的形式上升?

user-interface android themes material-design

0
推荐指数
1
解决办法
868
查看次数