2016-04-01 20 views
0

NDK ve OpenCv Stuff konusunda yeniyim. Bazı yerel C++ kodunu derlemeye çalışıyorum.hata: 'getRotationMatrix2D' bu kapsamda bildirilmedi

Ben yerli maddeleri habersiz olduğum gibi error: 'getRotationMatrix2D' was not declared in this scope

bunun dışında bana yardım edin bazı hatayı alıyorum derleme yaparken.

Teşekkürler.

Inline Ben de aynı gibi diğer pek çok hatayı alıyorum yukarıda belirtilen hatadan dışında .Cpp dosya fonksiyon kodu

void RotateImage(const Mat input, Mat &rotated, float angle) 
{ 
    // create the rotation transformation matrix 
    Point2f img_center(input.cols/2.0F, input.rows/2.0F); 
    Mat rot_mat = getRotationMatrix2D(img_center, angle, 1.0); 

    // transform the image 
    warpAffine(input, rotated, rot_mat, input.size()); 
} 

olduğunu.

Derleme sırasında hata günlüğünde satır içi. Zaten varsa

/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp: In function 'void RotateImage(cv::Mat, cv::Mat&, float)': 
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:10:59: error: 'getRotationMatrix2D' was not declared in this scope 
    Mat rot_mat = getRotationMatrix2D(img_center, angle, 1.0f); 
                 ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:13:50: error: 'warpAffine' was not declared in this scope 
    warpAffine(input, rotated, rot_mat, input.size()); 
               ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp: In function 'void imfill(cv::Mat, cv::Mat&)': 
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:23:77: error: 'findContours' was not declared in this scope 
    findContours(dist_8u, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE); 
                      ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:28:54: error: 'drawContours' was not declared in this scope 
    drawContours(imgDilate, contours, i, 255, CV_FILLED); 
                ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp: In function 'int GetFoldersInDirectory(const string&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)': 
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:58:2: error: 'DIR' was not declared in this scope 
    DIR *dirp; 
