小编Cas*_*law的帖子

C++控制台键盘事件

有没有办法在Windows控制台中获取关键事件?我需要一种无需GUI即可快速获得keydown和keyup事件的方法.我已经尝试过使用getch(),但它没有得到键盘并等待按键返回.

c++ windows console keyboard-events

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

在opencv 2.4 for python中缺少冲浪

我试图实例化一个对象SURF使用OpenCV的Python作为描述在这里,但出现这种情况:

>>> import cv2
>>> cv2.__version__
'2.4.0'
>>> cv2.SURF()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'SURF'
Run Code Online (Sandbox Code Playgroud)

有谁知道为什么会发生这种情况,或者如果从OpenCV的Python版本中缺少SURF?

python opencv surf

8
推荐指数
1
解决办法
4151
查看次数

在ObjectInputStream.readObject()上设置超时是否安全?

我有一个ObjectInputStream连接到一个ObjectOutputStream通过套接字,我一直在使用Socket.setSoTimeout(),使ObjectInputStream.readObject()只有块100毫秒.自从我开始这样做以来,我StreamCorruptedError在打电话的过程中得到了很多readObject().超时可能是罪魁祸首吗?

java timeout

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

Android ACTION_SEND事件:"消息无法上传附件"

我正在尝试实现一个共享按钮,用于捕获屏幕截图并通过标准Android界面共享.我能够创建屏幕截图(我可以在浏览SD卡时看到它),但是当我尝试发送它时,消息应用程序会出错:"消息无法上传附件."

我的代码

File imageDir = new File(Environment.getExternalStorageDirectory(), "inPin");
if(!imageDir.exists()) { imageDir.mkdirs(); }
File closeupImageFile = new File(imageDir, "closeup.png");
File overviewImageFile = new File(imageDir, "overview.png");

View mapView = findViewById(R.id.floor_map);
saveScreenshotToFile(mapView, closeupImageFile);

ArrayList<Uri> imageUris = new ArrayList<Uri>();
imageUris.add(Uri.fromFile(closeupImageFile));

String message = String.format("I'm on %s %s", building.name, getCurrentFloor().name);

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, message);
sendIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris);
sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
sendIntent.setType("image/*");
startActivity(Intent.createChooser(sendIntent, "Share via"));
Run Code Online (Sandbox Code Playgroud)

saveScreenshotToFile方法

private static void saveScreenshotToFile(View view, File saveFile) throws IOException {
    view.setDrawingCacheEnabled(true);
    view.buildDrawingCache(true);
    Bitmap bitmap = view.getDrawingCache();
    FileOutputStream out = …
Run Code Online (Sandbox Code Playgroud)

android

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

标签 统计

android ×1

c++ ×1

console ×1

java ×1

keyboard-events ×1

opencv ×1

python ×1

surf ×1

timeout ×1

windows ×1