Open nesquik011 opened 1 month ago
Does the camera give you a side-by-side video stream in opencv? You could use this camera driver: https://github.com/introlab/rtabmap/blob/master/corelib/include/rtabmap/core/camera/CameraStereoVideo.h
You will need to calibrate the camera. If you have already the calibration, convert in the right format. Look at the yaml files in the example stereo data here: https://github.com/introlab/rtabmap/wiki/Stereo-mapping#process-a-directory-of-stereo-images
If the camera is not calibrated, you can calibrate from rtabmap main app. Go in Preferences->Source, select Stereo input then scroll down to select "Side-by-side video" driver, then click on calibrate. You can export a checkerboard from that screen and show it on a display/tv (then measure the size of the squares).
@matlabbe thank you , so the example i am working on will do as i want right ?
Yeah, we don't really have other c++ examples :)
@matlabbe i just built the lib and examples on windows 10 visual studio 2022 after suffering lol XD i will test the [CameraStereoVideo.h] with the example you shared and i will report back i hope nothing would break
thanks a lot
@matlabbe may you kindly check the example , i modified the RGBD mapping example
Note: i posted the code at Pastebin because the comment would be too long https://pastebin.com/hRNVCUhv
i had couple of problems but it fixed them anyway tell me what do you think of the code ? , it pop up a windows for 3D only and i cant see the camera feed
@matlabbe i updated CameraStereoVideo.cpp with fourcc , but yet i cant manage to make it work , the camera is so laggy
if (src_ == CameraVideo::kUsbDevice)
{
if (stereoModel_.isValidForProjection())
{
if (capture_.isOpened())
{
// Set FOURCC to MJPG for USB camera
capture_.set(CV_CAP_PROP_FOURCC, CV_FOURCC('M', 'J', 'P', 'G'));
capture_.set(CV_CAP_PROP_FRAME_WIDTH, stereoModel_.left().imageWidth() * (capture2_.isOpened() ? 1 : 2));
capture_.set(CV_CAP_PROP_FRAME_HEIGHT, stereoModel_.left().imageHeight());
if (capture2_.isOpened())
{
capture2_.set(CV_CAP_PROP_FOURCC, CV_FOURCC('M', 'J', 'P', 'G'));
capture2_.set(CV_CAP_PROP_FRAME_WIDTH, stereoModel_.right().imageWidth());
capture2_.set(CV_CAP_PROP_FRAME_HEIGHT, stereoModel_.right().imageHeight());
}
}
}
else if (_width > 0 && _height > 0)
{
if (capture_.isOpened())
{
// Set FOURCC to MJPG for USB camera
capture_.set(CV_CAP_PROP_FOURCC, CV_FOURCC('M', 'J', 'P', 'G'));
capture_.set(CV_CAP_PROP_FRAME_WIDTH, _width * (capture2_.isOpened() ? 1 : 2));
capture_.set(CV_CAP_PROP_FRAME_HEIGHT, _height);
if (capture2_.isOpened())
{
capture2_.set(CV_CAP_PROP_FOURCC, CV_FOURCC('M', 'J', 'P', 'G'));
capture2_.set(CV_CAP_PROP_FRAME_WIDTH, _width);
capture2_.set(CV_CAP_PROP_FRAME_HEIGHT, _height);
}
}
}
}
hello is there anyone has a C++ code as stereo example ? i want to do visalizatio and build a dense map with loop detection and icp etc the example i found says i need to pick one , so if i am using usb camera what should i do ? its not ZED , but it looks like ZED its stereo , with one stream feed and i need to use opencv first to pick the resolution and forrce it to be MJPG so how can i do that
thanks in advance