// mainFrame()->GroupBoxName->hide();
// Build an instance of detection used to perform image processing operations
- aDetector = new ShapeRec_FeatureDetector();
+ myDetector = new ShapeRec_FeatureDetector();
setHelpFileName( "shape_recognition_page.html" );
//=================================================================================
EntityGUI_FeatureDetectorDlg::~EntityGUI_FeatureDetectorDlg()
{
-
+ delete myDetector;
}
//=================================================================================
return ;
// Setting the image caracteristics
- aDetector->SetPath( theImgFileName );
- height = aDetector->GetImgHeight();
- width = aDetector->GetImgWidth();
+ myDetector->SetPath( theImgFileName );
+ height = myDetector->GetImgHeight();
+ width = myDetector->GetImgWidth();
pictureLeft = -0.5 * width; // X coordinate of the top left corner of the background image in the view
pictureTop = 0.5 * height; // Y coordinate of both top corners
{
myEndPnt = theEndPnt;
MESSAGE("myEndPnt = ("<<theEndPnt.X()<<", "<<theEndPnt.Y()<<")")
- if (setSelectionRect() && aDetector->GetImgHeight() > 0)
+ if (setSelectionRect() && myDetector->GetImgHeight() > 0)
showImageSample();
}
void EntityGUI_FeatureDetectorDlg::showImageSample()
{
// Cropp the image to the selection rectangle given by the user
- aDetector->SetROI( myRect );
- std::string samplePicturePath = aDetector->CroppImage();
+ myDetector->SetROI( myRect );
+ std::string samplePicturePath = myDetector->CroppImage();
// Display the result
QPixmap pixmap(QString(samplePicturePath.c_str()));
subPictureLeft = pictureLeft;
subPictureTop = pictureTop;
}
- aDetector->ComputeCorners( useROI, parameters );
- CvPoint2D32f* corners = aDetector->GetCorners();
- int cornerCount = aDetector->GetCornerCount();
+ myDetector->ComputeCorners( useROI, parameters );
+ CvPoint2D32f* corners = myDetector->GetCorners();
+ int cornerCount = myDetector->GetCornerCount();
int i;
// Build the geom objects associated to the detected corners and returned by execute
{
GEOM::GEOM_ICurvesOperations_var aCurveOperations = myGeomGUI->GetGeomGen()->GetICurvesOperations( getStudyId() );
- aDetector->ComputeContours( useROI, parameters );
- std::vector< std::vector<cv::Point> > contours = aDetector->GetContours();
- std::vector<cv::Vec4i> hierarchy = aDetector->GetContoursHierarchy();
+ myDetector->ComputeContours( useROI, parameters );
+ std::vector< std::vector<cv::Point> > contours = myDetector->GetContours();
+ std::vector<cv::Vec4i> hierarchy = myDetector->GetContoursHierarchy();
std::vector< cv::Point > contour;
int idx = 0;
// else if(myConstructorId ==LINES)
// {
-// aDetector->ComputeLines();
-// std::vector<cv::Vec4i> lines = aDetector->GetLines();
+// myDetector->ComputeLines();
+// std::vector<cv::Vec4i> lines = myDetector->GetLines();
// GEOM::GEOM_Object_var Pnt1;
// GEOM::GEOM_Object_var Pnt2;
// GEOM::GEOM_Object_var aLine;
{
IplImage* src = cvLoadImage(imagePath.c_str(),CV_LOAD_IMAGE_COLOR);
imgHeight = src->height;
- imgWidth = src->width;
+ imgWidth = src->width;
+ cvReleaseImage(&src);
}
}
cvReleaseImage(&sample_h_plane);
cvReleaseImage(&sample_s_plane);
cvReleaseImage(&input_image);
- cvReleaseImage(&input_image);
cvReleaseImage(&input_hsv);
cvReleaseImage(&input_hplane);
cvReleaseImage(&input_splane);
cvSaveImage ("/tmp/cropped_image.bmp", cropped_image);
+ cvReleaseImage(&src);
+ cvReleaseImage(&cropped_image);
+
return "/tmp/cropped_image.bmp";
}