help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

float image viewer


From: Richard Kirk
Subject: float image viewer
Date: Fri, 6 Apr 2018 08:37:46 -0700 (MST)

Hi.

imshow() is handy because it is always there in Octave. However, there are
things that I need...
- handling of float images
- report of RGB values for pixel at cursor
- dark surround to image

It would be nice to have gamma and range controls. I am happy working with
imshow(I.^0.4) for displaying linear images on a gamma 2.5 monitor, but it
would be nice to get the original floats on a pick, particularly as my
command does nasty things with negative values. 

I am currently working on a Mac High Sierra (10.13.3) but I also use CentOS.
I am running Octave 4.2.2.
 
Here's the first exit point. Perhaps we can do all these and I haven't found
them. I think ImageMagic throttles most things to 8- or 16-bits, so we
cannot see anything outside the 0-1 range. That is fair, as we are sending
the image to a display - we ought to be able to get the float pixel values
from the original image data. I am not needing to do critical colour work on
the images, so even 8-bit RGB would probably do; but the black surround is
important.

I do imaging R&D with floating-point images. I made a very raw floating
point format with 4 32-bit integers as header (magic, channels, lines,
pixels) so we can read it with fread, permute, and reshape. I supported this
in my viewer, and it all works. If you draw a rectangle on the cursor, it
can return the image coordinates or the RGB values. Unfortunately, this
viewer is not open source, and is not very lightweight.

Exit point two: if these features are in the pipeline, I can keep my viewer
for now, and wait. I have something that works for now.

I found 'giv' ( http://giv.sourceforge.net/giv/ ) This seems to have support
for 32-bit float image data, custom formats, and lots of overlays. This
might be an open source solution. I haven't managed to build it on the Mac
yet, but I only found it this morning. I don't think using 'xv' helps but I
have hacked 'xv' ages ago, so I might see what it can do.







% FL32 header
H = fread(fid, 4, 'int32');
if H(1) != 842222662
  error('%s is not a float32 image', fname);
end

channels = H(2);
pixels   = H(3);
lines    = H(4);

[A count] = fread(fid, lines*pixels*channels, 'float32');
if count < lines*pixels*channels
  error('%s file truncated', fname);
end

fclose(fid);
dfrm = permute(reshape(A, [lines pixels channels]), [3 2 1]);




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]