Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Wierd bug - cvTranspose corrupts images.

Hi,

I have been tracking this bug for quite some time now, so any suggestion would be welcome. I use OpenCV as part of the server, which uses OpenCV for image processing. The server is written in Golang and uses our custom binding to OpenCV.

One operation is to rotate images, and it works 99% of time correctly when using the same set of images.

Very very rarely the input image will fail (see attachments). There is nothing special about input images. Actually, the same image would go through rotation without corruption at any other time before suddenly failing.

On the server with 8 instances changing content every minute, it would fail once every few days.

I have written the unit test that repeats rotate and some other operations in multiple threads running in a loop. Test does not seam to catch any corruptions, but it does create heavy CPU and memory load.

Snippet showing how do we use cvTranspose() to implement image rotation. (It is a Go code using C bindings)

I have already posted the same question to slack, and I was given the recommendation to update to v 3.x.x. and use new 'rotate()' function.

I will probably try this, but the reason I post this here again is:

  • My concern is that there is either bug in OpenCV cvTranspose function (unlikely) or that there is the problem with the way we use OpenCV (more likely), and that in that case changing the function won't solve any problem. It is really hard for me right now to confirm that after the change I did solve the problem, because of bugs rare occurrence.
  • as a reference for a possible future bug report

Samples of corrupted images dumpede by 'cvTranspose()'. Images are gray but are actualy in RGBA format.

sample1

sample2

root@1c4b88d5e5b5:~/vss# uname -a

Linux 1c4b88d5e5b5 4.4.0-89-generic #112-Ubuntu SMP Mon Jul 31 19:38:41 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

root@1c4b88d5e5b5:~/vss# cat /etc/issue Ubuntu 16.04 LTS \n \l

root@1c4b88d5e5b5:~/vss# dpkg -l | grep opencv

ii libopencv-core2.4v5:amd64 2.4.9.1+dfsg-1.5ubuntu1 amd64 computer vision core library

ii libopencv-imgproc2.4v5:amd64 2.4.9.1+dfsg-1.5ubuntu1 amd64 computer vision Image Processing library

golang version 1.9.2

$ docker version # servers is running inside docker

Client:

Version: 17.09.0-ce

API version: 1.32

Go version: go1.8.3

Git commit: afdb6d4

Built: Tue Sep 26 22:42:18 2017

OS/Arch: linux/amd64

Server:

Version: 17.09.0-ce

API version: 1.32 (minimum version 1.12)

Go version: go1.8.3

Git commit: afdb6d4

Built: Tue Sep 26 22:40:56 2017

OS/Arch: linux/amd64

Experimental: false

Wierd bug - cvTranspose corrupts images.

Hi,

I have been tracking this bug for quite some time now, so any suggestion would be welcome. I use OpenCV as part of the server, which uses OpenCV for image processing. The server is written in Golang and uses our custom binding to OpenCV.

One operation is to rotate images, and it works 99% of time correctly when using the same set of images.

Very very rarely the input image will fail (see attachments). There is nothing special about input images. Actually, the same image would go through rotation without corruption at any other time before suddenly failing.

On the server with 8 instances changing content every minute, it would fail once every few days.

I have written the unit test that repeats rotate and some other operations in multiple threads running in a loop. Test does not seam to catch any corruptions, but it does create heavy CPU and memory load.

Snippet showing how do we use cvTranspose() to implement image rotation. (It is a Go code using C bindings)

I have already posted the same question to slack, and I was given the recommendation to update to v 3.x.x. and use new 'rotate()' function.

I will probably try this, but the reason I post this here again is:

  • My concern is that there is either bug in OpenCV cvTranspose function (unlikely) or that there is the problem with the way we use OpenCV (more likely), and that in that case changing the function won't solve any problem. It is really hard for me right now to confirm that after the change I did solve the problem, because of bugs rare occurrence.
  • as a reference for a possible future bug report

