Ask Your Question

EduardoGG's profile - activity

2018-06-20 07:57:10 -0600 received badge  Popular Question (source)
2015-10-13 09:46:50 -0600 received badge  Enthusiast
2015-10-11 14:16:34 -0600 commented answer GrabCut Implementation in JAVA

Hello Sudesh, thanks for the reply, could you explian a little bit your code please, Im new using OpenCV and Im getting used to the library, thanks.

2015-10-11 14:13:17 -0600 received badge  Editor (source)
2015-10-11 14:11:14 -0600 answered a question GrabCut Implementation in JAVA

Thanks Sudesh, could you explain a little bit the code please?, Im new using OPENCV, also Do you know how to apply the grabcut but instead using INIT_WITH_RECT, use INTI_WITH_MASK? so far what I got is this, probably with Images you can see my real problem:

First you can select the part you want as your ROI in this case the part selected is mark with a gray rectangle :

image description

Applying grabcut with INIT_WITH_RECT the algorithm show this:

image description

As you can see the grabcut select a part that is not wanted so Im trying to enhance the selection with doing some touchups in the parts you want as foreground and as a background, in this example foreground is mark with blue and foregroun with red as below:

image description

Here comes the problem, how to apply again the grabcut algorithm but now indicating that the blue lines are foreground and the red lines are background? I have read about it and saw the python examples but in python the use of arrays is far different from java. What I know and correct me if I'm wrong, i have to modify the mask and reapply the grabcut algorithm, but when I try this I found this error:

image description

error:

OpenCV Error: Assertion failed (!bgdSamples.empty() && !fgdSamples.empty()) in initGMMs, file C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\imgproc\src\grabcut.cpp, line 379 Exception in thread "AWT-EventQueue-0" CvException [org.opencv.core.CvException: cv::Exception: C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\imgproc\src\grabcut.cpp:379: error: (-215) !bgdSamples.empty() && !fgdSamples.empty() in function initGMMs ]

Could you give me a hand with this?

Thanks in advance

2015-10-08 20:41:05 -0600 asked a question GrabCut Implementation in JAVA

Hi everyone, Im new using OPENCV, also Do you know how to apply the grabcut but instead using INIT_WITH_RECT, use INTI_WITH_MASK? so far what I got is this, probably with Images you can see my real problem:

First you can select the part you want as your ROI in this case the part selected is mark with a gray rectangle :

image description

Applying grabcut with INIT_WITH_RECT the algorithm show this:

image description

As you can see the grabcut select a part that is not wanted so Im trying to enhance the selection with doing some touchups in the parts you want as foreground and as a background, in this example foreground is mark with blue and background with red as below:

image description

Here comes the problem, how to apply again the grabcut algorithm but now indicating that the blue lines are foreground and the red lines are background? I have read about it and saw the python examples but in python the use of arrays is far different from java. What I know and correct me if I'm wrong, i have to modify the mask and reapply the grabcut algorithm, but when I try this I found this error:

image description

Error:

OpenCV Error: Assertion failed (!bgdSamples.empty() && !fgdSamples.empty()) in initGMMs, file C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\imgproc\src\grabcut.cpp, line 379 Exception in thread "AWT-EventQueue-0" CvException [org.opencv.core.CvException: cv::Exception: C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\imgproc\src\grabcut.cpp:379: error: (-215) !bgdSamples.empty() && !fgdSamples.empty() in function initGMMs ]

Could you give me a hand with this?

Thanks in advance