Ask Your Question

feelfree's profile - activity

2016-11-23 09:18:16 -0600 received badge  Famous Question (source)
2015-12-06 01:40:36 -0600 received badge  Notable Question (source)
2015-05-04 06:51:15 -0600 received badge  Popular Question (source)
2015-04-11 11:41:15 -0600 received badge  Popular Question (source)
2015-03-06 04:06:01 -0600 received badge  Supporter (source)
2015-03-05 05:57:00 -0600 asked a question build opencv failed for arm64 architecture

I am now building opencv 2.4.8 library for iPhone with xcode 5. When I build the architecture "armv7","armv7s" and "i386" with cmake toolchain, everything is fine. But when I want to build for the architecture of "arm64", I have:

 C++ Compiler:                CMAKE_CXX_COMPILER-NOTFOUND  (ver 5.1.0)

It seems that it cannot find the c++compiler. More detailed error messages are as follows:

-- Setting up iPhoneOS toolchain
-- iPhoneOS toolchain loaded
-- The CXX compiler identification is Clang 5.1.0
-- The C compiler identification is Clang 5.1.0 
CMAKE_LIBRARY_PATH=/lib;/usr/lib
-- Looking for linux/videodev.h
CMake Error at /Applications/CMake 2.8-11.app/Contents/share/cmake-2.8/Modules/CMakeCInformation.cmake:37 (get_filename_component):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  CMakeLists.txt:3 (PROJECT)


CMake Error: Internal CMake error, TryCompile configure of cmake failed

-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
CMake Error at /Applications/CMake 2.8-11.app/Contents/share/cmake-2.8/Modules/CMakeCInformation.cmake:37 (get_filename_component):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  CMakeLists.txt:3 (PROJECT)


CMake Error: Internal CMake error, TryCompile configure of cmake failed

Any ideas? Thanks.

2014-04-23 10:26:01 -0600 asked a question How to perform image class transformation with cv::Mat?

Memory management is essential for an image class. In opencv, the image class is cv::Mat, which has a delicate memory management scheme. Suppose I already have my own image class SelfImage:

class SelfImage
{
  public:
    int width_;
    int height_;
    unsigned char *pPixel_;    
};

At the beginning, I will put all the image pixel contents to this class:

SelfImage myImage;
myImage.width_ = 300;
myImage.height_ = 200;
myImage.pPixel_ = new [300*200];
for(int i=0; i<300*200; i++)
      myImage.pPixel_[i] = i%200;

Then my question is how I can transform this class to cv::Mat in a very efficient way, one solution I have is:

  cv::Mat mat;
    mat.create( myImage.height_, myImage.width_, CV_8UC1);
    mat.data = myImage.pPixel_;

I do not know whether this is a good solution. If cv::Mat::create function will also allocate memory,then the above codes have the danger of memory leak. Any ideas? Thanks.

2014-03-07 04:00:08 -0600 asked a question No architectures to compile error when building the framework for IOS

I am following a opencv installation document Installation in iOS when compile a ios framework. However, if I did not change platform/ios/build_framework.py and build the framework, I will have the following errors:

build settings from command line:
    ARCHS = x86_64
    IPHONEOS_DEPLOYMENT_TARGET = 6.0
    SDKROOT = iphonesimulator6.1

Build Preparation
Build task concurrency set to 8 via user default IDEBuildOperationMaxNumberOfConcurrentCompileTasks

=== BUILD AGGREGATE TARGET ZERO_CHECK OF PROJECT OpenCV WITH CONFIGURATION Release ===
Check dependencies


=== BUILD NATIVE TARGET zlib OF PROJECT OpenCV WITH CONFIGURATION Release ===

=== BUILD NATIVE TARGET libjpeg OF PROJECT OpenCV WITH CONFIGURATION Release ===

** BUILD FAILED **

Build settings from command line:
    ARCHS = x86_64
    IPHONEOS_DEPLOYMENT_TARGET = 6.0
    SDKROOT = iphonesimulator6.1

=== BUILD NATIVE TARGET zlib OF PROJECT OpenCV WITH CONFIGURATION Release ===
Check dependencies
No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386).


** BUILD FAILED **

Then, after many tries, I found that if I only compile for architecture armv7, armv7s and i386 by changing the following scripts in platform/ios/build_framework.py the framework can be built successfully.

targets = ["iPhoneOS", "iPhoneOS", "iPhoneSimulator"] #"iPhoneOS", "iPhoneSimulator"
    archs = ["armv7", "armv7s", "i386"]#"arm64", , "x86_64"
    for i in range(len(targets)):
        build_opencv(srcroot, os.path.join(dstroot, "build"), targets[i], archs[i])

Any ideas on how I can compile for the arm64 and x86_64 architecture? Thanks.

2014-02-27 06:15:20 -0600 asked a question Undefined reference to cv::mulSpectrum only in linux platform

I am now building a library that relies on some functions of opencv, and the way how I use opencv is that I link it statically. The built library, however, is a dynamic one (dll.dll in windows and dll.so in linux for example). After having the library, I have no difficult in building a demo program that uses this dynamic library (.dll) in the windows environment. It just works. However,when it was build on Linux. It is a different story. I can build that dynamic library (dll.so), but when I invoke it in the demo program, I have the following errors:

dll.so||undefined reference to `cv::mulSpectrums(cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, int, bool)'|

dll.so||undefined reference to `cv::getOptimalDFTSize(int)'|

