Ask Your Question

edmoney's profile - activity

2014-09-09 14:14:13 -0600 received badge  Student (source)
2014-04-11 09:30:04 -0600 commented question Is OpenCv documentation Open Source.

@StevenPuttemans By reference, you mean post a link in my documentation to theirs or say a quick thank you. Do you think when my bindings get big enough I might really have a shot to add them? They are very well tested, with example code included for each function

2014-04-10 18:42:36 -0600 commented question Can anyone explain the dtype parameter of OpenCV's c++ multiply

@berak Thanks for your reply, I apologize I put in a quick example, hoping for a dtype explanation. The example was just to get the ball rolling...I could just honestly use a tutorial on how to derive the dtype param...lets say I was working with 2 64 bit float Mats or 32S?. Nothing seems to be online for this, It would be great if this could be the first online resource for this ?

2014-04-10 17:08:15 -0600 asked a question Can anyone explain the dtype parameter of OpenCV's c++ multiply

I have 2 matrices with contents as below

a= 

1 2 3 
4 5 6 
7 8 9 

b=

1 2 3 
4 5 6 
7 8 9

when I multiply with dtype parameter as below

Mat a = Mat(3 3 CV_8U data);
Mat b = Mat(3 3 CV_8U data);

multiply(a b dest 1.0 2);

.... I get this as result I was hoping someone could explain this to me as a noob to the multiply function but not matrix multiplication

1 0 4 
16 0 25 
49 0 64
2014-04-10 16:35:06 -0600 received badge  Supporter (source)
2014-04-10 16:35:05 -0600 received badge  Scholar (source)
2014-04-10 15:24:49 -0600 asked a question Is OpenCv documentation Open Source.

I'm making a library of Lisp bindings for OpenCv. In the OpenCv documentation there are C, C++, and Python function names usually listed for each funtion as below

    C++: void convertScaleAbs(InputArray src, OutputArray dst, double alpha=1, double beta=0)

    Python: cv2.convertScaleAbs(src[, dst[, alpha[, beta]]]) → dst

    C: void cvConvertScaleAbs(const CvArr* src, CvArr* dst, double scale=1, double shift=0)

I thought it would be cool, to make my documentation , to copy OpenCv's verbatim, word for word, except take out the C, and Python function headers and add in LisP function headers. I keep C++ to show them side by side, because I'm wrapping the C++ interface. I change all the references to C++ function names and change to the variations in my own library, I add code examples for each one and post in the documentation, I keep the images with the equations on them but convert them(invert them) to black and change all the conditional references ie A == C to Lisp versions..ie (eq A C). Anything in another programming language I change to a Lisp version. All code anything. I wondered is this legal, if I post my documentation this way on a website I create and post links to in my source code..All my software is free and Open source ..I don't charge for it. Any advice on to the legality of this is appreciated.

2014-04-10 00:14:12 -0600 asked a question Need help wrapping OutputArray param in C

There is a class in C++ OpenCV called OutputArray which basically allows you to enter many different types as a parameter, some of the types you can enter are: Mat class, vector, Matexpr class, Scalar to name a few..

I can send over any info on these classes if u want but OutputArray is defined here

http://www.heypasteit.com/clip/19GB

Now normally when we wrap a function like below in C:

void goodFeaturesToTrack(InputArray image, OutputArray corners, int maxCorners, double qualityLevel, double minDistance, InputArray mask=noArray(), int blockSize=3, bool useHarrisDetector=false, double k=0.04 )

...that has an OutputArray param we use a Mat* in its place as below and that usually works but in this case it needs to be able to also accept a vector_Point2f* for corners param , which is a typedef for vector<point2f>, Point2f being a OpenCv class. The OutputArray param would normally let u do that but you can't do that with Mat*

void cv_goodFeaturesToTrack2(Mat* image, Mat* corners, int maxCorners, double qualityLevel, double minDistance, Mat* mask, int blockSize, bool useHarrisDetector, double k) { cv::goodFeaturesToTrack(*image, *corners, maxCorners, qualityLevel, minDistance, *mask, blockSize, useHarrisDetector, k); }

but we would like to be able to call the corners param as a OutputArray* but I since it is a virtual class it won't compile that way, I get

error: cannot declare pointer to ‘cv::OutputArray {aka const class cv::_OutputArray&}’ void cv_goodFeaturesToTrack2(Mat* image, OutputArray* corners, int maxCorners, double qualityLevel, double minDistance, Mat* mask, int blockSize, bool useHarrisDetector, double k) {

My buddy said this to me for specs on what we need "if you find a way to write a method that takes an Input/OutputArray inside of an extern "C" block let me know but it basically you need to magically know the type you got passed or you wind up stack allocating the return value of whatever method you called when you try to push it onto the heap by wrapping it with new, you need to know the actual type otherwise, the value goes out of scope as soon as you return all the way to your target language and you risk memory corruption"

Here is how other C wrappers get called for reference

http://www.heypasteit.com/clip/19GC

Any help on this is GREATLY appreciated:)

2014-04-02 04:46:00 -0600 asked a question i would like to get a camera that i can make turn 360 degrees with opencv code

I was hoping some advanced cv programmer can give me an idea where I can get a usb camera/webcam that i can make turn 360 degrees with OpenCV code. So I can lets say, track an object as it moves around a room. Also would need an idea or link on how to set this up/make this happen. I have Printer Step motors already, if those would be of use. I ask because I'm moving into robotics and using OpenCV for this would be a nice segway.

2014-03-10 20:29:33 -0600 asked a question OpenCV C++ - Need help writing a C wrapper for SVMParams

I'm using these to Arjun Comars autogenerated C wrappers for C++ to create wrappers in another language - they are from this link https://github.com/arjuncomar/opencv but get auto generated when you build Arjun Comars OpenCV pull.

