Ask Your Question

ttn's profile - activity

2020-09-10 13:38:24 -0600 received badge  Notable Question (source)
2018-01-23 04:57:47 -0600 received badge  Popular Question (source)
2017-08-23 05:52:39 -0600 received badge  Necromancer (source)
2017-08-23 05:44:58 -0600 answered a question Writing jpeg 2000 images with 16 bit

It is fixed.

See https://github.com/opencv/opencv/pull...

sturkmnen reported that in http://answers.opencv.org/question/22...

/Torben.

2017-08-16 05:44:13 -0600 commented answer JPEG 2000 compression for 16 bit images does not work

Thanks sturkmen.

I have tested it in OpenCV 3.2 and verified it is corrected as you wrote.

2017-08-16 05:43:23 -0600 received badge  Scholar (source)
2017-08-16 04:57:27 -0600 commented question ImWrite and ImwriteFlags: JPEG and JPEG2000

Sorry, after testing again, the file size do not change at all when setting JPG quality parameter for a JPG2000 file.

2017-08-16 04:07:20 -0600 asked a question ImWrite and ImwriteFlags: JPEG and JPEG2000

Hi.

In documentation for OpenCV 3.2, I see no option to control JPEG2000 compression like quality (it is only for JPG in range 0..100).

Apparrently the file size decreases for JPG2000 files when using the JPG quality parameters (changing from 100 to 80).

Is quality 100 then lossless, and less than 100 lossy compression for JPG2000?

I need a little description of what compressions parameters to be able to set for JPG2000.

There are also more/new imwrite flags to set for JPG, of which I would like to know a little bit more about.

/Torben

2017-04-04 06:04:37 -0600 received badge  Enthusiast
2017-04-03 02:41:01 -0600 commented question Memory leak reporting preventing upgrade from 2.* to 3.* of OpenCV

Hi mshabunin.

Unfortunately the number of reported memory leaks and the time and sequence memory is allocated in OpenCV depends on the use our of application (which order do the user do different operations).

So trying to suppress wellknown memory allocations is quite difficult; just starting our application and dragging in a file and zooming and paning in an image gives around 80 reported memory leaks.

/Torben.

2017-03-30 04:46:39 -0600 asked a question Memory leak reporting preventing upgrade from 2.* to 3.* of OpenCV

Hi.

I want to upgrade my OpenCV from version 2.4.13 to version 3.2 and have successfully build the new 3.2 version and ported our application too.We are developing mainly on Windows using Visual Studio 2015 and in C++.

Running our application in debug mode now results in a lot of different memory leak reports (I know they are actually not memory leaks, see e.g. link http://stackoverflow.com/questions/32... ).

As this seems not to be changed, how do others manage this? I mean, it is normally nice to discover very quickly in debug mode that you have a memory leak in the code, but this check is now obscured due to the many leaks I get reported from OpenCV allocation (just a simple start of our application with a few task made results in something like 80 different leaks getting reported).

I would very much like to keep Visual Studio reporting not de-allocated memory when closing the application in debug mode, but is there a work-around for that?

Thanks in advance, Torben.

2016-04-18 07:07:34 -0600 received badge  Student (source)
2016-02-08 11:24:45 -0600 commented question Visual Studio 2015 + MFC Office Style + OpenCV 3.1 = Memory Leaks

Hi.

I think the problem is well described in

http://stackoverflow.com/questions/32...

so it is not as such a memory leak. But it makes it practically impossible for us to use OpenCV 3.1 as any memory leak we made have of our own will drown in all those reported (I have about 88 reports for just starting and stoppping the applicartion - some reported in OpenCV itself, some in the Intel TBB). I identified 2-3 of them in OpenCV and found those just to be static heap allocations of memory/objects).

Unfortunately, as seen from https://github.com/Itseez/opencv/issu... the problem will not be fixed.

So we are for now sticking to an older version 2.4.6.1 of OpenCV.

Regards, also Torben.

PS: We are not using MFC.

2013-10-31 02:28:04 -0600 received badge  Editor (source)
2013-10-31 02:26:12 -0600 answered a question JPEG 2000 compression for 16 bit images does not work

