Ask Your Question

carl82's profile - activity

2018-10-15 04:08:23 -0600 received badge  Popular Question (source)
2016-01-29 05:01:46 -0600 asked a question Facial detection positive sample vector size

After looking at the documentation, papers and tutorials for creating a LBP cascade, I still don't know how the image size of vector file created from positive samples affect the cascade created. Here's the command I'm talking about if it's not clear, and specifically width(-w) and height(-h) values.

opencv_createsamples.exe -info p_samples.info -num 1000 -w 20 -h 20 -vec ps.vec

I've two questions about this.

First one, does cascade detect faces smaller than width and height values defined?

And second one, does increasing the size of the width and height values increase the quality of the cascade created? If yes, is there a point of diminishing returns or one should use largest possible size if training time is not an issue?

2016-01-14 15:10:49 -0600 commented answer opencv mat object thread safety

By the time threads process vector, the vector is essentially read only. Could you tell me why I should clone the mat object? I read it somewhere else too, but from a performance standpoint, shouldn't it be better if I just work with the one in the vector?

2016-01-14 10:06:47 -0600 asked a question opencv mat object thread safety

There is some ambiguity about this issue. Some answers here and at stackoverflow say that mat object has some thread safety, while others say that it's not thread safe. Most of those questions about threading are in write context. As in simultaneously modifying mat object. I'm interested in reading different mat objects from different threads. My code is too complex to post here, so I'll do some overview.

Mat objects(basically images) are stored in a Vector. When vector's size reaches a predefined number, I stop adding to the vector and start processing the vector in different threads. So, first mat object in the vector gets assigned to thread 0 (threads are created with c++11 thread), second to thread 1 and so on. No modification to the vector occurs. This is strictly just reading.

Mat processing function is extremely simple, it's just:

Mat& I = image; //image comes from vector
for (int i = 0; i < I.rows; i++){
for (int t = 0; t < I.cols; t++){
    ColorValue = GetColorVal(I.at<Vec3b>(i, t)[0], I.at<Vec3b>(i, t)[1], I.at<Vec3b>(i, t)[2]);
  //do some other stuff here

The problem is results from GetColorVal function is incomplete. It doesn't matter if I use mutex.locks, or limit thread count to 1, it's always incomplete. I'm not modifying anything at all, just reading. It doesn't process the whole image as far as I can tell. If I disable threading, same code gives correct results.

My plan is to at this point, separate image processing code to a smaller app and use tcp or some other process communication library(like nanomsg) to move and process the images. I plan to run 7-8 of these smaller apps.

But before I do all that work, I wanted to be sure that even in read context, opencv mat, is not thread safe.

2015-12-09 15:39:21 -0600 asked a question opencv python build error

Hello,

I'm trying to build opencv 3 from source(I'm using VS 2013 and compiling for 32bit) so that I can play with feature detection stuff in OPENCV_EXTRA_MODULES with python. My python version is 2.7.5. Everything builds fine except pyopencv_generated. Here's the error log from visual studio. I'm getting vector_Rect2d and boundingBox undeclared identifier errors. VS reports 23 errors in total. All of them can be seen in the screenshot.

image description

Here's the relevant CMAKE screenshot.

image description

Everything else seems to be working OK except this and this is the part that I need unfortunately. Any suggestions? What should I do?

2015-11-19 09:40:54 -0600 received badge  Enthusiast
2015-11-08 08:55:41 -0600 asked a question simple gpu computation

Hello,

I'm processing images like this

image description

Images are very large (8192*8192). I need to do two things with these images.

First: Get all the unique colors into an array.

Second: Get the bounding box dimensions of each unique color.

I've no idea how to do both of these things with gpu. For example, I'm using unordered_set to record unique pixel values in my cpu version. GPU doesn't have something like that I assume, so how do I do that? Any suggestions?

2015-11-07 03:34:09 -0600 commented question converting uchar to int then to string causes crash

LOOOOOOLLLLLL

OMG I'm a retard. I'm thinking what is this guy talking about, rows and cols will always be rows-1 because of for loop. And I just noticed that I'm not using my loop variables i and t. And to think that I lost something like 5 hours to this is just... Anyway thanks a lot. I'll never program anything when sleep deprived. I'll be jumping off the nearest bridge now.

2015-11-07 02:04:36 -0600 commented question converting uchar to int then to string causes crash

I've edited the questions according to your feedback. I'm using the following

int rows = image.rows;
int cols = image.cols;

So I don't think rows and cols could be out of bounds?

2015-11-07 01:57:04 -0600 received badge  Editor (source)
2015-11-07 01:27:00 -0600 asked a question converting uchar to int then to string causes crash

I asked this question at stackoverflow but didn't get an answer.

I'm working with the following: Visual Studio 2013, VS compiler, OpenCV 3

I'm trying to write pixel values of an image in RGB to a file with Opencv. Basically file will be made of values like

R-G-B

125-12-54

4-47-203

There is nothing wrong with the image, display program shows it without any problems. Here's the relevant portion of the code.

  Mat rawData = Mat(1, elementcount, CV_8UC1, UArray);
  image = imdecode(rawData, IMREAD_COLOR);
  int rows = image.rows;
  int cols = image.cols;
   ...
    for (int i = 0; i < rows; i++){
        for (int t = 0; t < cols; t++){
            Vec3b intensity = image.at<Vec3b>(rows, cols);
            ImageValueToString(intensity);

I've tried the following but everytime the program crashes

void ImageValueToString(Vec3b imagevalue){
   int blue = imagevalue.val[0];
   string blue_string = to_string(blue); // Crash

void ImageValueToString(Vec3b imagevalue){
   int blue = static_cast<int>(imagevalue.val[0]);
   string blue_string = to_string(blue); // Crash

void ImageValueToString(Vec3b imagevalue){
   uchar blue = imagevalue.val[0];
   int blue_int = (int)blue;
   string blue_string = to_string(blue_int); // Crash

 void ImageValueToString(Vec3b imagevalue){
   int blue = imagevalue.val[0];
   string s;
   stringstream out;
   out << blue;
   s = out.str(); // crash

The program works if I omit string conversion. This works

 int red = 5;
  string red_string = to_string(red);

But when converted from uchar, int to string conversion doesn't work. I'm baffled. Any suggestions? I must be missing something trival.