OpenCV GrabCut Algorithm example not working -
Using Directly on C + + I, I am trying to implement a brookart algorithm in OpenCV and how to achieve it in a simple way. Unfortunately, it seems that the code is not working for me
#include "opencv2 / opencv.hpp" #include & lt; Iostream & gt; Using namespace cv; using namespace std; Int main () {// Open second image mat image; Image = cv :: imread ("Picture / MangoAaGGGG"); // Define Rectangular CV :: Rectangle Rectangle (50,70, Fig. Cols-150, image.rows-180); CV :: mat result; // Partition Results (4 Possible Values): CV :: Mate BGMold, FGModel; // Model (Used internally) // Grabcoot Partition Service :: Grad Cut (Image, // Input Image Results, // Partition Results Rectangle, // Rectangle in which foreground BGModel, FGModel, // Model 1, // Number of iteration CV :: GC_INIT_WITH_RECT); //use rectangle cout & lt; & Lt; "Oaks payto" & lt; & Lt; Endl; // possible foreground cv :: get the pixels marked as comparison (result, cv :: gc_pr_fgd, results, cv :: CMP_EQ); // Generate Output Image CV :: Mate Foreground (Image Size), CV_8 UC3, CV :: Scalar (255,255,255)); Image.copyTo (foreground, results); // bg pixels not copy / original image cv :: rectangle (image, rectangular, cv :: scalar (255,255,255), 1); CV :: namedWindow ("Image"); Cv :: imshow ("image", image); // Display results CV :: Named Windoo ("Segmented Image"); Cv :: imshow ("broken image", foreground); WaitKey (); Return 0; } Can anyone help me with this? What is considered a problem PS: Any errors were printed while compiling.
Check your settings again I did the same tutorial and it worked fine for me
Comments
Post a Comment