I'm looking through the opencv-generated.cpp file that contains these auto generated wrappers I pasted here online for reference http://www.heypasteit.com/clip/17TF

What I'm trying to do is convert this code to another language and I would need my C wrapper I need to create to facilitate this to be efficient:

   CvSVMParams params;
   params.svm_type    = CvSVM::C_SVC;
   params.kernel_type = CvSVM::LINEAR;
   params.term_crit   = cvTermCriteria(CV_TERMCRIT_ITER, 100, 1e-6);

I had to create this function already to help

  CvSVMParams* cv_create_SVMParams() {
       return new CvSVMParams();
   }

I'm attempting to create another that I can pass the return of the 'cv_create_SVMParams' which would be "params" relevant to the above code, lets call it "self" in this new function, a variable that would hold the value of 'svm_type', 'kernel_type', 'term_crit' or any other possible 'CvSVMParams' parameter lets call it "parameter" and lastly pass a variable that would hold the value of 'CvSVM::C_SVC', 'CvSVM::Linear', 'CvTermCiteria()' or any other possible 'CvSVMParams' parameter value, lets call it "value" so I can write wrapper as such:

    CvSVMParams* cv_CvSVMParams_assign_Param(CvSVMParams* self, 
    Parameter* parameter, Value* value) {
    return *self->*parameter = *value;
    }

and call it as such

 cv_CvSVMParams_assign_Param(params, svm_type, CvSVM::C_SVC);

Is there any way to do something like this..I'm new to OpenCV C++ so if someone could help me write more efficient C Wrappers for it I would be grateful.

2014-03-10 11:10:36 -0600 received badge  Editor (source)
2014-03-10 11:10:09 -0600 asked a question Arjun Comar's OpenCV Auto-generated C wrappers for C++ interface - Could use a little assistance updating them

I'm using these bindings to create wrappers in another language - they are from this link https://github.com/arjuncomar/opencv but get auto generated when you build Arjun Comars OpenCV pull.

I'm looking through the opencv-generated.cpp file that contains these auto generated wrappers I pasted here online for reference http://www.heypasteit.com/clip/17TF

What I'm trying to do is convert this code to another language and I would need my C wrapper I need to create to facilitate this to be efficient:

CvSVMParams params; params.svm_type = CvSVM::C_SVC; params.kernel_type = CvSVM::LINEAR; params.term_crit = cvTermCriteria(CV_TERMCRIT_ITER, 100, 1e-6);

I had to create this function already to help

CvSVMParams* cv_create_SVMParams() { return new CvSVMParams(); }

I'm attempting to create another that I can pass the return of the 'cv_create_SVMParams' which would be "params" relevant to the above code, lets call it "self" in this new function, a variable that would hold the value of 'svm_type', 'kernel_type', 'term_crit' or any other possible 'CvSVMParams' parameter lets call it "parameter" and lastly pass a variable that would hold the value of 'CvSVM::C_SVC', 'CvSVM::Linear', 'CvTermCiteria()' or any other possible 'CvSVMParams' parameter value, lets call it "value" so I can write wrapper as such:

CvSVMParams* cv_CvSVMParams_assign_Param(CvSVMParams* self, Parameter* parameter, Value* value) { return self->parameter = *value; }

and call it as such

cv_CvSVMParams_assign_Param(params, svm_type, CvSVM::C_SVC);

Is there any way to do something like this..I'm new to OpenCV C++ so if someone could help me write more efficient C Wrappers for it I would be grateful.

2014-03-10 11:03:16 -0600 asked a question Did I write this C wrapper for the OpenCV C++ abs function correctly?

Here is my attempt

cpp:

MatExpr* cv_abs(Mat* m) { return new MatExpr(abs(*m)); }

hpp:

MatExpr* cv_abs(Mat* m);

It compiles fine using

g++ -Wall -shared -fPIC -o opencv-glue.so opencv-glue.cpp

I tested in Emacs putting above code above my main and running 'cv_abs(A-B)' inside the main function on my defined Mat objects A and B and did get a couple error messages there but because it compiled fine in terminal(Ubuntu 14.04) I thought I'd check to see if someone could view my code and check for errors. I'm just trying to run the function abs inside the wrapper as above, returning the result as a 'MatExpr'(pointer) because other code I run will use the 'MatExpr' as input. It is supposed to accept a 'Mat' (another pointer) as input as above because in my all of my c wrappers for C++ opencv code 'Mat' is a common return. In the OpenCV documentation for abs() here:

http://docs.opencv.org/modules/core/doc/operations_on_arrays.html?highlight=abs#MatExpr%20abs(const%20Mat&%20m)

It says this

"C = abs(A-B) is equivalent to absdiff(A, B, C)"

so I'm wondering if I should add extra parameters here

'MatExpr* cv_abs(Mat* m)<----'

so I can do this kind of operation plus the other two operations at previous abs Doc. link. I'm writing the C wrapper so I can wrap another language without a C++ FFI around the C. When I attempt to use the wrapper as above wrapped in the 3rd language I'm using I create 2 Mat objects in the 3rd language using Mat wrappers and assign them to variables A and B then when I attempt to run the C wrapper for the C++ abs function, now wrapped in a third language as I do in C++ 'abs(A-B)' it complains that 'A-B' is not a variable because it only recognizes A and B as variables not 'A-B' as C++ recognizes....

If you can help me write the C wrapper knowing this...that I intend to wrap in this 3rd language with these requirements ...that would be great....otherwise or If the 3rd language references are confusing(trying to keep this short) If you can just help me verify the c wrapper above is done right and I can ask the questions pertaining to the 3rd language on that languages FFI mailing list, That would be great as well=)...Thanks.