Ask Your Question

Ramiro's profile - activity

2020-03-26 19:12:44 -0500 received badge  Notable Question (source)
2017-09-22 03:24:02 -0500 received badge  Popular Question (source)
2016-02-28 10:37:49 -0500 received badge  Student (source)
2013-09-11 12:07:25 -0500 received badge  Scholar (source)
2013-09-10 16:18:50 -0500 commented answer Is cv::imread able to load huge files?
2013-09-10 13:15:28 -0500 commented answer Is cv::imread able to load huge files?

Yes, looks like that's the issue, but I've read some parts of the OpenCV code (both from 2.4 and master branches) and, as far as I can tell, the casts to long are properly made... I think I'll open an issue.

2013-09-09 09:12:08 -0500 received badge  Editor (source)
2013-09-09 09:07:10 -0500 commented answer Is cv::imread able to load huge files?

The machine running the program has 64GB RAM. I'll adjust the post to provide some aditional information about what I'm trying to do and the circunstances.

2013-09-08 13:35:32 -0500 asked a question Is cv::imread able to load huge files?


I'm using cv::imread to read a 10GB PGM file, but I'm getting the following error:

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

The machine running this has 64GB RAM, most of it currently free. The ulimit -a yelds the following output.

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 515986
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 515986
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Here's the program I wrote.

#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
int main(int argc, char* args[])
    if (argc != 2)
        return 1;

    cv::Mat img = cv::imread(args[1], cv::IMREAD_GRAYSCALE);
    if ( == 0)
        return 2;

    std::cout << img.rows << " - " << img.cols;

    return 0;

Is cv::imread unable to load images this size? Is there an alternative in the OpenCV library?

2013-08-30 23:26:37 -0500 received badge  Organizer (source)
2013-08-30 09:18:34 -0500 asked a question opencv_traincascade with millions of negative samples

Has anyone here used the opencv_traincascade application to train a Haar wavelet based cascade of classifiers using tens or hundreds of millions of negative samples? Are there any report in the community about a "serious" usage of that application? If yes, then:

  1. Did you compile the application with any particular set of flags?
  2. Did you implement any significant change in the application yourself?
  3. Did you run it under which OS?
  4. How long it took to produce a single stage?
  5. How much RAM it took?
  6. Any special hardware setup for this?

I understand that it should take a lot of time to finish boosting the classifier and I'm also aware that it should take a lot of memory and processor resources. But throughout the web, there are only a few reports using hundreds or a few thousand samples, while research papers mention they boost classifiers with hundreds of millions or even billions of samples. Is the OpenCV application currently able to handle that?

I'm currently making a trial with it using 3 million negative samples and 4000 positive samples. It has consumed all my RAM (my Linux box has 16GB) and in 36 hours it has not produced a single stage. I'm using the most recent code found in Github and I used the default compilation flags.

I also posted the same question here.

2013-08-22 10:38:25 -0500 commented answer Custom Haar-like features and source code

Good, but there is something also in opencv/modules/objdetect/src. I suppose the code in this folder is about detection, while the above mentioned source file should be used for trainning. Am I right?

2013-08-22 10:34:29 -0500 received badge  Supporter (source)
2013-07-04 17:00:16 -0500 received badge  Critic (source)