Return-Path: <tiff-bounces@lists.maptools.org>
X-Original-To: info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-i.b-one.net (mx-i.one.com [91.198.169.56])
	by mail9.b-one.net (Postfix) with ESMTP id 30C6440080A
	for <info@awaresystems.be>; Tue,  9 Feb 2010 09:02:27 +0100 (CET)
Received: by mx-i.b-one.net (Postfix, from userid 106)
	id 25BA73B48; Tue,  9 Feb 2010 09:02:27 +0100 (CET)
X-Virus-Scanned: by one.com
X-Spam-Score: 0
X-Spam-Level: 
X-Spam-Status: No, score=0 tagged_above=0 required=4 tests=[none]
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4
Received: from lists.maptools.org (lists.maptools.org [65.39.174.144]) by
 mx-i.b-one.net (Postfix) with ESMTP id 517B9DABF for <info@awaresystems.be>;
 Tue,  9 Feb 2010 09:02:26 +0100 (CET)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by
 lists.maptools.org (Postfix) with ESMTP id AAF4D1CEFB028; Tue,  9 Feb 2010
 03:01:33 -0500 (EST)
Received: from mailout03.vodafone.com (mailout03.vodafone.com
 [195.232.224.72]) by lists.maptools.org (Postfix) with ESMTPS id
 E4C3E1D194008 for <tiff@lists.maptools.org>; Tue,  9 Feb 2010 02:58:36 -0500
 (EST)
Received: from mailint03 (localhost [127.0.0.1]) by mailout03 (Postfix) with
 ESMTP id C2C1F1166FC for <tiff@lists.maptools.org>; Tue,  9 Feb 2010 08:58:33
 +0100 (CET)
Received: from avoexs04.internal.vodafone.com (avoexs04.dc-ratingen.de
 [145.230.4.198]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client
 certificate requested) by mailint03 (Postfix) with ESMTPS id B4DD8116438 for
 <tiff@lists.maptools.org>; Tue,  9 Feb 2010 08:58:33 +0100 (CET)
Received: from VF-MBX30.internal.vodafone.com ([145.230.6.234]) by
 avoexs04.internal.vodafone.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 9
 Feb 2010 08:58:34 +0100
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Date: Tue, 9 Feb 2010 08:58:30 +0100
Message-ID:
 <043A2251497417458673CD21741F2F84064CFF@VF-MBX30.internal.vodafone.com>
In-Reply-To: <53B7FCEF-2339-43D5-8623-4BA87C788119@larrygritz.com>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: [Tiff] OpenImageIO; was Re: fftw and TIFF files
Thread-Index: Acqo5n0OW+kprvyqSVqMA3LJPq5o2AAdlKOw
References: <mailman.104.1265647725.647.tiff@lists.maptools.org>
 <53B7FCEF-2339-43D5-8623-4BA87C788119@larrygritz.com>
From: "Gil, Debora, VF-ES (dgilalv) STU" <debora.gil@vodafone.com>
To: <tiff@lists.maptools.org>
X-OriginalArrivalTime: 09 Feb 2010 07:58:34.0896 (UTC)
 FILETIME=[ADF3A900:01CAA95D]
Subject: Re: [Tiff] OpenImageIO; was Re: fftw and TIFF files
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
 <mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
 <mailto:tiff-request@lists.maptools.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org


Hi,

This OpenImageIO Project looks really good. I think I'll give it a try
because I'm using C++. I'll let you know about the results.

Thanks and best regards,
Debora

-----Mensaje original-----
De: tiff-bounces@lists.maptools.org
[mailto:tiff-bounces@lists.maptools.org] En nombre de Larry Gritz
Enviado el: lunes, 08 de febrero de 2010 18:43
Para: tiff@lists.maptools.org
Asunto: [Tiff] OpenImageIO; was Re: fftw and TIFF files

I'll take this opportunity to point people to another open source
project I'm administering: http://www.openimageio.org

OpenImageIO (OIIO for short) is a format-agnostic API for reading and
writing image files.  TIFF is among many image file formats supported
(using libtiff underneath, of course).  But even if you are only
interested in TIFF, you may find that using OIIO's API's to read TIFF
files is simpler and more straightforward than struggling with the raw
libtiff calls.  There are also a lot of other useful features of the
library, including an image tile cache that lets you literally access
hundreds of GB of image data without worrying about which parts are in
memory or which files are opened, and a filtered texture system.

But the aspect of OIIO that is relevant to Debora's question is that the
basic API for reading images automatically does format conversion and
will read data into buffers with strides.  For example, your basic issue
is that you want to read data from a TIFF file (perhaps with arbitrary
bit depth) into a buffer of double[2], but you want the pixel values to
end up in every other buffer slot.  Piece of cake.  You can do it with
about 7 lines of code:

        ImageInput *in = ImageInput::create (filename);
        ImageSpec spec;
        in->open (filename, spec); /* res is now in spec.{width,height}
*/
	fftw_complex *img1 = fftw_malloc(sizeof(fftw_complex) *
spec.width * spec.height);
	memset (img1, 0, sizeof(fftw_complex) * spec.width *
spec.height);  // zero it out
        in->read_image (TypeDesc::DOUBLE /* desired data format */, 
			pixels /* buffer */,
		        2*sizeof(double) /* optional: x stride */);
        in->close ();
        delete in;

This will work for scanline or tiled images, any bit depth with proper
conversion to double, etc.  (Though as I've written it, the code assumes
a single data channel. To be robust, it should check spec.nchannels
before proceeding with the read_image.)  Also, if you had the need to
read other file formats, this code would not need to be modified, as
long as it's a file format that OIIO understands or can find a plugin
for.

I hope you are using C++.  If it's straight C, never mind.

	-- lg


On Feb 8, 2010, at 8:48 AM, tiff-request@lists.maptools.org wrote:

> ----------------------------------------------------------------------
> 
> Date: Mon, 8 Feb 2010 11:47:27 +0100
> From: "Gil, Debora, VF-ES (dgilalv) STU" <debora.gil@vodafone.com>
> Subject: [Tiff] fftw and TIFF files
> To: <tiff@lists.maptools.org>
> 
> Hi,
> 
> I'm trying to do the phase correlation of two TIFF images (a reference
> image and an image received via fax) to determine if they are similar
> and or have any offset.
> 
> For this I'm using LibTIFF and FFTW. In order to do this I need to
load
> the Image data to the FFTW input arrays:
> 
> fftw_complex *img1 = ( fftw_complex* )fftw_malloc( sizeof(
fftw_complex
> ) * width * height ); <- this is the input array (it's a double[2]
> composed of the real and imaginary parts of a complex number)
> 
> As I said, what I need to do is load the image data on that input
array.
> I would like to do something like this:
> 
> for( i = 0; i < height ; i++ ) {
>    for( j = 0 ; j < width ; j++) {
>        img1[k][0] = <- here goes the image data
>        img1[k][1] = 0.0;
>    }
> }
> 
> This kind of thing is what I've seen in an OpenCV example for reading
> TIFF images, but it doesn't seem to work so I decided to try with
> LibTIFF. 
> 
> Thanks in advance,
> 
> Debora
> 

--
Larry Gritz
lg@larrygritz.com


_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
