From: Tony Alberti on
Hello all,

I am an undergraduate intern who was given a program that processes HDF5 images to TIF images. The program works in a way that it goes through image by image, one at a time. My task was to modify the program to go through an entire batch of images as well as rotate them 90 degrees (clockwise) as well as flipping the image on its horizontal axis. I have played with the code using the functions imrotate, fliplr, rot90, you name it. But still no matter what I try I for some reason cannot get the picture to manipulate.... If there is anyone who has any other ideas as to what can be done I would be most grateful!

Thanks in advance for your efforts,
Tony
From: ImageAnalyst on
Tony:
Seemed to work perfectly for me. What did you do differently?

clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures.
clear; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
fontSize = 14;

% Read in a standard MATLAB gray scale demo image.
folder = 'C:\Program Files\MATLAB\R2010a\toolbox\images\imdemos';
baseFileName = 'cameraman.tif';
fullFileName = fullfile(folder, baseFileName);
grayImage = imread(fullFileName);
% Get the dimensions of the image. numberOfColorBands should be = 1.
[rows columns numberOfColorBands] = size(grayImage);
% Display the original gray scale image.
subplot(2, 2, 1);
imshow(grayImage, []);
title('Original Grayscale Image', 'FontSize', fontSize);
set(gcf, 'Position', get(0,'Screensize')); % Enlarge figure to full
screen.

flippedImage = fliplr(grayImage);
subplot(2, 2, 2);
imshow(flippedImage, []);
title('Flipped Image', 'FontSize', fontSize);

rotatedImage = imrotate(grayImage, -90);
subplot(2, 2, 3);
imshow(rotatedImage, []);
title('Rotated -90 Image', 'FontSize', fontSize);

rotatedImage2 = rot90(grayImage, 3);
subplot(2, 2, 4);
imshow(rotatedImage2, []);
title('Rotated 90 Clockwise Image', 'FontSize', fontSize);


From: Ashish Uthama on
On Mon, 12 Jul 2010 17:50:04 -0400, Tony Alberti <tonyalberti(a)ymail.com>
wrote:

> Hello all,
>
> I am an undergraduate intern who was given a program that processes HDF5
> images to TIF images. The program works in a way that it goes through
> image by image, one at a time. My task was to modify the program to go
> through an entire batch of images as well as rotate them 90 degrees
> (clockwise) as well as flipping the image on its horizontal axis. I have
> played with the code using the functions imrotate, fliplr, rot90, you
> name it. But still no matter what I try I for some reason cannot get the
> picture to manipulate.... If there is anyone who has any other ideas as
> to what can be done I would be most grateful!
>
> Thanks in advance for your efforts,
> Tony

How are you reading the HDF5 data? Note that the HDF5 native dimensions
are row major, the data read into MATLAB would have column major ordering
(so thats a transpose already).

Are you 'modifying' the code in the correct location? If you have added a
FLIPLR/etc in the code path after you read the data, but before you write
it, And the observed output does not change... you probably have to
recheck where you added your code :)