Open originholic opened 10 years ago
Hi @originholic , are you still working on ths?
Hi, Current code should works without (wiki give a method), I currently run it on MINGW on windows without ROS and using camera input from opencv method.
Thks Ghis
@GhisHD, excuse me. Which opencv method are you using to feed rpg_svo with camera images?
Thank you very much. Yoshua
@YoshuaNava i think he meant just rewriting function runFromFolder
in test_pipeline.cpp
, by changing source of images. For getting images from camera you should create opencv camera:
cv::VideoCapture cap(0);
than in process cycle read img from camera and convert it to grayscale:
bool bSuccess = cap.read(img);
cv::cvtColor(img, img, CV_RGB2GRAY);
and add it to svo
vo_->addImage(img, 0.01*img_id);
For example:
void BenchmarkNode::runFromCamera()
{
cv::VideoCapture cap(0);
if (!cap.isOpened()) // if not success, exit program
{
std::cout << "Cannot open the video cam" << endl;
return;
}
double dWidth = cap.get(CV_CAP_PROP_FRAME_WIDTH); //get the width of frames of the video
double dHeight = cap.get(CV_CAP_PROP_FRAME_HEIGHT); //get the height of frames of the video
std::cout << "Frame size : " << dWidth << " x " << dHeight << endl;
for (int img_id = 2;;++img_id)
{
cv::Mat img;
bool bSuccess = cap.read(img);
cv::cvtColor(img, img, CV_RGB2GRAY);
if (!bSuccess)
{
std::cout << "Cannot read a frame from video stream" << endl;
}
cv::imshow("Video stream", img);
if (cv::waitKey(30) == 27)
{
cout << "esk key is pressed" << endl;
break;
}
assert(!img.empty());
// process frame
vo_->addImage(img, 0.01*img_id);
SE3 T_world_from_vision_;
SE3 T_world_from_cam;
Vector3d p;
T_world_from_vision_ = SE3(Matrix3d::Identity(), Vector3d::Zero());
T_world_from_cam = SE3(T_world_from_vision_*vo_->lastFrame()->T_f_w_.inverse());
p = Vector3d(vo_->lastFrame()->T_f_w_.translation());
// display tracking quality
if(vo_->lastFrame() != NULL)
{
// std::cout << "Frame-Id: " << vo_->lastFrame()->id_ << " \t"
std::cout << "#Features: " << vo_->lastNumObservations() << " \t";
// << "Proc. Time: " << vo_->lastProcessingTime()*1000 << "ms \t"
std::cout << "X: " << p[0] << " \t"
<< "Y: " << p[1] << " \t"
<< "Z: " << p[2] << "\n";
// access the pose of the camera via vo_->lastFrame()->T_f_w_.
}
}
}
Hi guys, were you able to get SVO working on a live camera without ROS? Im having trouble getting it working. Any help would be appreciated!
Hi guys, how do I get the live camera view as shown in the video. I want to use svo on a raspberry pi3 and track the path traversed by my mobile robot. After compiling and building the package, I ran the svo ( without ros) test_pipeline. The programme ran, but I was not able to see the output tracking.
Any help would be appreciated thanks!
@lorhm , Were you successful in running it on the PI?
This is probably a fundamental issues, I am wondering that is it possible to run a live camera with SVO that built without ROS? and how can I modify the code to do so? Many thanks