我试图运行朱古力上Linux Ubuntu.安装后,我在gpu中运行caffe,错误是
I0910 13:28:13.606891 10629 caffe.cpp:296] Use GPU with device ID 0
modprobe: ERROR: could not insert 'nvidia_352': No such device
F0910 13:28:13.728612 10629 common.cpp:142] Check failed: error == cudaSuccess (38 vs. 0) no CUDA-capable device is detected
*** Check failure stack trace: ***
@ 0x7ffd3b9a7daa (unknown)
@ 0x7ffd3b9a7ce4 (unknown)
@ 0x7ffd3b9a76e6 (unknown)
@ 0x7ffd3b9aa687 (unknown)
@ 0x7ffd3bf91cb5 caffe::Caffe::SetDevice()
@ 0x40a5a7 time()
@ 0x4080f8 main
@ 0x7ffd3aeb9ec5 (unknown)
@ 0x408618 (unknown)
@ (nil) (unknown)
Aborted (core …Run Code Online (Sandbox Code Playgroud) 它应该是直截了当的,但我不确定哪里出了问题.我试着抓住TextViewwith 上的点击:
public void runNextTask(){
final View addView = getLayoutInflater().inflate(R.layout.addnewtracker, null);
final TrackerInfo newInfo = new TrackerInfo();
//set up for model selection
TextView modelTextview = (TextView)addView.findViewById(R.id.modelEdit)
modelTextview.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
Run Code Online (Sandbox Code Playgroud)
你的XML TextView是:
<TextView
android:id="@+id/model"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Tracker_model"
android:clickable="true"
android:onClick="onClick"/>
Run Code Online (Sandbox Code Playgroud)
但是当我点击TextView它时,它不会进入onClick()方法.我错过了什么?
谢谢
我有错误No module named __future__.我使用tensorflow,它有Python2.7.一旦我运行程序,我得到错误,如下所示.
import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/coie/tensorflow/local/lib/python2.7/site-packages/tensorflow/__init__.py", line 19, in <module>
from __future__ import absolute_import
ImportError: No module named __future__
Run Code Online (Sandbox Code Playgroud)
如何将未来安装到tensorflow的Python中?
我正在尝试使用Motion JPEG流媒体流式传输jpgs.我需要安装包libv41-dev作为必需的库,当我安装时sudo apt-get install libv41-dev,我得到Unable to locate package libv41-dev错误.为什么找不到那个包裹?我在谷歌搜索libv41-dev,没有太多的信息出来.该库是linux/videodev.h文件所必需的.谢谢
我根据这篇文章安装了ffmpeg .ffmpeg安装还可以.现在我用ffmpeg支持构建opencv,我有一些错误.错误是
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp:1484:21: error: ‘CODEC_FLAG_GLOBAL_HEADER’ was not declared in this scope
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
^
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp: In function ‘int icv_av_write_frame_FFMPEG(AVFormatContext*, AVStream*, uint8_t*, uint32_t, AVFrame*)’:
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp:1512:30: error: ‘AVFMT_RAWPICTURE’ was not declared in this scope
if (oc->oformat->flags & AVFMT_RAWPICTURE) {
^
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘void CvVideoWriter_FFMPEG::close()’:
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp:1686:35: error: ‘AVFMT_RAWPICTURE’ was not declared in this scope
if( (oc->oformat->flags & AVFMT_RAWPICTURE) == 0 )
^
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvVideoWriter_FFMPEG::open(const char*, int, double, int, int, bool)’:
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp:1920:32: error: ‘AVFMT_RAWPICTURE’ was …Run Code Online (Sandbox Code Playgroud) 我正在尝试将caffe(为Linux开发)源代码移植到Windows环境中.问题出在sigaction结构处signal_handler.cpp和signal_handler.h.源代码如下所示.我的查询是可以使用哪个库或代码替换来使其sigaction在Windows中正常工作.
///头文件
#ifndef INCLUDE_CAFFE_UTIL_SIGNAL_HANDLER_H_
#define INCLUDE_CAFFE_UTIL_SIGNAL_HANDLER_H_
#include "caffe/proto/caffe.pb.h"
#include "caffe/solver.hpp"
namespace caffe {
class SignalHandler {
public:
// Contructor. Specify what action to take when a signal is received.
SignalHandler(SolverAction::Enum SIGINT_action,
SolverAction::Enum SIGHUP_action);
~SignalHandler();
ActionCallback GetActionFunction();
private:
SolverAction::Enum CheckForSignals() const;
SolverAction::Enum SIGINT_action_;
SolverAction::Enum SIGHUP_action_;
};
} // namespace caffe
#endif // INCLUDE_CAFFE_UTIL_SIGNAL_HANDLER_H_
Run Code Online (Sandbox Code Playgroud)
///源文件
#include <boost/bind.hpp>
#include <glog/logging.h>
#include <signal.h>
#include <csignal>
#include "caffe/util/signal_handler.h"
namespace {
static volatile sig_atomic_t got_sigint = …Run Code Online (Sandbox Code Playgroud) 我有两个Opencv,opencv-2.4.10安装在/ usr中,opencv-3.1安装在/ usr/local中.我可以轻松地在Eclipse中设置opencv路径.在cmake中,如何设置我喜欢用于该项目的opencv之一的路径?谢谢
我的程序是
int main(){
cout << "Start the process" << endl;
cv::VideoCapture vcap("rtsp://root:pass@192.168.0.90/axis-media/media.amp?camera=1");
cout << "Camera connection done!" << endl;
cv::Mat image, small;
//Output video
cv::Size S = cv::Size((int) vcap.get(CV_CAP_PROP_FRAME_WIDTH), (int) vcap.get(CV_CAP_PROP_FRAME_HEIGHT));
int ex = static_cast<int>(vcap.get(CV_CAP_PROP_FOURCC));
int fps = vcap.get(CV_CAP_PROP_FPS);
cout << "fps " << fps << " ex " << ex << endl;
cv::VideoWriter outputVideo;
outputVideo.open("TEST.avi", ex/*CV_FOURCC('X', '2', '6', '4')*/, vcap.get(CV_CAP_PROP_FPS), S, true);
if(!outputVideo.isOpened()){
cout << "Could not open the output video for write" << endl;
return -1;
}
for(;;){ …Run Code Online (Sandbox Code Playgroud) 关于这个主题有很多讨论.但它们都不适合我.我实现了一个定制的ListView用ImageView在ListView和ListView从扩展ListFragment.我的ImageView是可点击的,因此当用户单击ImageView时,将激活Camera活动并使用捕获的图像更新ImageView.XML如下所示
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/list_background_selector"
android:orientation="horizontal"
android:padding="5dip" >
<!-- ListRow Left sied Thumbnail image -->
<LinearLayout android:id="@+id/thumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dip"
android:layout_alignParentLeft="true"
android:background="@drawable/image_bg"
android:layout_marginRight="5dip">
<ImageView
android:id="@+id/list_image"
android:layout_width="50dip"
android:clickable="true"
android:focusable="false"
android:contentDescription="@string/image_view_description"
android:layout_height="50dip"
android:src="@drawable/icons_preview"
/>
</LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
现在我需要区分用户的列表项目或ImageView的点击.我设置onListItemClick了可以捕获用户单击ListView中的列表项,但是当我单击ImageView时,它不起作用.如何检测用户何时单击ImageView.我的ListFragment类如下所示.
public class MyListFragment extends ListFragment {
private customList_Adaptor adapter;
private static final int CAMERA_REQUEST = 0;
private static final int RESULT_OK = 0;
private static MyListFragmentInterface mCallback = null;
static Context …Run Code Online (Sandbox Code Playgroud) 我开发 iOS 应用程序,它使用相机。AVCaptureDeviceInput 用于与相机连接。我检查了授权状态为
- (void)checkDeviceAuthorizationStatus
{
NSString *mediaType = AVMediaTypeVideo;
[AVCaptureDevice requestAccessForMediaType:mediaType completionHandler:^(BOOL granted) {
if (granted)
{
//Granted access to mediaType
[self setDeviceAuthorized:YES];
}
else
{
//Not granted access to mediaType
dispatch_async(dispatch_get_main_queue(), ^{
[[[UIAlertView alloc] initWithTitle:@"AVCam!"
message:@"AVCam doesn't have permission to use Camera, please change privacy settings"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil] show];
[self setDeviceAuthorized:NO];
});
}
}];
}
Run Code Online (Sandbox Code Playgroud)
当我启动应用程序时,为什么它不询问用户访问相机的权限?因此该应用程序不会出现在设置/隐私/相机中以手动允许访问相机。然后显示此错误"AVCam doesn't have permission to use Camera, please change privacy settings"并且应用程序无法使用相机。
编辑:这意味着未经用户许可,应用程序不得访问相机。不仅是相机,相机胶卷也存在同样的问题。
所有这些事情都是在我在“设置/重置/恢复所有设置”中重置设置后发生的。在此之前,该应用程序运行良好。