12-09-2011 06:04 AM
Hello,
I would like to know how is possible to get information in cwimaqviewer with VB about size of shown picture(zoomed) in pixels.
I'm not able to define size of zoomed picture shown in viewer control.
Any idea?
Regards!
12-12-2011 02:40 AM
Any idea?
Regards!
12-16-2011 08:16 AM
Dear danilo,
As I understood you use Visual Basic in Microsoft Visual Studio. Is that right?
If so, I think you can access the properties of this control like this way:
Let assume that "niViewer" is an instantiated CWIMAQViewer:
I guess you can try it niViewer.ControlImage.size.Width or niViewer.ControlImage.size.Height
I built this code from this post, and it's not tested yet:
Best Regards,
Tamas
12-16-2011 02:03 PM
Hello,
thanks for reply, but this parameter is for defining size of complete control and not size of pictures in pixels.
I need to find out in viewer control when I make ZOOM what is the size of shown picture in pixels?
.
I'm programing in VB6.
Regards!
Danilo
12-30-2011 04:40 AM
Hi Danilo,
Can you provide information about NI-IMAQ version?
Could you attach some screenshot about your input parameters or application? Did you use negative input number as zoom parameter?
Further info about IMAQ acqusitions in VB: http://zone.ni.com/devzone/cda/tut/p/id/3473
Thanks,
01-26-2012 06:37 AM
Hello,
sorry for this late reply.
NI VIMAQ Vision is version 8.6.
Any idea?
Reards!
Danilo
01-30-2012 04:07 AM
Dear danilo,
You can find the official reference help file for IMAQ Visual Basic programming with the documentation of all the functions and properties you need to create your application.
If you have the NI Vision installed, you can find this here: C:\Program Files (x86)\National Instruments\Vision\Documentation\cwimaq.chm
I think if you would use the properties of OriginX and OriginY, it can give you the position of the left upper corner of your displayed image inside your attached large, zoomed image.
If it's better, you could use the CenterX,Y properties as well.
You can also access the ZoomScale property which gives you the multiplier between the displayed/zoomed image and the original one this way: original pixel size = zoomed pixel size * 2^x where x is the ZoomScale.
For example ZoomScale is 0, the original image is the same size as the displayed. If it is +1: zoomed picture is magnified by 2. 1 displayed pixel represents 2 original pixels.
With the above mentioned properties you can easily calculate the zoomed area of your image: (using pseudocode)
int WidthInOriginalmage=ControlImage.Width*(2^ZoomScale)
int HeightInOriginalmage=ControlImage.Height*(2^ZoomScale)
UpperLeftPositionX=OriginX; UpperKeftPositiony=OriginY
UpperRightPositionX=OriginX+WidthInOriginalmage; UpperRightPositionY=OriginY
BottomLeftPositionX=OriginX; BottomLeftPositionY=OriginY+HeightInOriginalmage
BottomRightPositionX=OriginX+WidthInOriginalmage; BottomRightPositionY=OriginY+HeightInOriginalmage
Best Regards,
Tamas Szekely
Applications Engineer