Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

error: in passing argument 2 of 'bool cv::imencode(const string&, cv::InputArray, std::vector<unsigned char>&, const std::vector<int>&)' #15

Open
ckorn opened this issue Apr 12, 2012 · 5 comments

Comments

@ckorn
Copy link

ckorn commented Apr 12, 2012

Hello,

the compilation fails on Ubuntu 12.04 with this error:
src/movid.cpp: In function 'void web_pipeline_stream_trickle(int, short int, void_)':
src/movid.cpp:271:42: error: invalid initialization of reference of type 'cv::InputArray {aka const cv::InputArray&}' from expression of type 'IplImage {aka _IplImage*}'
/usr/include/opencv2/highgui/highgui.hpp:137:19: error: in passing argument 2 of 'bool cv::imencode(const string&, cv::InputArray, std::vector&, const std::vector&)'

Seems the signature of the imencode function has changed.
It now requires an Input Array as second parameter:
http://opencv.itseez.com/modules/highgui/doc/reading_and_writing_images_and_video.html#imencode

@donpdonp
Copy link
Contributor

I'm seeing this too but I dont know enough C++ to see how to fix it. Ubuntu 12.04

@donpdonp
Copy link
Contributor

This seems to work.

diff --git a/src/movid.cpp b/src/movid.cpp
index 80213dd..6fbc1bd 100644
--- a/src/movid.cpp
+++ b/src/movid.cpp
@@ -228,6 +228,7 @@ static void web_pipeline_stream_trickle(int fd, short events, void *arg) {
    std::vector<uchar>outbuf;
    std::vector<int> params;
    IplImage* img;
+      std::vector<IplImage*> imgs;
    bool convert = false;

    when.tv_usec = state->delay * 1000;
@@ -268,7 +269,8 @@ static void web_pipeline_stream_trickle(int fd, short events, void *arg) {
    // convert the image to JPEG
    params.push_back(CV_IMWRITE_JPEG_QUALITY);
    params.push_back(100);
-   cv::imencode(".jpg", img, outbuf, params);
+      imgs.push_back(img);
+   cv::imencode(".jpg", imgs, outbuf, params);
    outlen = outbuf.size();

    // release temporary image if created

@Giladx
Copy link

Giladx commented Oct 15, 2012

Hey I have the same error with ubuntu 12.04 while I run scons
I try to run this as a command

diff --git a/src/movid.cpp b/src/movid.cpp

and I get an error ...

is this a diff command what is it ? I don't really understand ...

can you please explain me how is this working ?

Thanks

@donpdonp
Copy link
Contributor

Hi Giladx. I committed the diff and created a pull request. Until the request gets approved, you can trying using my fork at https://github.com/donpdonp/Movid

@Giladx
Copy link

Giladx commented Oct 16, 2012

donpdonp thank you for your fast respond and for your good fix.

It is working now :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants