Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding XY point in a CWIMAQViewer

I have a CWIMAQViewer and I want to use the POINT tool to place little X's. When I make a click with my mouse I want to get what the X and Y is of that position from within the CWIMAQViewer. Just like the SHOW TOOL INFO does. But how do I easily do that in code? The X and Y parameters passed into the Mousedown function of the Viewer are unfortunately Coords for the Whole Screen.

It's funny. When a method like .DrawTExt is used it can get it's Origin point right from teh .Regions(#) of the click point. But I can't seem to pull the X and Y out of the .REgions. Perhaps by getting the Bounding Rectangle I could find the XY of the point.

There must be a simpler way to figure out where the Cursor is in the Viewer. The TOOL info on the bottom of the Viewer can, so I should be able to get that in code somehow.

Thanks.
0 Kudos
Message 1 of 6
(7,380 Views)
Hello,
 
If you have IMAQ Vision installed on your system, then you can use the GetSelectedPointFromViewer function to return the point specified by the cursor on the CWIMAQViewer.  You could also use the DrawCircularPoint, DrawSquarePoint, or DrawCrosshair functions to obtain information about the coordinates of the center of the objects drawn onto the CWIMAQViewer.
 
If you have installed Vision, you can find out more about these functions by navigating to Start >> Programs >> National Instruments >> Vision >> Documentation >> IMAQ Vision for Visual Basic Reference.
 
Regards,
Scott R.
Applications Engineer
National Instruments
Scott Romine
Course Development Engineer
National Instruments
0 Kudos
Message 2 of 6
(7,374 Views)
I am using a usb cam  i have wrote a program in visula basic using Video for windows  that acquire the pic ture from the web cam .now i want to analyse this picture for this i have installed labview vison 7.0 onmy  Pc.my question are
1. how can i use vison 7.0 with vb6 what ineed to use to analize the picture i got from my web cam
2. if make a dll file and used this dll file directly in labview and using this dll file if i create a vi that can acquire the web cam image than how can i interface iamq image anaizing vis to my acquired image. please do guide me i am waiting for any reply.
0 Kudos
Message 3 of 6
(7,362 Views)
Hello,
 
Vision 7.0 was designed for, and can only be used with, LabVIEW.  Vision 7.1 is an integrated API that can be used with LabVIEW, Visual Basic, or C.  Prior to Vision 7.1, you would need to use Vision 6.0 for Measurement Studio.  Upgrading to Vision 7.1 would allow to develop in LabVIEW or Visual Basic and it would also allow you to make use of the NI-IMAQ for USB Cameras driver that is available at:
 
 
Depending on the type of data that is returned from the DLL that you call, you may need to convert the data into the image datatype.  This can be done by using IMAQ Create and passing the image output into the IMAQ GetImagePixelPtr function.  You can then pass that image pointer to the DLL function that you use to acquire a new image.  Once the DLL call completes, the memory location specified by the GetImagePixelPtr will contain the image data and the image specified with IMAQ Create will reference that memory.
 
For an example on how to use these functions, take a look at the IMAQ GetImagePixelPtr example that is located in the IMAQ Vision for LabVIEW VI Reference Help.  This example can also be found by looking at the context help for the function and clicking on "Click here for more help." 
 
Regards,
Scott R.
Applications Engineer
National Instruments
 
 
Scott Romine
Course Development Engineer
National Instruments
0 Kudos
Message 4 of 6
(7,348 Views)
Thanks for the reply .I am using version 1.4 of the LabVIEW webcam library.its third party web cam lib that takes the picture from the web cam and displays in labview . it has (webcam picture vi)Vi that returns web cam image data as a flattedned array and set coordinate specifying image size.it has another vi named as web cam flat to picture that displays the flat image as picture.Now my problem is i want to do image analize for all the image data produce by these vis.for example i want to use imaq histogram it reuquires an image input but when i tried to connect iamge out put from (webcam flat to picture vi) to this imaq histogram its gives error showing me that these two images are not of same time .this mean i need to use IMAQ create vi but how should i used this vi to take the image data from (webcam flat to picture vi) and returns me  an image data type that is understand by other functions such imaqhistogram
looking forward for any comments.
0 Kudos
Message 5 of 6
(7,340 Views)
Hello,
 
The libraries that you downloaded for the webcam library v1.4 were designed to be used in an older version of LabVIEW that did not have the image datatype available.  The VIs in that library use a cluster that contains three elements: a 1-D array of pixel information, the width of the image, and the height of the image.  To use this in LabVIEW 7.0, you would need to convert this data into the current image datatype.  You could do this by converting the 1-D array into a 2-D array using the width parameter to determine how many elements of the 1-D array will constitute a row of the 2-D array.  After you have parsed through this array and built your 2-D array, you can use the IMAQ ArrayToImage VI to convert this 2-D array into the image datatype.  The image output can then be passed into the IMAQ Histogram function or any other Vision function for analysis.
 
Regards,
Scott R.
Applications Engineer
National Instruments
Scott Romine
Course Development Engineer
National Instruments
0 Kudos
Message 6 of 6
(7,329 Views)