Ask Your Question

pickle27's profile - activity

2017-03-19 15:34:58 -0600 received badge  Nice Question (source)
2016-03-03 01:42:27 -0600 received badge  Famous Question (source)
2015-01-07 10:11:14 -0600 received badge  Notable Question (source)
2014-05-27 11:32:45 -0600 received badge  Popular Question (source)
2013-11-21 22:28:51 -0600 answered a question How to build opencv_world in 2.4.7?

looks like you need the zlib library - I haven't installed it but a good place to start would be to head to their site and follow their instructions. Best of Luck!

2013-08-03 19:54:01 -0600 commented answer Machine learning save/load problem

If you look at the source save and load doesn't seem to be implemented for CvKNearest

2013-08-03 19:40:32 -0600 commented answer How to read/write a PCA object from/to a cv::FileStorage ?

Agreed, otherwise the above posted solution by Mostafa is what I do

2013-08-03 19:39:23 -0600 commented answer FileStorage: can write but can't read Size, Rect, etc.

Yeah I usually do something like this too - however I wonder if this could be done cleanly? The problem is also there for cv::Vec I think, maybe we should open a ticket?

2013-08-03 19:36:02 -0600 received badge  Supporter (source)
2013-08-03 19:35:40 -0600 commented answer How to use retained variance in PCA?

yes I contributed this code and this is correct

2012-12-16 21:16:09 -0600 received badge  Editor (source)
2012-12-16 21:15:22 -0600 commented question cv::FileStorage for custom Types Problem

oops yes that is a copy paste problem

2012-10-29 17:16:56 -0600 asked a question Webcam Select Timeout error on Linux

Hello,

after running standard opencv video capture code for several seconds I receive an error that says: select timeout and the program freezes. I've followed standard build procedures, has anyone else encountered this error before?

Thanks!

2012-10-26 14:00:12 -0600 asked a question Webcam capture freezes after a few seconds in Ubuntu

Hello,

I am having an issue capturing from a webcam using OpenCV, the capture starts and works fine but then freezes after a few seconds. Here is the code I was running:

import cv2

cam = cv2.VideoCapture(0)

while(True):
    flag, image = cam.read()
    cv2.imshow("image", image)
    cv2.waitKey(30)

I have tried on a few different computers and the same problem happens. It also happens when I try and view the webcam using cheese. I must be doing something wrong (is this a v4l issue?), I've followed standard OpenCV build tutorials and I've had this issue since at least 2.4.1.

I'd like to get this issue fixed has anyone else had an issue like this?

2012-09-13 03:03:31 -0600 received badge  Student (source)
2012-09-12 14:59:29 -0600 asked a question OpenCV and Point Grey Grasshopper Issues

Hello,

We're having issues with capturing images from our Point Grey Grasshopper camera. The camera returns images fine but if an image is not captured for a while then the image that gets returns is not the latest image but an image from a while ago in between the last capture and the current time.

Anyone else encountered this?

2012-08-17 15:07:19 -0600 asked a question cv::FileStorage for custom Types Problem

Hello, I am trying to write code allowing me to cleanly use opencv FileStorage with classes I have built - I have done this before with success but this time it is not working and I don't know why, plus the compiler error output is strange.

Here is a code snip that is what I am trying to do:

///////////////////////////////////////////////////////
// .h file

#include <string>
#include <opencv2/core/core.hpp>

namespace alg
{

// Base class for Algorithm Parameters
class Params
{
public:
    virtual ~Params() {}
    float &Threshold() { return m_threshold; }
    virtual void write(cv::FileStorage& fs) const = 0; // write serialization
    virtual void read(const cv::FileNode& node) = 0; // read serialization

protected:
    float m_threshold;
};


// Class for the Parameters of a specific Algorithm
class Alg_Params : public Params
{
public:
    Alg_Params()
    {
        m_threshold = 40;
    }
    ~Alg_Params(){}

    int &Num() { return m_num; }

    void write(cv::FileStorage& fs) const // write serialization
    {
        fs << "{"
           << "Threshold" << m_threshold
           << "Num" << m_num
           << "}";
    }
    void read(const cv::FileNode& node) // read serialization
    {
        m_threshold = (float)node["Threshold"];
        m_num = (int)node["Num"];
    }

private:
    int m_num;
};

} // end Alg namespace


//These write and read functions must exist as per the inline functions in operations.hpp
static void write(cv::FileStorage& fs, const std::string&, Alg_Params& x)
{
  x.write(fs);
}

static void read(const cv::FileNode& node, Alg_Params& x, const Alg_Params& default_value = Alg_Params())
{
  if(node.empty())
    x = default_value;
  else
    x.read(node);
}


///////////////////////////////////////////////////////////
// then in .cpp
// in a class called "Algorithm" for example

Algorithm::Save(std::string file)
{

    cv::FileStorage fs;
    fs.open(file, cv::FileStorage::WRITE);

    fs << "Params" << m_params; // an instance of Alg_Params

    // saving other things afterwards

    fs.release();

}

The only thing that is different from when I have done this before is the use of a base class and the fact that I have the code for the saving and loading in the header. I tried moving the static void write and read to the cpp but I get the same error.

The error I get is: no matching function for call to 'write(cv::FileStorage&, std::sting&, const Alg_Params&)' but the weird part it I also get this warning 'write(cv::FileStorage&, std::sting&, const Alg_Params&)' defined but not used [-Wunsed-function] This doesn't make sense it should see this function way before it needs it.

I am building using Qt Creator on Linux.

Thanks for the help!