Create own intelrealsense project using opencv in Visual Studio
Hello, I have created my own project in Visual Studio. In the project, I wrote my own functions for image processing based on OpenCV, but I encountered the following error while debugging the program:
Exception thrown at 0x00007FFDF406CF19 (KernelBase. dl):WinRT originate error - 0x80040155 :Unable to find proxy registration for IID: {C3ACEFB5-F69D-4905-938F-FCADCF4BE830}.
What should I do?Please help me,thanks.
here's my code:
void imgProc(Mat& imgSrc, std::vector<std::vector<Point>>& ptDst)
{
Mat imgCLAHE, imgBlur, imgMorph, imgMorph1;
Ptr<CLAHE> ptrCLAHE = createCLAHE(5, Size(5, 5));
Ptr<MSER> ptrMSER = MSER::create(5, 500, 2000);
std::vector<std::vector<Point>> points;
std::vector<Rect> rects;
ptrCLAHE->apply(imgSrc, imgCLAHE);
convertScaleAbs(imgCLAHE, imgCLAHE);
GaussianBlur(imgCLAHE, imgBlur, Size(5, 5), 7);
Mat element1 = getStructuringElement(MORPH_RECT, Size(5, 5));
Mat element2 = getStructuringElement(MORPH_RECT, Size(7, 7));
Mat element3 = getStructuringElement(MORPH_RECT, Size(25, 25));
morphologyEx(imgBlur, imgMorph1, MORPH_OPEN, element1);
morphologyEx(imgMorph1, imgMorph1, MORPH_CLOSE, element1); // Morphology stage 1
morphologyEx(imgBlur, imgMorph, MORPH_OPEN, element2); // Morphology stage 2-1
morphologyEx(imgMorph, imgMorph, MORPH_CLOSE, element2); // Morphology stage 2-1
morphologyEx(imgMorph, imgMorph, MORPH_OPEN, element3); // Morphology stage 2-2
morphologyEx(imgMorph, imgMorph, MORPH_CLOSE, element3); // Morphology stage 2-2
subtract(imgMorph, imgMorph1, imgMorph);
ptrCLAHE->apply(imgMorph, imgMorph);
convertScaleAbs(imgMorph, imgMorph);
GaussianBlur(imgMorph, imgMorph, Size(5, 5), 7);
ptrMSER->detectRegions(imgMorph, ptDst, rects);
}
-
Hi Pink Spear I researched all the cases I could find on the internet regarding this particular error, which I have not seen before. Of all the cases, the only one with a suggested solution advised to "add
oleautomationto the IBar attributes". -
Hi Mr.MartyG,today I restarted my computer and commented out the function I wrote myself, leaving only the main function for turning on the camera. Visual Studio still prompts the same bug as yesterday. The program can open a "co sets" window, but it cannot display images and the window interface will also get stuck. May I ask what I should do?
here is my code:
int main(int argc, char* argv[])
try
{
rs2::pipeline pipe;
rs2::config pipe_config;
pipe_config.enable_stream(RS2_STREAM_COLOR, 1280, 800, RS2_FORMAT_RGB8, 30);
//pipe_config.enable_stream(RS2_STREAM_DEPTH, 640, 480, RS2_FORMAT_Z16, 30);
pipe.start(pipe_config);
int frame_count = 0;
namedWindow("co-test", WINDOW_AUTOSIZE);
while (getWindowProperty("co-test", WND_PROP_AUTOSIZE))
{
rs2::frameset frameset = pipe.wait_for_frames();
rs2::video_frame video = frameset.get_color_frame();
const int color_w = video.as<rs2::video_frame>().get_width();
const int color_h = video.as<rs2::video_frame>().get_height();
Mat color_image(Size(color_w, color_h), CV_8UC3, (void*)video.get_data(), Mat::AUTO_STEP);
cvtColor(color_image, color_image, COLOR_RGB2BGR);
imshow("co-test", color_image);
frame_count++;
cout << frame_count << endl;
}
return EXIT_SUCCESS;}
catch (const std::exception &e)
{
std::cerr << e.what() << '\n';
} -
A C++ guide at the link below for setting up a new RealSense project in Visual Studio using .props property sheet files provided by the RealSense SDK may be useful to confirm whether your project has necessary linkages to the librealsense library set up.
https://github.com/EduardoWang/visual-studio-real-sense-record-and-playback-project
Please sign in to leave a comment.
Comments
5 comments