Category: Programming
OpenCV Python Binding Problem
Ubuntu version: 18.04.2Python version: 3.6g++ version: 7.3.0clang version: 6.0.0swig version: 3.0.12OpenCV version: 4.0.0 [C++ code] class Image { private: cv::Mat mat; public: Image() {} }; The following errors occur when importing my module after binding the above code. [Compiled by g++ with Pybind11] Segmentation fault (core dumped) [Compiled by g++ with SWIG] Traceback (most recent …
Angular Fisheye Image Mapping: 3D point ⟹ pixel
// given data Point worldPoint = …; Point worldCameraPosition = …; Point worldAimingPoint = …; // the assumption in this example) // the camera’s up vector = world y-axis Vector upVector = Vector( 0.0, 1.0, 0.0 ); // three orthogonal unit axes of the camera space // xAxis: right vector // yAxis: up vector // …
fftw_execute_dft_c2r()
void fftw_execute_dft_c2r( const fftw_plan p, fftw_complex *in, double *out); This function is one of the new-array execute functions in FFTW 3.3.7. When using this function, be careful that the input array changes. It is a side-effect of the c2r algorithms that they are hard to implement efficiently without overwriting the input.
C++11 Move Constructor
#include <iostream> #include <vector> using namespace std; class A { public: float x; public: A() : x(0.f) { cout<<"Default Constructor"<<endl; } A( const A& a ) : x(a.x) { cout<<"Copy Constructor"<<endl; } A( const A&& a ) : x(a.x) { cout<<"Move Constructor"<<endl; } A( float _x ) : x( _x ) { cout<<"Class Constructor"<<endl; } …
Heap Memory Size for Cuda
#include <iostream> using namespace std; #include <cuda.h> #include <cuda_runtime.h> int main( void ) { cudaError_t stat = cudaSuccess; int devCount = 0; cudaGetDeviceCount( &devCount ); if( !devCount ) { cout << "No Cuda Device." << endl; return 0; } cudaDeviceProp devProp; cudaGetDeviceProperties( &devProp, 0 ); cout << "Global Memory size: " << devProp.totalGlobalMem << " …
황당한 code error
((case1)) class tetgenio { … typedef struct { int *vertexlist; int numberofvertices; } polygon; <strong> typedef struct { polygon *polygonlist; int numberofpolygons; double *holelist; int numberofholes; } facet;</strong> … }; ((case2)) class tetgenio { … typedef struct { int *vertexlist; int numberofvertices; } polygon; <strong> typedef struct { double *holelist; polygon *polygonlist; int numberofpolygons; int numberofholes; } …
libgcc_s.so.1: version `GCC_4.2.0′ not found
gtkgl로 작성한 프로그램 실행시 /usr/autodesk/maya2008-x64/lib/libgcc_s.so.1: version `GCC_4.2.0′ not found (required by /usr/lib64/libstdc++.so.6)와 같은 에러가 발생하였는데, root계정으로 실행할 때에는 정상적으로 실행되는 것으로 보아 특정 파일의 permission 문제인 것으로 생각을 했었지만, LD_LIBRARY_PATH에 /usr/autodesk/maya2008-x64/lib 경로가 잡혀있기 때문에 발생한 문제였다. root계정의 .bashrc에는 저 경로가 LD_LIBRARY_PATH에 설정되어 있지 않았으므로 정상 실행된 것이었다. 파일 실행시마다 매번 root로 계정을 바꿔서 할 수는 …
X11/Intrinsic.h: No such file or directory
Linux에서 Maya plugin을 complile하면 다음과 같은 error가 발생할 때가 있다. /usr/autodesk/maya2008-x64/include/maya/M3dView.h:94:27: error: X11/Intrinsic.h: No such file or directory /usr/autodesk/maya2008-x64/include/maya/M3dView.h:95: error: ‘Widget’ does not name a type /usr/autodesk/maya2008-x64/include/maya/M3dView.h:326: error: ‘MWindow’ does not name a type make: *** [/home/wano/work/maya/FXSilhouette/obj/FXSilhouette.o] Error 1 원인은 libXt package가 설치되어 있지 않은 것이다. Add/Remove Software에 가서 libXt-devel을 검색하여 설치해주면 정상적으로 컴파일이 된다.
error: reference to ‘ssize_t’ is ambiguous
boost python 사용시 (ver.1.3.7) 컴파일하면 다음과 같은 에러가 발생할 수 있다. /usr/include/bits/fcntl.h:227: error: reference to ‘ssize_t’ is ambiguous /usr/include/sys/types.h:110: error: candidates are: typedef __ssize_t ssize_t /usr/local/include/boost-1_37/boost/python/ssize_t.hpp:15: error: typedef Py_ssize_t boost::python::ssize_t /usr/include/bits/fcntl.h:227: error: reference to ‘ssize_t’ is ambiguous /usr/include/sys/types.h:110: error: candidates are: typedef __ssize_t ssize_t /usr/local/include/boost-1_37/boost/python/ssize_t.hpp:15: error: typedef Py_ssize_t boost::python::ssize_t /usr/include/bits/fcntl.h:227: error: ‘ssize_t’ does not name …
Conflicting String problem
자신만의 library에 String이라는 class를 만들게 되면 Windows에서는 괜찮지만 Linux에서는 다음과 같은 error에 직면하게 된다. /usr/include/X11/Intrinsic.h:326: error: reference to ‘String’ is ambiguous. 리눅스 때문에 String이라는 좋은 이름을 두고 FString 등의 이름으로 바꿔야 하나 고민했지만, google이 문제를 해결해주었다. header 파일에 #include <String.h>을 해주기 전에 다음과 같은 처리를 해주면 된다. #define String XString #include <X11/Intrinsic.h> /* include other …
warning C4800
#define LIFESPAN 0x000002 bool hasLifespan( int attrBitMask ) { return ( attrBitMask & LIFESPAN ); } 위와 같은 code가 있다고 했을 때, 다음과 같은 경고(warning)이 발생할 수 있다. warning C4800: ‘int’ : ‘true’ 또는 ‘false’로 bool 값을 강제하고 있습니다(성능 경고). 또는 warning C4800: ‘int’ : forcing value to bool ‘true’ or ‘false’ (performance warning) 다음과 같이 …
OpenCV error due to Complex
OpenCV 2.0 사용시 다음과 같은 compile error가 발생할 수 있다. /usr/include/opencv/cxcore.hpp:266: error: expected unqualified-id before numeric constant 이것은 Complex라는 자료형이 이미 linux에서 사용되고 있기 때문이다. OpenCV의 source code 중 다음 4개 file에 있는 Complex를 cvComplex로 수정해 주면 해결된다. include/opencv/cxoperations.hpp include/opencv/cxcore.hpp src/cxcore/cxdxt.cpp src/cxcore/cxmatmul.cpp 수정한 다음 ./configure make make install 하여 설치해준다. 4개 file을 vi editor에서 수정하는 …