stphprom
stphprom

Reputation: 49

image.convertTo not always working

I have a little problem and I really don't know why this error comes sometimes.

I use this picture for working: enter image description here

And this is the code at this part:

cv::Mat src = image1;
cv::Mat src2 = image1;

src.convertTo(src,-1,0.15,0);

In this picture are the three cases what happen with the picture, but only the first case would be right. The most case is also the first, the other things don't happen often.

enter image description here

I hope anyone can help me with this. :)

Upvotes: 2

Views: 88

Answers (1)

stphprom
stphprom

Reputation: 49

Ok I found a solution for my problem. When someone else have this problem you can try the following.

I changed my code to this:

cv::Mat src;
cv::Mat src2 = image1;

image1.convertTo(src,-1,0.15,0);

So it works fine without problem. I have no idea why the other method is not working.

Upvotes: 2

Related Questions