小编Aks*_*sin的帖子

Volley JsonObjectRequest在GET请求中发送标头

我试图从GET请求发送一些身份验证标头,我尝试使用Volley JsonObjectRequest调用:

Map<String,String> params=new HashMap<String,String>();
        params.put("token","fghjbvjhnjjk");
        activity.showDialog();
        JsonObjectRequest req = new JsonObjectRequest(Request.Method.GET,url,
                new JSONObject(params), new Response.Listener<JSONObject>() {

            @Override
            public void onResponse(JSONObject response) {
                Log.d(tag, response.toString());
                activity.hideDialog();
                try {
                    activity.onRequestServed(response, code);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                VolleyLog.d(tag, "Error: " + error.getMessage());
                Log.e(tag, "Site Info Error: " + error.getMessage());
                Toast.makeText(activity.getApplicationContext(),
                        error.getMessage(), Toast.LENGTH_SHORT).show();
                activity.hideDialog();
                try {
                    activity.onRequestServed(null,code);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        }); …
Run Code Online (Sandbox Code Playgroud)

android android-volley

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

EMGU CV视频摄像师无法制作视频

我试图使用Emgu CV VideoWriter捕获视频,但它显示:

无法创建VideoWriter.确保安装了特定的编解码器

我该如何处理?
这就是我的代码:

Bitmap back = new Bitmap("jpg image path");
Image<Bgr, Byte> bg;
bg = new Image(Bgr, byte)(back);
vw = new VideoWriter("c://work//test1.mp4",CvInvoke.CV_FOURCC('M','S','V','C'), 17, 640, 480, true);
Run Code Online (Sandbox Code Playgroud)

它适用于.avi扩展,但是只有几秒钟的大小相当大,所以我想更多地压缩它.请建议代码/库的任何变通方法或更改.

c# opencv bitmap image-compression emgucv

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