diff --git a/.gitignore b/.gitignore index cefd9cd..fff9e63 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,3 @@ - -src_c/homemakefile - [Dd]ebug/ [Rr]elease/ ipch/ @@ -8,5 +5,5 @@ ipch/ *.suo *.exe *.ilk -*.pdb - +*.pdb +build/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e3c0c76 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,39 @@ +# Main CMakeLists file +cmake_minimum_required (VERSION 2.8) + +project (3dptv_solution) + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}") +set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) +# Add definitions and Find TIFF + +if (WIN32) + add_definitions( -D_CONSOLE -D_CRT_SECURE_NO_WARNINGS ) + set(TIFF_LIBRARY "${CMAKE_SOURCE_DIR}/src_c/libtiff.lib") +else() + set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/opt/ActiveTcl-8.6") + set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/usr/lib") + find_package( TIFF REQUIRED ) +endif() + +# Find TCL/TK +find_package( TCL REQUIRED 8.6) + +if (TCLTK_FOUND ) + message(STATUS "TCL INCLUDE: " ${TCL_INCLUDE_PATH}) + message(STATUS "TCL LIB: " ${TCL_LIBRARY}) + message(STATUS "TK INCLUDE: " ${TCL_INCLUDE_PATH}) + message(STATUS "TK LIB: " ${TK_LIBRARY}) + link_directories( ${TCL_LIBRARY} ${TK_LIBRARY} ) + include_directories( ${TCL_INCLUDE_PATH} ${TK_INCLUDE_PATH} ) +endif() + +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd") + +message(STATUS "gathering ptv tcl files:") +file(GLOB ptv_tcl "${CMAKE_SOURCE_DIR}/src_tcl/*.tcl") + +add_subdirectory("${CMAKE_SOURCE_DIR}/src_c") diff --git a/INSTALL.rst b/INSTALL.rst deleted file mode 100644 index 5ec84a6..0000000 --- a/INSTALL.rst +++ /dev/null @@ -1,49 +0,0 @@ -Prerequisities ---------------- - -1. Download and install ActiveTCL 8.4 ( not 8.5 or 8.6) e.g. -http://downloads.activestate.com/ActiveTcl/releases/8.4.19.6/ActiveTcl8.4.19.6.295590-win32-ix86-threaded.exe - - - Install it to ``C:\Tcl`` (the path is important) - - - -Download the pre-compiled binary for Windows 32- or 64-bit platform ---------------------- - - -1. If you use 32bit or 64 bit Windows platform you can use the binary distributions: - - 1. download the executable file from: https://github.com/3dptv/3dptv/downloads (Tcl/Tk 8.4 has to be installed), save it as ``C:\PTV\3dptv.exe`` - 2. download the test folder https://github.com/downloads/3dptv/3dptv/test.zip, extract it to ``C:\PTV\test`` and test the software by running the ``C:\PTV\test\start.bat`` - -2. If you use another platform or you want to compile from the source, download the latest snapshot: -https://github.com/3dptv/3dptv/zipball/master - - -Compilation instructions from source on Windows platform ------------- - -1. If you want to compile from the source code on Windows, you recommend downloading the Visual C++ 2010 Express http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express - - Important note for the first-time installation - RESTART YOUR WINDOWS after installing the ActiveTcl and Visual C++ - -2. Double-click the ``3dptv_vc2010.sln`` to open the 3DPTV package in Visual C++ 2010 Express. - -3. If all the paths are the same as ours, Build the solution and you should see the 3DPTV software up and running - -If you use different paths it is important to: - a. add ``\Tcl\Include`` to the list of included directories - b. add ``\Tcl\tcl84.lib`` and ``\Tcl\tk84.lib`` to the additional libraries - c. on Windows XP it is important to ignore ``LIBC.LIB`` and also to use ``MFC as Static Library`` - - - -Compilation from source on _nix platforms ------------------------------------------ - -1. Read https://github.com/3dptv/3dptv/blob/master/install_nix.md - - - - diff --git a/README b/README deleted file mode 100644 index 1dece95..0000000 --- a/README +++ /dev/null @@ -1,15 +0,0 @@ -If you want to use the source code and contribute to the project: ------------------------------------------------------------------ - -1) Fork this repository to your account, using the Fork button -2) create branch or fix the master branch if you feel confident enough -3) send us the pull request when you feel like ready to submit your branch or your master into the community branch - - -Installation instructions: ---------------------------- - -https://github.com/3dptv/3dptv/blob/master/INSTALL.rst - - - diff --git a/README.md b/README.md new file mode 100644 index 0000000..e1d477c --- /dev/null +++ b/README.md @@ -0,0 +1,67 @@ +## If you want to use the source code and contribute to the project: + +1. Fork this repository to your account, using the Fork button +2. create branch or fix the master branch if you feel confident enough +3. send us the pull request when you feel like ready to submit your branch or your master into the community branch + + + +## Multi-platform build using CMake + +1. Download and install CMake (version 2.8 or higher) + + http://www.cmake.org/cmake/resources/software.html + +2. Download and install ActiveTCL 8.6 for the desired platform + + http://www.activestate.com/activetcl/downloads + +3. Download and install libtiff (*nix and OSX systems) + + -- on Ubuntu run the following in a terminal: + + sudo apt-get install build-essential + sudo apt-get install libtiff-dev + + -- on Mac OS X is recommended to install libtiff using Homebrew: + + brew install libtiff + +4. Create a build directory inside the main 3dptv directory (```3dptv/build```) + + +5. Run CMake and generate the project or make files + + a. start the ```cmake-gui``` from the desktop shortcut or program list + + -- alternatively run the following from command line + + cd 3dptv/build + cmake-gui ../ + + b. browse for the source directory: ```3dptv/``` + + c. browse for the build directory just created: ```3dptv/build/``` + + d. click ```configure``` and select the build type and compiler + + --on Mac OS X choose the following options: UNIX makefiles, native compilers + + --on Windows choose Visual Studio 2010 or 2008 (32-bit supported currently) + + --on *nix systems choose Unix make files or alternatively use Eclipse CTD and unix make files + + Note: if an error occurs saying that libtiff or ActiveTCL cannot be found + click on the entry in the "value" column and browse for the libraries' "include" directories and ".lib" files + click ```configure``` again to locate the libraries. If any rows appear red, click configure until no rows are highlighted. + + e. click generate to create the project or make files + +6. Run Visual Studio and open the solution file in ```3dptv/build/``` or run make from within the build directory to compile the code. + + --The executable will be generated and placed inside ```3dptv/build/bin/``` + +7. Run the software from the ```test``` folder with a link to ```ptv.tcl``` as an input: + + cd 3dptv/test + ../build/bin/3dptv ../ptv.tcl diff --git a/install_nix.md b/install_nix.md deleted file mode 100644 index c924d7a..0000000 --- a/install_nix.md +++ /dev/null @@ -1,125 +0,0 @@ -Installation and Handling of the PTV-Software -============================================= - -The ptvmanual.pdf contains information to use the -software and gives a description of the input data -file which have to be provided. - - -The test data set contains the following: -
-
-Cam1*                   Cam3.addpar*            man_ori.dat*
-Cam1.addpar*            Cam3.ori*               parameters/
-Cam1.ori*               Cam4*                   ptvmanual.pdf*
-Cam2*                   Cam4.addpar*            res/
-Cam2.addpar*            Cam4.ori*               start.bat*
-Cam2.ori*               calFieldApril.txt*
-Cam3*                   img/
-
-
- -images for calibration, camera orientation data, files for -additional parameters as well as the coordinate file of the -points on the reference. -In man_ori.dat the manually measured image coordinates for -the pre-orientation (for calibration purpose) are stored. - -* subdirectory ```/img``` contains the image sequences -* subdirectory ```/res``` for storage of results -& subdirectory ```/parameters``` contains the parameter files - -The data mentioned above are the data for the experiment itself. -To avoid confusion this data should be kept separated to the -software data! - -The software for PTV is stored under /tk84ptv. -To start the software >> click double on start.bat, which establishes -the link to the software. Project and software data should not be -confused. To start the software it is sufficient that a start.bat-file, -thus the software (and code) can be stored independently. - - -Tcl/Tk-Installation -------------------- - -The install executable for Tcl/Tk is ActiceTcl8.4.2-win32-ix86.exe -in this directory. Or can be downloaded from a webpage. - -Download under http://downloads.activestate.com/ActiveTcl/Windows/8.4.2/ - -After installing Tcl/Tk 8.4.2 all files with extension *.tcl should -appear with the Tcl/Tk-symbol (feather). Otherwise repeat installation. -Make sure that the flag for the extensions (*.tcl) is included in the -path. Otherwise not all needed dll-files can be found from arbitrary -directories on the PC. - - -Compilation of the source code of PTV --------------------------------------- - -In the /tk84ptv directory You will find the following data: -
-index		script to generate tclIndex (/ might be missing in the generated tclIndex!)
-ptv.tcl		main script to start graphical user interface (Windows)
-ptvunix.tcl	dito for Unix
-start		start file for Unix
-tclIndex	Index with relative paths to Tcl functions
-/src_c		source code directory
-/src_tcl	tcl script directory
-
- -The contents of the /src_c:: - -
-change_parameter.c*     jw_main.c*              segmentation.c*
-checkpoints.c*          jw_ptv.c*               sortgrid.c*
-correspondences.c*      libtiff.lib*            testvrml.c*
-demo.c*                 lsqadj.c*               tiff.h*
-draw.c*                 mousefunction.c*        tiffio.h*
-epi.c*                  multimed.c*             tiffvers.h*
-globals.h*              orientation.c*          tools.c*
-homemakefile*           peakfitting.c*          track.c*
-homemakefile.mak*       pointpos.c*             trafo.c*
-image_processing.c*     ptv.c*                  ttools.c*
-imgcoord.c*             ptv.h*                  typedefs.h*
-intersect.c*            ray_tracing.c*          unixmakefile*
-jw_ImgFmtTIF.c*         rotation.c*             vrml.c*
-
- -The contents of the /src_tcl:: - -
-button.tcl*     display.tcl*    mainpar.tcl
-calpar.tcl*     draw.tcl*       trackpar.tcl*
-
- -The source code is written in C in combination with Tcl/Tk. -The directory ```/src_c``` contains some old makefile (```homemakefile.mak```) - -Notice: The paths to the libs in the makefile have to be adjusted:: - -``` -INC_DIR1 = C:\Tcl\include\ - -TCL_LIB = C:\Tcl\lib\tcl84.lib -TK_LIB = C:\Tcl\lib\tk84.lib -TIFF_LIB = H:\tk84ptv\src_c\libtiff.lib -``` -For compilation in the DOS-prompt first perform vcvars32.bat for -initalization, after that nmake -f homemakefile.mak - - -IMPORTANT! ----------- - -Before running the software some paths have to be set. -In start.bat, may contain: -``` -C:/PTV/3dptv.exe C:/PTV/ptv.tcl -``` - -has to be modified to the actual position on the PC. -First the path to the jw_prog.exe followed by the -path to the ```ptv.tcl``` script file. - diff --git a/src_c/CMakeLists.txt b/src_c/CMakeLists.txt new file mode 100644 index 0000000..3f0df59 --- /dev/null +++ b/src_c/CMakeLists.txt @@ -0,0 +1,69 @@ +# This is the 3dptv/src_c CMakeLists.txt file + +message(STATUS "gathering ptv project files from 3dptv/src_c/:") + +set(TARGET_NAME "3dptv") + +# gather the header files + +file ( GLOB ptv_hdrs +globals.h +ptv.h +tcl.h +tiff.h +tiffio.h +tiffvers.h +tk.h +typedefs.h +) + +# gather the source files + +file ( GLOB ptv_srcs +change_parameter.c +checkpoints.c +correspondences.c +demo.c +draw.c +epi.c +image_processing.c +imgcoord.c +intersect.c +jw_ImgFmtTIF.c +jw_main.c +jw_ptv.c +lsqadj.c +mousefunction.c +multimed.c +orientation.c +peakfitting.c +pointpos.c +ptv.c +ray_tracing.c +resource1.h +resource2.h +rotation.c +segmentation.c +sortgrid.c +tools.c +track.c +trafo.c +ttools.c +vrml.c +) + +# organize the files into folders inside the project + +source_group("Header Files" FILES ${ptv_hdrs}) +source_group("Source Files" FILES ${ptv_srcs}) +source_group("Tcl Files" FILES ${ptv_tcl}) + +add_executable(${TARGET_NAME} ${ptv_srcs} ${ptv_hdrs} ${ptv_tcl} ) + +if(WIN32) + set_target_properties(${TARGET_NAME} PROPERTIES LINKER_LANGUAGE C) + set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:libc") +endif() + +set(EXTRA_LIBS ${EXTRA_LIBS} ${TCL_LIBRARY} ${TK_LIBRARY} ${TIFF_LIBRARY}) +target_link_libraries(${TARGET_NAME} ${EXTRA_LIBS} ) \ No newline at end of file diff --git a/src_c/globals.h b/src_c/globals.h index 91e15e0..1b682be 100644 --- a/src_c/globals.h +++ b/src_c/globals.h @@ -252,7 +252,7 @@ void sortgrid_file (Tcl_Interp* interp, Exterior Ex, Interior I, Glass G, ap_52 // --- tools.c --- void write_ori (Exterior Ex, Interior I, Glass G, char filename[64]); int read_ori (Exterior *Ex, Interior *I, Glass *G, char filename[64]); -FILE *fopen_r (CHAR filename[256]); +FILE *fopen_r (char filename[256]); FILE *fopen_rp (char *filename); int read_image (Tcl_Interp* interp, char path[128], unsigned char *img); int write_tiff (const char path[256], unsigned char *data, int nx, int ny); diff --git a/src_c/jw_ImgFmtTIF.c b/src_c/jw_ImgFmtTIF.c index ba3a7f5..6da724e 100644 --- a/src_c/jw_ImgFmtTIF.c +++ b/src_c/jw_ImgFmtTIF.c @@ -321,7 +321,7 @@ int FileReadTIF(Tcl_Interp *interp, printf("\nFileReadTIF: block.pixelSize = %d", block.pixelSize); printf("\nFileReadTIF: scanline size = %d", TIFFScanlineSize(tif)); */ - Tk_PhotoExpand(imageHandle, destX + width, destY + height); + Tk_PhotoExpand(interp,imageHandle, destX + width, destY + height); /* if (srcY > 0) { @@ -365,7 +365,7 @@ int FileReadTIF(Tcl_Interp *interp, } block.height = nLines; - Tk_PhotoPutBlock(imageHandle, &block, destX, destY, width, nLines, TK_PHOTO_COMPOSITE_SET); + Tk_PhotoPutBlock(interp,imageHandle, &block, destX, destY, width, nLines, TK_PHOTO_COMPOSITE_SET); destY += nLines; } diff --git a/src_c/tools.c b/src_c/tools.c index c5f02e3..1838dfe 100644 --- a/src_c/tools.c +++ b/src_c/tools.c @@ -66,7 +66,7 @@ FILE *fopen_rp (char *filename) return (fp); } -FILE *fopen_r (CHAR filename[256]) +FILE *fopen_r (char filename[256]) /* tries to open a file; gives a message, if it cannot open it and waits until it has been created */