LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Drawing on an IMAQ image

Solved!
Go to solution

Dear All

 

I am trying to incorporate a piece of code into my vi that will allow me to draw a box on an image. The box however, must be able to be created based off of the image pixels from a camera. I am currently using a piece of code that allows me to click and drag a box. 

 

What I'm saying, is that if i have an image from the camera that is 500x500 pixels (for example) and a beam is at the position  (250,250), i would like to draw a box around this of a user determined size. If I wanted a box that was 100 image pixels wide, I could draw/create a box that has points at (150,350), (350,150), (350,350), (150,150). The beam is at the centre of the box. 

 

I have tried to use the IMAQ draw on image VI but this seems to change the pixel values, I don't want it to do this as these images are then manipulated (centroid calculation etc). 

 

does anyone have any idea how I might do this or any advice?

The VI i am using currently is attached below, I did not write this particular vi. I believe it was written by Ben64.  

 

Best Wishes

Andrew

0 Kudos
Message 1 of 10
(4,255 Views)

HI,

If you do not want to alter the image, you can use a separate front panel object and place it on top of the graph.

0 Kudos
Message 2 of 10
(4,209 Views)

Have you considered creating a rectangular ROI? This is non destructive and can be moved on the UI.

 

snip.png

0 Kudos
Message 3 of 10
(4,198 Views)

Hi both

 

thank you so much for the replies. 

 

I will try this solution and see how it goes.

 

can I then take the image output of that image then display it onto an intensity graph with the box drawn on it. 

 

Best Wishes 

Andrew

0 Kudos
Message 4 of 10
(4,193 Views)

@AndrewIons01 wrote:

can I then take the image output of that image then display it onto an intensity graph with the box drawn on it. 


Using an intensity graph seems a bit convoluted when you are already using IMAQ. Is there a reason for this?

0 Kudos
Message 5 of 10
(4,189 Views)

Hi 

 

we are using intensity graphs as it was what we decided to use early on in the project. Another reason is because it will show me exactly how far a beam has travelled. 

 

Best Wishes

Andrew

0 Kudos
Message 6 of 10
(4,184 Views)

Then how about using 2 cursors? This will show lines across the whole length and width but it is non-destructive.

 

RamonG_0-1628862004990.png

 

0 Kudos
Message 7 of 10
(4,182 Views)

Hi 

 

Ramon

 

This sounds great, is it possible to define the gap between the cursors by a set amount i.e. can i use a numeric indicator to pre-define a width and height?

 

Best wishes

Andrew

 

0 Kudos
Message 8 of 10
(4,175 Views)
Solution
Accepted by topic author AndrewIons01

Yes, you can programmatically set cursors.

 

snip.png

Message 9 of 10
(4,158 Views)

Brilliant thank you so much, this works a treat. 

0 Kudos
Message 10 of 10
(4,154 Views)