imencode returning empty image

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

imencode returning empty image

opencv-users mailing list
Hello all.

In an installation of OpenCV this code is working. But not in another one and I'm wondering what is wrong. In the following code I'm sure that:

- image_ is a 3 channel image, 8 bits per channel.
- image size is 640x480
- cv::imencode is returning true
- At the end (before returning true), output.size() == 0.

 bool CvImage::WriteToJpgString(std::string* output) {
  std::vector<int> params;
  params.push_back(95);
  params.push_back(quality);
  std::vector<unsigned char> out_tmp;
  if (!(".jpg", image_, out_tmp, params)) {
    return false;
  }
  output->assign(out_tmp.begin(), out_tmp.end());
  return true;
}

How can I further debug this? Does it make sense. I'm using Ubuntu 16.04, this happens with versions 3.1 and 3.2 built from sources against png libs (I installed both libjpeg-dev and libjpeg8-dev).

What is very weird is that this code works outside a docker instance but not inside, even when I built in the same way.

Regards,
Nelson.-
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: imencode returning empty image

opencv-users mailing list
Hi Nelson
 

 Need more information here , what version of OpenCV are yo u running ?  have you check ?
 

 Best Advice I give to all those who are involved in OpenCV write out a step by step  check sheet because if you are learning OpenCV it very easy to make a still syntax mistake and when troubling it becomes harder if the lib's version are not matching up with OpenCV version , everything has to link
 

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: imencode returning empty image

opencv-users mailing list
On Wed, Apr 12, 2017 at 2:28 AM, [hidden email] [OpenCV] <
[hidden email]> wrote:

>
>
> Hi Nelson
>
> Need more information here , what version of OpenCV are yo u running ?
> have you check ?
>

Hi, thanks for the answer. I'm getting the same with OpenCV 3.1 and 3.2.


>
> Best Advice I give to all those who are involved in OpenCV write out a
> step by step  check sheet because if you are learning OpenCV it very easy
> to make a still syntax mistake and when troubling it becomes harder if the
> lib's version are not matching up with OpenCV version , everything has to
> link
>

At this time I'm beyond syntax mistakes because the program works in a
machine but it doesn't work in another machine. So this is puzzling to me.

BTW, the program that I'm using is also linked to the Caffe library.

Regards.


>
>
>
>
Loading...