LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem Saving overlayed image

Solved!
Go to solution

Hey,

 

I am overlaying part of an Image with Imaq overlay Rectangle. The vi works like expected and i can see the result of the overlay on Image Pannel. But when i save this Image on my MyRIO-device, it appears without overlay. I tried to solve the Problem using U32-Image but i still have the same Problem.

you can also get a look on my attached vi.

 

I will be very pleased if someone can give me an some indications.

thank you.

 

 

Message 1 of 19
(5,248 Views)

The Help for IMAQ Overlay Rectangle (LabVIEW 2016) says:  Overlays are nondestructive, which means that they do not overwrite underlying pixel values.  You can save overlay infomation with an image by using the IMAQ Read Image and Vision Info VI.  If you want to replace the underlying pixel values with the overlay values, use the IMAQ Merge Overlay VI.

 

Might this contain a clue?

 

Bob Schor

 

Message 2 of 19
(5,221 Views)

Hey Bob,

thank for replying.

The Idea was to overlay with a rectangle the parts of the Image, which have Pixel greather than the threshold. but this was difficult to implement with my vi, because many parts of the Image could have a rectangle overlayed and this will not look good. So using the Pixel Values makes it difficult to implement. you can get a look at the attached png-pic to see what i want to do. So that is why i decided to overlay every Pixel Point without rectangle.

when i use "Imaq write Image and Vision Info file" it saves the Image without overlay, even if i can see the overlayed Image for and behind the saving process using Display Image.

 

did you mean "Imaq write Image and Vision Info file" ?

Download All
0 Kudos
Message 3 of 19
(5,200 Views)

@moidrissou wrote:

 

did you mean "Imaq write Image and Vision Info file" ?


Actually, I wanted to "Cut and Paste" from the IMAQ Overlay Rectangle VI Help text, but couldn't do it, so I just typed the text into my response.  Your question made me go back and see if I had "turned off my brain" while reading/typing, and the answer is "partly" -- the Help text does say IMAQ Read Image and Vision Info, but I should have realized that was probably wrong and checked.  Turns out the IMAQ Write File 2 function is polymorphic, and there is an IMAQ Write Image and Vision Info File 2 instance that should have been referenced in the Help message.  Good catch!

 

Bob Schor  

0 Kudos
Message 4 of 19
(5,187 Views)

Hey bob. I just set this instance as true value. but it seems not to solving the Problem. the saved overlayed Image is still without overlay. I don't really know what i am doing wrong.

 

 

 

0 Kudos
Message 5 of 19
(5,183 Views)

If you are having trouble with some code, and want someone to look at it, maybe to test it, maybe to "fix" it, you need to make the minimal effort of attaching your VI.  In your case, I would recommend creating a folder containing the VI and other VIs that it requires (if you have this in a LabVIEW Project, then the folder containing the Project is an excellent choice), along with a sample Data File containing the original Image and a clear description of what you want to do.  Compress the entire folder (which creates a Zip file of the folder and its contents), and attach the Zip file.

 

I can "guess" that you have a bad VI, or a missing wire, or something else wrong, but I'm not going to waste your time or my time on "blind guesses".

 

Bob "Attach the Zip File" Schor

0 Kudos
Message 6 of 19
(5,173 Views)

Hey,

 

Thank you for your Reply. Here is my actual code and a documentation of what i am willing to do. I don't have more vi.

 

Thank you again for your help

Download All
0 Kudos
Message 7 of 19
(5,161 Views)

Very helpful!  I think I can "reduce this to a previously-solved problem" (a common Mathematics trick).  I've actually solved this problem, but I don't have time right now to look for my solution, so I'll restate the problem for you so that you can do this, or so one of my Forum Colleagues (many of whom are far more experienced in Imaging than I) can help.

 

What you want to do has nothing to do with Cameras, but everything to do with IMAQ Image Processing.  I recommend that you develop a very simple routine as a "stand-alone Demo" (or Proof of Principle) that does the following:

  1. Read a PNG and display it as an IMAQ Image (I like to use the Windows Sample Image of the Desert).
  2. Using whatever tools/methods you want, add a Rectangle to this Image.  One simple way is to use the Drawing Tools to draw a Rectangular Region of Interest.
  3. If you use the ROI tools, figure out how to turn them into a Rectangle.
  4. Figure out how to merge/save the Image with the Overlay.  Note that there may be several methods available, including (a) merging the images, (b) overwriting the underlying Image, (c) masking operations, or (d) using the Write Image and Vision Info File 2 function.
  5. Since Step 1 has code to read and display a PNG, you can use it again to read and display the PNG you saved in Step 4 and see if it works.

Develop and test this code on your Host PC, not on your RIO platform -- it will be much simpler to develop, test, post on the Forum, etc.  Keep it small and as neat as possible, particularly if you need to post it for "targeted, specific help".  Once you've got this "nailed down", consider making it a sub-VI called something like "Save Image with Rectangle" so in your main Routine, you can "hide the messy details" while getting the Real Code to work.

 

Bob Schor

0 Kudos
Message 8 of 19
(5,152 Views)

Hey Bob,

i developped the VI that you have described in your steps. But I still have the same Problem. I am reading an Image from my Computer. I use Imaq overlay rectangle to realise it. Using "Imaq Write Image and Vision File 2" should makes it possible to save the Image with overlays. but when i look in the Folder, it is without overlay. I also readed in the ni Vision Manual that we should use this function to save overlayed Image.

 

Thanks for your help.

 

 

Download All
0 Kudos
Message 9 of 19
(5,141 Views)
Solution
Accepted by topic author moidrissou

I suspect the Save Image with Overlay saves the unmodified Image and, in another format, information about the overlay.  Recall that overlays are non-destructive, meaning that the Image is not modified.

 

Try something like this:

OTestVI.png

which produces this:

OTest.png

 

Bob Schofr

Message 10 of 19
(5,131 Views)