rnc: made picture import in GEOM independent from OpenCV

This commit is contained in:
gdd 2011-11-24 14:37:07 +00:00
parent 1ac1be4afb
commit 4afdc688fc
6 changed files with 26 additions and 21 deletions

View File

@ -100,10 +100,10 @@ bool EntityGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
case GEOMOp::OpFeatureDetect: // FEATURE DETECTION
aDlg = new EntityGUI_FeatureDetectorDlg( getGeometryGUI(), parent );
break;
#endif
case GEOMOp::OpPictureImport: // IMPORT PICTURE IN VIEWER
aDlg = new EntityGUI_PictureImportDlg( getGeometryGUI(), parent );
break;
#endif
default:
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
break;

View File

@ -39,8 +39,7 @@
#include <TopoDS.hxx>
#include <GEOMImpl_Types.hxx>
#include <ShapeRec_FeatureDetector.hxx>
// #include <ShapeRec_FeatureDetector.hxx>
#include <QFileDialog>
@ -55,11 +54,8 @@ EntityGUI_PictureImportDlg::EntityGUI_PictureImportDlg( GeometryGUI* theGeometry
bool modal, Qt::WindowFlags fl )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{
// QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_LINE_2P" ) ) );
setWindowTitle( tr( "GEOM_IMPORT_PICT_TITLE" ) );
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_PICTURE" ) );
// mainFrame()->RadioButton1->setIcon( image0 );
// mainFrame()->RadioButton2->setIcon( image2 );
mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton2->close();
@ -182,12 +178,9 @@ bool EntityGUI_PictureImportDlg::execute( ObjectList& objects )
if ( theImgFileName.isEmpty() )
return res;
ShapeRec_FeatureDetector* aDetector = new ShapeRec_FeatureDetector();
aDetector->SetPath( theImgFileName.toStdString() );
int height = aDetector->GetImgHeight();
int width = aDetector->GetImgWidth();
QPixmap* pixmap = new QPixmap(theImgFileName);
int height = pixmap->height();
int width = pixmap->width();
GEOM::GEOM_Object_var P1 = aBasicOperations->MakePointXYZ( -0.5*width, -0.5*height, 0 );
GEOM::GEOM_Object_var P2 = aBasicOperations->MakePointXYZ( -0.5*width, 0.5*height, 0 );

View File

@ -28,15 +28,16 @@ if WITH_OPENCV
FeatureDetectorDlg_Header = EntityGUI_FeatureDetectorDlg.h
FeatureDetectorDlg_Sources = EntityGUI_FeatureDetectorDlg.cxx
FeatureDetectorDlg_moc = EntityGUI_FeatureDetectorDlg_moc.cxx
PictureImportDlg_Header = EntityGUI_PictureImportDlg.h
PictureImportDlg_Sources = EntityGUI_PictureImportDlg.cxx
PictureImportDlg_moc = EntityGUI_PictureImportDlg_moc.cxx
Opencv_libs = $(OPENCV_LIBS)
Opencv_includes = $(OPENCV_INCLUDES)
ShapeRec_dir = $(srcdir)/../ShapeRecognition
ShapeRec_la = ../ShapeRecognition/libGEOMShapeRec.la
endif
PictureImportDlg_Header = EntityGUI_PictureImportDlg.h
PictureImportDlg_Sources = EntityGUI_PictureImportDlg.cxx
PictureImportDlg_moc = EntityGUI_PictureImportDlg_moc.cxx
# Libraries targets
lib_LTLIBRARIES = libEntityGUI.la

View File

@ -4596,7 +4596,12 @@ Number of sketch points too small</translation>
</message>
<message>
<source>GEOM_DETECT_ZONE</source>
<translation>Select a detection zone (default is whole picture)</translation>
<translation>Select a detection zone
(default is whole picture)</translation>
</message>
<message>
<source>GEOM_DETECT_OUTPUT</source>
<translation>Output type</translation>
</message>
<message>
<source>GEOM_PICTURE</source>
@ -4629,6 +4634,10 @@ Number of sketch points too small</translation>
<source>GEOM_PICTURE</source>
<translation>Picture</translation>
</message>
<message>
<source>GEOM_FILE</source>
<translation>File name</translation>
</message>
<message>
<source>GEOM_IMPORT_PICT_TITLE</source>
<translation>Import picture in viewer</translation>

View File

@ -463,8 +463,8 @@ void GeometryGUI::OnGUIEvent( int id )
case GEOMOp::OpExplode: // MENU ENTITY - EXPLODE
#ifdef WITH_OPENCV
case GEOMOp::OpFeatureDetect: // MENU ENTITY - FEATURE DETECTION
case GEOMOp::OpPictureImport: // MENU ENTITY - IMPORT PICTURE IN VIEWER
#endif
case GEOMOp::OpPictureImport: // MENU ENTITY - IMPORT PICTURE IN VIEWER
libName = "EntityGUI";
break;
case GEOMOp::OpEdge: // MENU BUILD - EDGE
@ -726,8 +726,8 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::OpExplode, "EXPLODE" );
#ifdef WITH_OPENCV
createGeomAction( GEOMOp::OpFeatureDetect,"FEATURE_DETECTION" );
createGeomAction( GEOMOp::OpPictureImport,"PICTURE_IMPORT" );
#endif
createGeomAction( GEOMOp::OpPictureImport,"PICTURE_IMPORT" );
createGeomAction( GEOMOp::OpEdge, "EDGE" );
createGeomAction( GEOMOp::OpWire, "WIRE" );
@ -926,8 +926,8 @@ void GeometryGUI::initialize( CAM_Application* app )
createMenu( separator(), newEntId, -1 );
#ifdef WITH_OPENCV
createMenu( GEOMOp::OpPictureImport, newEntId, -1 );
#ifdef WITH_OPENCV
createMenu( GEOMOp::OpFeatureDetect, newEntId, -1 );
#endif
@ -1097,9 +1097,10 @@ void GeometryGUI::initialize( CAM_Application* app )
createTool( separator(), operTbId );
#ifdef WITH_OPENCV
createTool( GEOMOp::OpFeatureDetect, operTbId );
#endif
createTool( GEOMOp::OpPictureImport, operTbId );
createTool( separator(), operTbId );
#endif
createTool( GEOMOp::OpPartition, operTbId );
createTool( GEOMOp::OpArchimede, operTbId );
createTool( GEOMOp::OpShapesOnShape, operTbId );

View File

@ -96,8 +96,9 @@ namespace GEOMOp {
OpExplode = 3302, // MENU NEW ENTITY - EXPLODE
#ifdef WITH_OPENCV
OpFeatureDetect = 3303, // MENU NEW ENTITY - FEATURE DETECTION
OpPictureImport = 3304, // MENU NEW ENTITY - IMPORT PICTURE IN VIEWER
#endif
OpPictureImport = 3304, // MENU NEW ENTITY - IMPORT PICTURE IN VIEWER
// BuildGUI ------------------//--------------------------------
OpEdge = 3400, // MENU NEW ENTITY - BUILD - EDGE
OpWire = 3401, // MENU NEW ENTITY - BUILD - WIRE