Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Vision 2009 ArrayToImage Method difference

I just installed the Vision 2009 Development module and are converting an old program to the new Vision .NET syntax. I noticed  VisionImage.ArrayToImage now seems to work in a (height / Y, width / X) format when viewed in the ImageViewer. Is this a change in the ArrayToImage method or the Viewer method? Is there a way to change it back?

 

The new .NET version is a great improvement. It is now a true .NET implementation with integrated Visual Studio help. The downside is a lot of the method  / property names have changed, so each line of code must be edited. The legacy code is still available if installed.

John A. Lively
NDE Engineer
Pratt & Whitney
0 Kudos
Message 1 of 23
(5,971 Views)

Hey John,

 

I am a little unsure what you are referring to by how you described the format of the ArrayToImage method. Are you saying that if you pass a 2D array to the method, the first dimension of the array represents the height of the image and the second dimension of the array represents the width of the image? If you have an array [0 0; 255 255; 0 0] your image will be three rows and two columns. So in the since an array being described in a (rows, columns) format, you are correct. In this way, if you were to manually dray out the array of pixel values, it would give you a properly oriented image. This shouldn't be different than any previous versions of NI Vision. If you are looking for the opposite orientation, perhaps transposing the array is in order.

Hope this helps.
-Ben

WaterlooLabs
0 Kudos
Message 2 of 23
(5,939 Views)
Yes, you now must provide the array in a Row / Y - vertical  x Column / X - horizontal orientation for ImageViewer to display it correctly. In versions 1.0 - 8.6 of Vision development module it was Column x Row format (stated in documentation).  It is not hard to change but all previous applications will have to be modified when upgraded.
John A. Lively
NDE Engineer
Pratt & Whitney
0 Kudos
Message 3 of 23
(5,933 Views)

Hey John,

 

You are correct in saying that the 'The first index corresponds to the vertical axis and the second index corresponds to the horizontal axis.' I am having a little trouble digging up some of the documentations from previous versions of Vision so I can not verify that this was different in previous versions of Vision. It seems odd that this would have changed suddenly in the most recent version of Vision. However, if is is documented and has been working for you in the opposite fashion for all previous versions, then I would have to agree that this was a change. I do apologize for any inconvenience this causes with upgrading your application.

Hope this helps.
-Ben

WaterlooLabs
0 Kudos
Message 4 of 23
(5,918 Views)

This is switch from the CWIMAQ-versions of the library. I called NI tech support, and the applications engineer I was working with filed a corrective action report with the R&D group.

 

I tried the following code:

 

Private Sub btnButton1_Click(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles btnButton1.Click

        Dim data(100, 100) As Short

        Dim Image1

        Dim i As Short

        Dim j As Short

 

        Dim Image2

        Image1 = New NationalInstruments.Vision.VisionImage

        Image2 = New NationalInstruments.CWIMAQControls.CWIMAQImage

        For i = 0 To 100

            For j = 0 To 100

                data(i, j) = (i \ 10) * 10

 

            Next j

        Next i

 

        Dim PixelArray As New NationalInstruments.Vision.PixelValue2D(data)

        Dim PixelArray2 As Object = CType(data, Object)

  

        imageViewer1.Image.Type = NationalInstruments.Vision.ImageType.I16

        imageViewer1.Image.ArrayToImage(PixelArray)

 

        axCWIMAQViewer1.Image.Type = CWIMAQImageTypes.cwimaqImageTypeI16

        axCWIMAQViewer1.Image.ArrayToImage(data)

    End Sub

 

It creates an image that is rotated in the Vision 2009 viewer relative to the CWIMAQ viewer.

 

 

Message 5 of 23
(5,905 Views)

Yes,

 

This is what I am seeing also. I have a ticket in with NI also. They are working on confirming. With both of us seeing the same thing something has charged. I was told I should have a reply within a week.

John A. Lively
NDE Engineer
Pratt & Whitney
0 Kudos
Message 6 of 23
(5,901 Views)
Can you post the car# for our reference?
0 Kudos
Message 7 of 23
(5,872 Views)

CAR# 205929

Message 8 of 23
(5,862 Views)

Has this problem been fixed in Vision 2010?

John A. Lively
NDE Engineer
Pratt & Whitney
0 Kudos
Message 9 of 23
(5,276 Views)

Hi John,

 

Unfortunately this CAR 205929 still open and R&D still working on it as of today.

 

Thanks and have a great day.

0 Kudos
Message 10 of 23
(5,263 Views)