1-bit TIFF Image reading problem (Patch #2408)


Added by Aashish Kumar over 12 years ago. Updated about 12 years ago.


Status:Done Start date:2012-10-03
Priority:Normal Due date:
Assignee:Evgeny Talanin % Done:

0%

Category:highgui-images
Target version:2.4.3
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

I was unable to read 1-bit TIFF Images(MM type iOS) in openCV while i had no problem in opening the images using irfanview,photoshop and other image viewers.I have attached a sample tiff Image of same type.
I tried to debug the issue in OpenCV 2.2.0(it is present in the latest release too). Following are my observations:
Source Path: OpenCV-2.2.0\modules\highgui\src
File Name: grfmt_tiff.cpp
Line number 172 : "if( (!is_tiled &&
TIFFGetField( tif, TIFFTAG_ROWSPERSTRIP, &tile_height0 )) ||
(is_tiled &&
TIFFGetField( tif, TIFFTAG_TILEWIDTH, &tile_width0 ) &&
TIFFGetField( tif, TIFFTAG_TILELENGTH, &tile_height0 )))"

In Case when images are not tiled the openCV wrapper needs TIFFTAG_ROWSPERSTRIP which is not present in these images headers but i doubt the need to use this TAG as the tile_height will be same as image_height in case of untiled tiff Image. I have done some modification to the grfmt_tiff.cpp which helped me in resolving the problem. I am attaching the modified and unmodified version of the grfmt_tiff.cpp. Please look at the problem and suggest if the fix is a valid one.


Scan.tif - This is the tiff image which openCV is unable to read (82.2 kB) Aashish Kumar, 2012-10-03 09:57 am

grfmt_tiff.cpp - The original file as present in highgui source (16.1 kB) Aashish Kumar, 2012-10-03 09:57 am

grfmt_tiff.cpp - The modified version of the same file (21.1 kB) Aashish Kumar, 2012-10-03 09:57 am


Associated revisions

Revision c00f0faf
Added by Andrey Pavlenko about 11 years ago

Merge pull request #2408 from ilya-lavrenov:tapi_core_opt

History

Updated by Alexander Smorkalov over 12 years ago

Aashish Kumar, could you propose you changes as pull request on github (https://github.com/Itseez/opencv/pulls)?
It helps to integrate your fix faster.

  • Category set to highgui-images
  • Priority changed from High to Normal
  • Assignee set to Vadim Pisarevsky
  • Target version set to 2.4.3

Updated by Aashish Kumar over 12 years ago

Hi Alexander Smorkalov,
I have proposed the changes as pull request.
Thanx

Updated by Vadim Pisarevsky over 12 years ago

  • Target version deleted (2.4.3)
  • Assignee deleted (Vadim Pisarevsky)

Updated by Evgeny Talanin over 12 years ago

  • Assignee set to Evgeny Talanin

Updated by Evgeny Talanin over 12 years ago

Patch from Github Merged in bd4620f0

  • Tracker changed from Bug to Patch
  • Status changed from Open to Done

Updated by Andrey Kamaev about 12 years ago

  • Target version set to 2.4.3

Also available in: Atom PDF