dll.so.so||undefined reference to `cv::dft(cv::_InputArray const&, cv::_OutputArray const&, int, int)'|||=== Build finished: 3 errors, 0 warnings (0 minutes, 4 seconds) ===|

I do not know what I can do in this situation. In fact, I did not call cv::mulSpectrums, cv::getOptimalDFTSize and cv::dft when I built the dynamic library dll.so. Any ideas? Thanks.

2013-10-21 11:14:24 -0600 asked a question How to invoke opencv static library

I have built a static opencv library using cmake, and after that I want to invoke the static opencv library for my application. However, it seems that the application program cannot link the static opencv library, and it gives me the following warnings:

ld: warning: ignoring file /usr/local/lib/libopencv_core.a, file was built for archive which is not the architecture being linked (i386): /usr/local/lib/libopencv_core.a
ld: warning: ignoring file /usr/local/lib/libopencv_highgui.a, file was built for archive which is not the architecture being linked (i386): /usr/local/lib/libopencv_highgui.a
ld: warning: ignoring file /usr/local/lib/libopencv_imgproc.a, file was built for archive which is not the architecture being linked (i386): /usr/local/lib/libopencv_imgproc.a
ld: warning: ignoring file /usr/local/lib/liblibjasper.a, file was built for archive which is not the architecture being linked (i386): /usr/local/lib/liblibjasper.a
ld: warning: ignoring file /usr/local/lib/liblibjpeg.a, file was built for archive which is not the architecture being linked (i386): /usr/local/lib/liblibjpeg.a
ld: warning: ignoring file /usr/local/lib/liblibpng.a, file was built for archive which is not the architecture being linked (i386): /usr/local/lib/liblibpng.a
ld: warning: ignoring file /usr/local/lib/liblibtiff.a, file was built for archive which is not the architecture being linked (i386): /usr/local/lib/liblibtiff.a
ld: warning: ignoring file /usr/local/lib/libzlib.a, file was built for archive which is not the architecture being linked (i386): /usr/local/lib/libzlib.a
ld: warning: ignoring file /usr/local/lib/libIlmImf.a, file was built for archive which is not the architecture being linked (i386): /usr/local/lib/libIlmImf.a

It seems to me that the application program is trying to invoke the dynamic opencv library, and a simple application program that just invokes cv::Mat test will give me the following errors:

Undefined symbols for architecture i386:
  "cv::Mat::deallocate()", referenced from:
      cv::Mat::release() in main.o
  "cv::fastFree(void*)", referenced from:
      cv::Mat::~Mat() in main.o
2012-08-03 02:58:59 -0600 received badge  Scholar (source)
2012-08-03 02:37:57 -0600 commented answer Simple Opencv program with link error on

Thanks, this is the problem. Could you suggest a solution to solve this problem?

2012-08-02 10:55:52 -0600 commented answer Simple Opencv program with link error on

Thanks, but I have already added opencv_highgui242d.lib opencv_core242d.lib in the program.

2012-08-02 10:13:45 -0600 commented answer Simple Opencv program with link error on

Thanks, I looked through the post you suggested, and I am sure that I have done exactly people suggested in the post.

2012-08-02 10:03:57 -0600 commented answer Simple Opencv program with link error on

Thanks, I am now using visual studio 10, and I have put the libraries as well as their path in the searching path. The tricky part is that if I use the c style code, it is successful. I will recognize my question to make it clear.

2012-08-02 09:49:20 -0600 received badge  Editor (source)
2012-08-02 09:48:15 -0600 asked a question Simple Opencv program with link error on

Hi everyone, I am a Opencv Newbie. I have downloaded and installed Opencv 2.4 according to the instruction, and after that I began writing my first Opencv program, which was basically a copy of the tutorial on the web.

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace cv;
using namespace std; 

int main( int argc, char** argv )
{ 
    if( argc != 2) 
    {
     cout <<" Usage: display_image ImageToLoadAndDisplay" << endl;
     return -1;
    }

    Mat image;
    image = imread(argv[1], CV_LOAD_IMAGE_COLOR);   // Read the file

    if(! image.data )                              // Check for invalid input
    {
        cout <<  "Could not open or find the image" << std::endl ;
        return -1;
    }

    namedWindow( "Display window", CV_WINDOW_AUTOSIZE );// Create a window for display.
    imshow( "Display window", image );                   // Show our image inside it.

    waitKey(0);                                          // Wait for a keystroke in the window
    return 0;
}

However, the program has several link errors although compiling seems fine. The link errors I have received are as follows:

Error   2   error LNK2019: unresolved external symbol "void __cdecl cv::namedWindow(class stlp_std::basic_string<char,class stlp_std::char_traits<char>,class stlp_std::allocator<char> > const &,int)" (?namedWindow@cv@@YAXABV?$basic_string@DV?$char_traits@D@stlp_std@@V?$allocator@D@2@@stlp_std@@H@Z) referenced in function _main    C:\Research\OpencvTest\OpencvTest.obj
Error   1   error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class stlp_std::basic_string<char,class stlp_std::char_traits<char>,class stlp_std::allocator<char> > const &,class cv::_InputArray const &)" (?imshow@cv@@YAXABV?$basic_string@DV?$char_traits@D@stlp_std@@V?$allocator@D@2@@stlp_std@@ABV_InputArray@1@@Z) referenced in function _main    C:\Research\OpencvTest\OpencvTest.obj

Could anyone tell me what's wrong with my program? Thanks!

EDIT: A very tricky part of the problem is that if I use old-style Opencv function I will have no problem at all. The following codes can run very well:

int main( int argc, char** argv )
{
    char* filename = "C:\\Research\abc.pgm";  
     IplImage *img0;

    if( (img0 = cvLoadImage(filename,-1)) == 0 )
        return 0;

    cvNamedWindow( "image", 0 );
    cvShowImage( "image", img0 );
    cvWaitKey(0);  
    cvDestroyWindow("image");
    cvReleaseImage(&img0);



    return 0;
}