Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on line 'cv2.grabCut(img,mask,None,bgdModel,fgdModel,5,cv2.GC_INIT_WITH_MASK)' #1

Open
rao208 opened this issue Sep 21, 2020 · 1 comment

Comments

@rao208
Copy link

rao208 commented Sep 21, 2020

Hello,

I am trying to use your code for the skin leison segmentation and I am getting the following error:

error                                     Traceback (most recent call last)
<ipython-input-19-daaa4cb8cf6e> in <module>
    119         mask[newmask == 255] = 1
    120 
--> 121         dim= cv2.grabCut(img,mask,None,bgdModel,fgdModel,5,cv2.GC_INIT_WITH_MASK)
    122         mask2 = np.where((mask==2)|(mask==0),0,1).astype('uint8')
    123         GrabCut_img = img*mask2[:,:,np.newaxis]

error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\imgproc\src\grabcut.cpp:386: error: (-215:Assertion failed) !bgdSamples.empty() && !fgdSamples.empty() in function 'initGMMs'

The image and code are in the right folder. Do you know why am I getting this error? The Green_Mask and the Inverse_Green_mask for the image are empty, and enhanced_bgr_image looks like this:

ISIC_0024306_AHE

The original image is:

ISIC_0024306

@RupsK
Copy link

RupsK commented Jan 16, 2023

I also have same error.. did you got the answer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants