Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

cwimaqviewer

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!

0 Kudos
Message 1 of 7
(3,863 Views)

Any idea?

 

Regards!

0 Kudos
Message 2 of 7
(3,849 Views)

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:

http://forums.ni.com/t5/Measurement-Studio-for-VC/How-to-display-Image-grabbed-by-IMAQdx-in-CWIMAQVi...


Best Regards,

Tamas

0 Kudos
Message 3 of 7
(3,827 Views)

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

0 Kudos
Message 4 of 7
(3,822 Views)

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,

Peter Vago
0 Kudos
Message 5 of 7
(3,787 Views)

Hello,

 

sorry for this late reply.

 

NI VIMAQ Vision is version 8.6.

 

Any idea?

 

Reards!

 

Danilo

0 Kudos
Message 6 of 7
(3,759 Views)

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

 

0 Kudos
Message 7 of 7
(3,745 Views)