Jump to content

How can I extract unsigned 16-bit single channel images from unsigned 64-bit RGB images?


Recommended Posts

Posted

I want to extract red, green and blue as separate 16-bit greyscale images from a 64-bit unsigned RGB image (TIFF format, 16-bit per channel).

There is an example of a program that does something similar here,

http://decibel.ni.com/content/docs/DOC-5003

but I find I cannot get UNSIGNED images to output, only SIGNED. This means half of the dynamic range is lost.

I need to keep the unsigned dynamic range because this is for an accurate colour measurement application.

This should be a trivial task, but for some reason Labview by default can only extract signed 16-bit data, and there is no option as far as I can see, to change this.

I have used a histograph on the greyscale images, and this confirms the image has been truncated, with half of the data being rewritten to the highest signed integer value.

If anyone knows a workaround or solution, please let me know!

J

Posted

What version of NI-IMAQ are you using? Only recent versions have support for "U16"s (maybe IMAQ 4.4 and later?).

Bruce

I think it's NI-IMAQ 4.3!

Hmmm, so is there no workaround?

Posted

Hi,

I have IMAQ 4.5 and here's what I can do. Not sure which version of IMAQ introduced the grey U16...

[screenshot won't upload :(, probably related to that, anyway it works fine for me with IMAQ 4.5]

If you just need to extract a color pane top display it and don't need to have a greyscale u16 to do processing on it then you can create a second RGB U64 and use the "color image to array" function and extract only the red pand from the 2D array (by replacing the other panes with 0). Just an idea...

hope this helps

Posted

I think it's NI-IMAQ 4.3!

Hmmm, so is there no workaround?

Upgrade to IMAQ 4.5, I've used this version for a few months now and it's seems reliable. It's compatible with LV8.5 and up.

Bruce

Posted (edited)

Upgrade to IMAQ 4.5, I've used this version for a few months now and it's seems reliable. It's compatible with LV8.5 and up.

Bruce

I went on the NI website, and I can only find the file for IMAQ 3.1.3, not 4.5. SEE LINK:

http://search.ni.com/nisearch/app/main/p/bot/no/ap/tech/lang/en/pg/1/ps/20/sn/catnav:du,n8:5506,ssnav:sup/q/imaq%204-PERIOD-5/

I am getting a new version of Labview eventually but I will have to wait a long time :-(

Thanks for the suggestion Antoine, the colour image to array may be possible... I tried but it didn't work when outputting the values to a table (all blank). If you could send an example vi and show me how to change the values, it would be very helpful!

James

Edited by JMak
Posted

If you send me your email address via PM I can email you an example since LAVA apparently ran out of disk space...

What version of LabVIEW are you using? (I have 8.5, 8.6 and 2010)

OK, I'll PM you. I have Labview 2009.

Posted

Antoine -

I loaded your VI and tried to replace the image generator with an image reader, but I get the error message that I have not enough memory to perform the operation... I have 4GB RAM, surely this should be enough?

There must be an error in how I wired it. If you like I can upload the image somewhere, but it is an 86MB tiff. If there is another format that supports 64-bit RGB I'll try that. The raw *.CR2 Canon image format is smaller (18MB) but you might not have software that can use it or convert it...?

Shaun -

Will this work only with Labview 2010, or will it work with my 2009 version?

Thanks for the help

Posted

your image is pretty big, so to avoid the error maybe you can use the function "IMAQ get file info" to get the size of the image and pre-allocate the right size when you use the IMAQ create.

Thanks for the help Antoine.

It is working as-is on a PC with 12GB ram, but I'll try your suggestion to see if it works on my laptop.

I wanted to attach an image to show you what I want to do next, but I can't seem to upload! I will try to get as far as I can on my own but if I get stuck I'll reply here.

Posted

I am trying to pre-allocate the memory, but I don't know how to do this. There is a "read file size" operation, but how do I use this to prepare the memory?

I am downloading the update now, it will probably take all day.

Posted

Like this :

post-7452-0-31180900-1301309902_thumb.pn

And now that LAVA has been upgraded, here is the VI I was talking about earlier :

u64_generate or load.vi

Hope this helps

The "get file info" thing seems to do the trick, thanks Antoine! I'm still downloading the update, I'll let you know what happens when I try the VI...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.