Samples of corrupted images dumpede by 'cvTranspose()'. Images are gray but are actualy in RGBA format.

sample1

sample2

root@1c4b88d5e5b5:~/vss# uname -a

Linux 1c4b88d5e5b5 4.4.0-89-generic #112-Ubuntu SMP Mon Jul 31 19:38:41 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

root@1c4b88d5e5b5:~/vss# cat /etc/issue Ubuntu 16.04 LTS \n \l

root@1c4b88d5e5b5:~/vss# dpkg -l | grep opencv

ii libopencv-core2.4v5:amd64 2.4.9.1+dfsg-1.5ubuntu1 amd64 computer vision core library

ii libopencv-imgproc2.4v5:amd64 2.4.9.1+dfsg-1.5ubuntu1 amd64 computer vision Image Processing library

golang version 1.9.2

$ docker version # servers is running inside docker

Client:

Version: 17.09.0-ce

API version: 1.32

Go version: go1.8.3

Git commit: afdb6d4

Built: Tue Sep 26 22:42:18 2017

OS/Arch: linux/amd64

Server:

Version: 17.09.0-ce

API version: 1.32 (minimum version 1.12)

Go version: go1.8.3

Git commit: afdb6d4

Built: Tue Sep 26 22:40:56 2017

OS/Arch: linux/amd64

Experimental: false

Wierd bug - cvTranspose corrupts images.

Hi,

I have been tracking this bug for quite some time now, so any suggestion would be welcome. I use OpenCV as part of the server, which uses OpenCV for image processing. The server is written in Golang and uses our custom binding to OpenCV.

One operation is to rotate images, and it works 99% of time correctly when using the same set of images.

Very very rarely the input image will fail (see attachments). There is nothing special about input images. Actually, the same image would go through rotation without corruption at any other time before suddenly failing.

On the server with 8 instances changing content every minute, it would fail once every few days.

I have written the unit test that repeats rotate and some other operations in multiple threads running in a loop. Test does not seam to catch any corruptions, but it does create heavy CPU and memory load.

Snippet showing how do we use cvTranspose() to implement image rotation. (It is a Go code using C bindings)

I have already posted the same question to slack, and I was given the recommendation to update to v 3.x.x. and use new 'rotate()' function.

I will probably try this, but the reason I post this here again is:

  • My concern is that there is either bug in OpenCV cvTranspose function (unlikely) or that there is the problem with the way we use OpenCV (more likely), and that in that case changing the function won't solve any problem. It is really hard for me right now to confirm that after the change I did solve the problem, because of bugs rare occurrence.
  • as a reference for a possible future bug report

Samples of corrupted images dumpede by 'cvTranspose()'. Images are gray but are actualy in RGBA format.

sample1

sample2

root@1c4b88d5e5b5:~/vss# uname -a

Linux 1c4b88d5e5b5 4.4.0-89-generic #112-Ubuntu SMP Mon Jul 31 19:38:41 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

root@1c4b88d5e5b5:~/vss# cat /etc/issue Ubuntu 16.04 LTS \n \l

root@1c4b88d5e5b5:~/vss# dpkg -l | grep opencv

ii libopencv-core2.4v5:amd64 2.4.9.1+dfsg-1.5ubuntu1 amd64 computer vision core library

ii libopencv-imgproc2.4v5:amd64 2.4.9.1+dfsg-1.5ubuntu1 amd64 computer vision Image Processing library

golang version 1.9.2

$ docker version # servers is running inside docker

Client:

Version: 17.09.0-ce

API version: 1.32

Go version: go1.8.3

Git commit: afdb6d4

Built: Tue Sep 26 22:42:18 2017

OS/Arch: linux/amd64

Server:

Version: 17.09.0-ce

API version: 1.32 (minimum version 1.12)

Go version: go1.8.3

Git commit: afdb6d4

Built: Tue Sep 26 22:40:56 2017

OS/Arch: linux/amd64

Experimental: false