LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to draw an interactive cursor on canvas

hi , I have an imaq pci 1407. Im trying to develop an image capture program. After the snap operation I need to draw a dynamic cursor over the image captured and show the value of the respective pixel when the user is pressing the left mouse button. Which is the easiest way to do this?
0 Kudos
Message 1 of 5
(4,179 Views)
I suggest you study the sample on canvash shipped with cvi ( <cvidir>\samples\userint\canvas.prj ) : ScratchPad function shows you how to determine the cursor position on the canvas and set pen position on it. Using CanvasGetPixel after this, you should be able to get the pixel value in the point the pen is over.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 5
(4,172 Views)

Thanks, its a good example.
I really need to do something like the cvi example "hlring overlay.c" that makes use of the imgPlotDC function, but not in a grab ring, I have a static image. I used the code in the attached file.


The problem is this-When the loop starts all seems to be good, but as time passes the program run more and more slow.

 What is the safest way to do this?

 
0 Kudos
Message 3 of 5
(4,154 Views)

Hello oeolartep,

I didn't notice a loop in the code you attached, but just from your description, it sounds like as the loop continues to iterate, you are either not freeing resource of accumulating more and more information that you have to traverse in the loop, which results in decreased performance.  Maybe if you could provide more information on the behavior you are seeing and the code you are using, it would be helpful in suggesting different program architectures.  Also, I'll have some people who are more familar with the Vision functions take a look at this thread.

Thanks

Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 4 of 5
(4,128 Views)
thanks Wendy, I really appreciate your help.  I start to programming in CVI six moths ago. The code below was constructed seeing the examples  distributed with niimaq software. Initially the program allow us to do a grab operation- "Ring" callback-, in this loop you can see- if you are pressing the right button of the mouse-  two ortogonal lines centered  in the actual position of the mouse  and the grayscale value of this pixel on image. When you stops the loop- "Stop" callback-  the idea is that you have seen the same as in grab ring -two ortogonal lines, position of the mouse and grayscale value of the pixel- but  now on captured image, in this loop the program presents the problem that I mentioned in the previous message.  The callback "Ring" activates a timer asociated with the loop  "Imaqloop",  for the callback  "Stop" the sequence  is "Stop"->"Timer1"->"TimeOnStop".


thanks for your interest.



0 Kudos
Message 5 of 5
(4,116 Views)