^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:58:7: error: 'dirp' was not declared in this scope 
    DIR *dirp; 
    ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:61:38: error: 'opendir' was not declared in this scope 
    if ((dirp = opendir(dir_path.c_str())) == NULL) { 
            ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:66:16: error: 'rewinddir' was not declared in this scope 
    rewinddir(dirp); 
       ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:67:26: error: 'readdir' was not declared in this scope 
    while (dp = readdir(dirp)) 
         ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:69:24: error: invalid use of incomplete type 'struct GetFoldersInDirectory(const string&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)::dirent' 
    sFileName = string(dp->d_name, dp->d_name + strlen(dp->d_name)); 
         ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:59:9: error: forward declaration of 'struct GetFoldersInDirectory(const string&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)::dirent' 
    struct dirent *dp; 
     ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:69:36: error: invalid use of incomplete type 'struct GetFoldersInDirectory(const string&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)::dirent' 
    sFileName = string(dp->d_name, dp->d_name + strlen(dp->d_name)); 
            ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:59:9: error: forward declaration of 'struct GetFoldersInDirectory(const string&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)::dirent' 
    struct dirent *dp; 
     ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:69:56: error: invalid use of incomplete type 'struct GetFoldersInDirectory(const string&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)::dirent' 
    sFileName = string(dp->d_name, dp->d_name + strlen(dp->d_name)); 
                 ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:59:9: error: forward declaration of 'struct GetFoldersInDirectory(const string&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)::dirent' 
    struct dirent *dp; 
     ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:73:6: error: 'DT_DIR' was not declared in this scope 
    if(DT_DIR == dp->d_type) 
    ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:73:18: error: invalid use of incomplete type 'struct GetFoldersInDirectory(const string&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)::dirent' 
    if(DT_DIR == dp->d_type) 
       ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:59:9: error: forward declaration of 'struct GetFoldersInDirectory(const string&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)::dirent' 
    struct dirent *dp; 
     ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:81:22: error: 'closedir' was not declared in this scope 
    (void) closedir(dirp); 
        ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp: In function 'bool GetFilesInDirectory(const string&, const string&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)': 
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:115:2: error: 'DIR' was not declared in this scope 
    DIR *dirp; 
^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:115:7: error: 'dirp' was not declared in this scope 
    DIR *dirp; 
    ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:117:38: error: 'opendir' was not declared in this scope 
    if ((dirp = opendir(dir_path.c_str())) == NULL) { 
            ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:121:16: error: 'rewinddir' was not declared in this scope 
    rewinddir(dirp); 
       ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:122:25: error: 'readdir' was not declared in this scope 
    while(dp = readdir(dirp)) 
         ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:125:30: error: invalid use of incomplete type 'struct GetFilesInDirectory(const string&, const string&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)::dirent' 
     sFileName = string(dp->d_name, dp->d_name + strlen(dp->d_name)); 
          ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:116:9: error: forward declaration of 'struct GetFilesInDirectory(const string&, const string&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)::dirent' 
    struct dirent *dp; 
     ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:125:42: error: invalid use of incomplete type 'struct GetFilesInDirectory(const string&, const string&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)::dirent' 
     sFileName = string(dp->d_name, dp->d_name + strlen(dp->d_name)); 
             ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:116:9: error: forward declaration of 'struct GetFilesInDirectory(const string&, const string&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)::dirent' 
    struct dirent *dp; 
     ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:125:62: error: invalid use of incomplete type 'struct GetFilesInDirectory(const string&, const string&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)::dirent' 
     sFileName = string(dp->d_name, dp->d_name + strlen(dp->d_name)); 
                  ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:116:9: error: forward declaration of 'struct GetFilesInDirectory(const string&, const string&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)::dirent' 
    struct dirent *dp; 
     ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:127:12: error: 'DT_DIR' was not declared in this scope 
     if(DT_DIR == dp->d_type) 
      ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:127:24: error: invalid use of incomplete type 'struct GetFilesInDirectory(const string&, const string&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)::dirent' 
     if(DT_DIR == dp->d_type) 
         ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:116:9: error: forward declaration of 'struct GetFilesInDirectory(const string&, const string&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)::dirent' 
    struct dirent *dp; 
     ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp: In function 'void getRangeFilteredImage(const cv::Mat&, cv::Mat&, int)': 
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:331:14: error: 'getStructuringElement' is not a member of 'cv' 
    Mat strel = cv::getStructuringElement(MORPH_RECT, Size(kernelSize, kernelSize)); 
      ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:331:40: error: 'MORPH_RECT' was not declared in this scope 
    Mat strel = cv::getStructuringElement(MORPH_RECT, Size(kernelSize, kernelSize)); 
             ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:332:43: error: 'dilate' was not declared in this scope 
    dilate(gray, dilateImg, strel, Point(0,0)); 
             ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:333:41: error: 'erode' was not declared in this scope 
    erode(gray, erodeImg, strel, Point(0,0)); 
             ^
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp: In function 'void CallBackFunc(int, int, int, int, void*)': 
/home/vivek/workspace/Test/jni/HairAnalysisUtils.cpp:514:15: error: 'EVENT_LBUTTONDOWN' was not declared in this scope 
    if(event == EVENT_LBUTTONDOWN) 
      ^
make: *** [/home/vivek/workspace/Test/obj/local/armeabi-v7a/objs/ndksetup/HairAnalysisUtils.o] Error 1 

GÜNCELLEME sizin HairAnalysisUtils.cpp yılında

#ifndef _HAIRANALYSISUTILS_H_ 
#define _HAIRANALYSISUTILS_H_ 

#include <include/CoreCommons.h> 
#include <opencv/cv.h> 
#if (defined WIN32 || defined WIN64) 
    #include <time.h> 
    #include <windows.h> 
    #include <winsock.h> 
#else 
    #include <sys/time.h> 
    #include <time.h> 
    #include <unistd.h> 
    #define Sleep(x) usleep((x)*1000); 
#endif 

using namespace cv; 

static int sub_to_ind(int *coords, int *cumprod, int num_dims); 
static void ind_to_sub(int p, int num_dims, const int size[], int *cumprod, int *coords); 
void getLocalEntropyImage(const Mat &gray, Rect &roi, Mat &entropy); 
void getRangeFilteredImage(const Mat &gray, Mat& filterImg, int kernelSize); 
void RotateImage(const Mat input, Mat &rotated, float angle); 
void imfill(const Mat imgThresh, Mat& imgDilate); 
string GetFilenameFromPath(string filepath, bool stripExtension); 
string GetFolderPathFromFilePath(string filepath); 
bool GetFilesInDirectory(const string& dir_path, const string& ext_to_match, vector <string> &files); 
int  GetFoldersInDirectory(const string& dir_path, vector <string> &folders); 
Rect getInscribedRect(const Mat &fiber); 
void ImageAdjust(const Mat1b& src, Mat1b& dst); 
//void EstimateSharpness(const Mat& image,int sharpness);  //added to remove bright edge region 
void CallBackFunc(int event, int x, int y, int flags, void * userdata); 

#endif // _HAIRANALYSISUTILS_H_ 
+1

Kapsamda olmayan bir çok başka şey var ... lütfen başlığınızı açıklamalara ekleyiniz ya da namespace cv'yi kullanarak deneyin ' – ZdaR

+0

Güncellememi kontrol edin ... – AndroidHacker

+0

Sorun çözüldü .. kendi JNI klasör yapısı ve OpenCv dağıtımı. Teşekkürler. – AndroidHacker

cevap

0

sonra sadece "getRotationMatrix2D" içeren * .hpp dosyaları aramak,

#include "opencv2/imgproc.hpp" 

gibi bir satır eklemek Metin. A Beyan, HairAnalysisUtils.cpp modülünde "getRotationMatrix2D" adında bir varlık tanıtır. Bildiriciye bildirilen varlık için Tanımı belirtmezseniz, bu yüzden sonra bir bağlayıcı hatası alabilirsiniz.

İlgili konular