Image Orientation

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Image Orientation

Brian Schlining

Hi All,

I’m reading an image that has the following dimensions: width = 2448 pixels, height = 3264. I’m reading it as an ImgPlus as follows:

// Scala code
import io.scif.img.IO

val imgs = IO.openImgs("/images/IMG_20140806_080706.jpg")
val imgPlus = imgs.get(0);

The resulting Img has dimensions of [3264x2448x3] or [HEIGHTxWIDTHxCOLORS; which seems to be transposed from what I expect. I would expect it to be [WIDTHxHEIGHTxCOLORS]. In fact, if I convert it to a bufferedImage (see below), then it the BufferedImage also has the wrong orientation:

import net.imglib2.img.display.imagej.ImageJFunctions

val imagePlus = ImageJFunctions.wrap(img, "")
val bufferedImage = imagePlus.getBufferedImage
println(bufferedImage)
println(s"\twidth = ${bufferedImage.getWidth()}") // prints 3264 -> WRONG
println(s"\theight = ${bufferedImage.getHeight()}") // prints 2448 -> WRONG

Can some explain what’s going on here. I’m very confused.

Thanks



-- 
Brian Schlining


_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel
Reply | Threaded
Open this post in threaded view
|

Re: Image Orientation

Brian Schlining

Never mind! I’m working on a Mac and all it’s preview utilities were auto-rotating the image. The imglib IO is reading the file using the correct dimensions. (smacking head on desk)



On August 20, 2014 at 9:30:21 AM, Brian Schlining ([hidden email]) wrote:

Hi All,

I’m reading an image that has the following dimensions: width = 2448 pixels, height = 3264. I’m reading it as an ImgPlus as follows:

// Scala code
import io.scif.img.IO

val imgs = IO.openImgs("/images/IMG_20140806_080706.jpg")
val imgPlus = imgs.get(0);


The resulting Img has dimensions of [3264x2448x3] or [HEIGHTxWIDTHxCOLORS; which seems to be transposed from what I expect. I would expect it to be [WIDTHxHEIGHTxCOLORS]. In fact, if I convert it to a bufferedImage (see below), then it the BufferedImage also has the wrong orientation:

import net.imglib2.img.display.imagej.ImageJFunctions

val imagePlus = ImageJFunctions.wrap(img, "")
val bufferedImage = imagePlus.getBufferedImage
println(bufferedImage)
println(s"\twidth = ${bufferedImage.getWidth()}") // prints 3264 -> WRONG
println(s"\theight = ${bufferedImage.getHeight()}") // prints 2448 -> WRONG

Can some explain what’s going on here. I’m very confused.

Thanks



-- 
Brian Schlining
-- 
Brian Schlining


_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel