Ask Your Question

iEng's profile - activity

2015-09-16 09:50:06 -0500 asked a question Memory Leak in Mat::copyTo()

I have a vector of images (called images) in OpenCV 3.0.0, which I iterate through in the way shown below. Please disregard, that this code makes no actual sense, I stripped it to point out the problem. Strangely, with each run the memory usage increases, even after the loop has completed. The way I see it, memory should stay the same, since the images in the images-vector are replaced. Manually releasing the matrices does not work either. What can I do to achieve constant memory usage.

for (int i = 0; i < num_images; ++i)
{
    Mat cropped_image;
    images[i].copyTo(cropped_image);
    images[i] = cropped_image;
}
2014-02-10 15:17:38 -0500 asked a question BestOf2NearestMatcher gives different result on second run

When I excecute the folloing code twice with the exact same inputs, I get two different but similar results. Am I doing domething wrong or is this a bug?

BestOf2NearestMatcher matcher(false, 0.3);
vector<MatchesInfo> temp_pairwise_matches = [...];
vector<ImageFeatures> temp_features = [...];
matcher(temp_features, pairwise_matches);
matcher.collectGarbage();

A little more info: I have spend a lot of time isolating the problem to this code. I create two different copies of BestOf2NearestMatcher and all input data is being cloned, so there is definitively no change in the input. The result on the first run is always the same and so is the result on the second and third run, and so on. But none of the results equals one of the previous results.

2013-06-10 04:29:55 -0500 asked a question Compiler error when compiling for iOS

I followed this guide ( http://docs.opencv.org/doc/tutorials/introduction/ios_install/ios_install.html ) exactly but when executing the script it eventually gives me the following error. How can I fix this?

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: /Users/chrisherbon/Downloads/ios/build/iPhoneOS-armv7s/3rdparty/libjpeg/OpenCV.build/Release-iphoneos/libjpeg.build/Objects-normal/armv7s/jmemansi.o (No such file or directory)
    Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool failed with exit code 1


    ** BUILD FAILED **


    The following build commands failed:
        Libtool /Users/chris/Downloads/ios/build/iPhoneOS-armv7s/modules/world/UninstalledProducts/libopencv_world.a normal armv7s
2013-02-14 02:36:14 -0500 answered a question iOS + Stitcher, include/import problem

If you're still having this problem, I have posted a workaround here: http://stackoverflow.com/questions/14127431/strange-unmatched-curly-brace-in-opencv/14870697#14870697

2012-12-19 03:09:36 -0500 received badge  Editor (source)
2012-12-19 03:08:38 -0500 asked a question HSV-Range iOS vs. Mac OS

I have written a short piece of code, that detects regions with a certain hue in an image (12-17 in the range of 0-180). When running the code in iOS it works perfectly fine. When I run the code in Mac OS as a C++ project, the output only constists of pixels where the hue is around 150 in the range of 0-180. How is this possible? Am I missing something? Both projects are using 2.4.3. The only difference would be the way images are loaded into memory. C++ reads the file directly, Objective-C loads it as a UIImage first. But this really should not make a difference, since the original image is displayed correctly.

This is my code:

char* filename = argc >= 2 ? argv[1] : (char*)"/opencvimgs/1.jpg";
Mat img = imread(filename, 1);
cv::imshow("Original", img);

cv::Mat fg;
std::vector<cv::Mat> channels;
cv::Mat hsv;
cv::cvtColor( img, hsv, CV_RGB2HSV );
cv::split(hsv, channels);
cv::inRange(channels[0], 12, 17, channels[0]);
fg=channels[0];
cv::imshow("Foreground", fg);

Edit: I just discovered, that the 12-17 range in iOS roughly, but not exactly, maps to 90+12-90+17 in Mac OS, the range still being 0-180.

2012-12-11 15:35:34 -0500 received badge  Student (source)
2012-11-04 13:27:28 -0500 asked a question Compiler error when using Stitcher under iOS

Whenever I try to use the stitcher class in iOS and I include the stitcher-header ( #include <opencv2/stitching/stitcher.hpp>) I end up with a compile error "Expected '{'" in exposure_compensate.hpp. Apparently the line enum { NO, GAIN, GAIN_BLOCKS }; is causing some sort of error.

I am very new to openCV but using other functions like filter2d() work as expected. How can I resolve this?