Click here to Skip to main content
15,888,803 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello everyone. Now days i am working on how to detect the contours from my source data.
So in order to to this i am using openCV library, but when i run the program it gives me error. You can see What i tried in bellow. I do not understand why is this function giving error. Any help would be appreciated.

What I have tried:

C++
void Contour::contourDetection( int nWidth, int nHeight, const QVector< float >& data )
{
 QVector< float > tData = data;
 Mat gray;
 Mat image( nHeight, nWidth, CV_16UC1, tData.data() );
	
 cvtColor( image, gray, CV_BGR2GRAY ); //Error is here ( "There is an unhandled exception." )
 Canny( gray, gray, 100, 200, 3 );
 
 vector< vector< Point > > contours;
 vector< Vec4i > hierarchy;
 RNG rng( 12345 );

 findContours( gray, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point( 0, 0 ) );

}
Posted
Comments
Mohibur Rashid 12-Apr-18 21:10pm    
What error are we talking about?
Patrice T 12-Apr-18 21:37pm    
see comment in code
Sukerbek 12-Apr-18 21:28pm    
I wrote my problem that //Error is here ( "There is an unhandled exception." ) in code any way i have solved by changing
Mat image( nHeight, nWidth, CV_8UC4, const_cast< float* >( tData.data() ) );
but now findContours function is giving ( "There is an unhandled exception." ) error.

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