My comment to berak is badly formatted, so I post it here again:

Mat image8, image16;
image8 = imread("c:\tmp\test.jpg", CV_LOAD_IMAGE_GRAYSCALE);
image8.convertTo(image16, CV_16UC1, 255);

bool result = imwrite("c:\tmp\test.jp2", image16);

Mat imageNew8, newImage16;
newImage16 = imread("c:\tmp\test.jp2", CV_LOAD_IMAGE_ANYDEPTH|CV_LOAD_IMAGE_ANYCOLOR);
newImage16.convertTo(imageNew8, CV_8UC1, 1.0/255);

results in a totally distorted image (both newImage16 and newImage8, the result variable indicates that the write went well).

The "c:\tmp\test.jp2" is shown in IrfanView as just a black image (can not see the pixel values, but they are checked in the code via newImage16 to be totally wrong in something like half of the picture). That IrfanView can not display the image properly is not a problem for me, I am not sure whether the decoder here is 100% compatible with libjasper.

2013-10-31 02:10:42 -0600 commented question JPEG 2000 compression for 16 bit images does not work

Hi berak,

sorry I did not see your post until now (was just looking in the overview for answers). You are right, the grayscale image is always loaded as an 8 bit image (I didnt realse that until you mentioned it). But it is still not working even if I correct for that:

Mat image8, image16; image8 = imread("c:\tmp\test.jpg", CV_LOAD_IMAGE_GRAYSCALE); image8.convertTo(image16, CV_16UC1, 255);

bool result = imwrite("c:\tmp\test.jp2", image16); Mat newImage16 = imread("c:\tmp\test.jp2", CV_LOAD_IMAGE_ANYDEPTH|CV_LOAD_IMAGE_ANYCOLOR);

Mat imageNew8; newImage16.convertTo(imageNew8, CV_8UC1, 1.0/255);

results in a totally distorted image (both newImage16 and newImage8, the result variable indicates that the write went well).

2013-10-25 03:12:04 -0600 asked a question JPEG 2000 compression for 16 bit images does not work

Hi,

according to the OpenCV documentation, I should be able to save a 16 bit (unsigned) image to a JPEG 2000 image, and then later read it again from the file.

The following code snippet shows the problem (I start by loading a simple 8 bit JPG image as I asume not every body reading this have a 16 bit image available - also I am working on gray level images only):


  Mat image8 = imread("c:\\tmp\\about.jpg", CV_LOAD_IMAGE_GRAYSCALE);
  Mat image16;
  image8.convertTo(image16, CV_16UC1);

  imwrite("c:\\tmp\\test16.jp2", image16);

  Mat newImage16 = imread("c:\\tmp\\test16.jp2", CV_LOAD_IMAGE_GRAYSCALE), imageNew8;
  newImage16.convertTo(imageNew8, CV_8UC1);

  namedWindow("About", 0);
  imshow("About", imageNew8);
  waitKey(0);
  destroyWindow("About");

The same code snippet works if I only use 8 bit JPEG 2000 compression (changing only one line):


  Mat image8 = imread("c:\\tmp\\about.jpg", CV_LOAD_IMAGE_GRAYSCALE);
  Mat image16;
  image8.convertTo(image16, CV_8UC1);

  imwrite("c:\\tmp\\test16.jp2", image16);

  Mat newImage16 = imread("c:\\tmp\\test16.jp2", CV_LOAD_IMAGE_GRAYSCALE), imageNew8;
  newImage16.convertTo(imageNew8, CV_8UC1);

  namedWindow("About", 0);
  imshow("About", imageNew8);
  waitKey(0);
  destroyWindow("About");

I have posted this about a year ago in another forum, using at that time OpenCV 2.3.1 on a 32 bit Window system using Microsoft Visual Studio 2010.

I am now working at a 64 bit Window system using Visual Studio 2012 and made my own build of OpenCV 2.4.6.1 using among other stuff the GPU module (CUDA).

I have the same problem with JPEG2000 again. Am I doing something wrong or is this a bug in OpenCV I should report?

PS: My image is a small one a 640x480 pixels only.

Thansk in advance, Torben.