Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Quote:
Hello everyone recently i am trying to detect the shadow from a image by openCV. So in order to do this i am using the BackgroundSubtractorMOG2 class but it gives me error and am using opencv-3.1.0 version. Please help me how to use this class.

C++
Mat image = imread( "Cloud.bmp", 1 );
	Mat back;
		
	Ptr< BackgroundSubtractorMOG2 > bg = createBackgroundSubtractorMOG2( 1, 16, true );
	
	bg->apply( image, back ); //Problem is here!
	imshow( "Shadow", back );


What I have tried:

I am trying to detect the cloud and remove the shadow of cloud
Posted
Updated 19-Jul-16 4:10am
Comments
Mohibur Rashid 19-Jul-16 1:33am    
And the problem is?
Sukerbek 19-Jul-16 3:32am    
program cannot jump here

1 solution

I would guess that your Mat back isnt proper initialized, but as I read it is another problem. For that kind of question you better search and ask in the OpenCV forum.

Here is some example code for Using BackgroundSubtractorMOG2 for images which should help you.
 
Share this answer
 
Comments
Sukerbek 26-Jul-16 1:43am    
thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900