NI Home > Community > NI Discussion Forums
Reply
Member
Pratt
Posts: 36
0 Kudos

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
Active Participant
BCho
Posts: 349
0 Kudos

Re: Vision 2009 ArrayToImage Method difference

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
Member
Pratt
Posts: 36
0 Kudos

Re: Vision 2009 ArrayToImage Method difference

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
Active Participant
BCho
Posts: 349
0 Kudos

Re: Vision 2009 ArrayToImage Method difference

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
Member
Steverino
Posts: 133

Re: Vision 2009 ArrayToImage Method difference

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.

 

 

Member
Pratt
Posts: 36
0 Kudos

Re: Vision 2009 ArrayToImage Method difference

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
Proven Zealot
muks
Posts: 6,710
0 Kudos

Re: Vision 2009 ArrayToImage Method difference

Can you post the car# for our reference?
Member
Steverino
Posts: 133

Re: Vision 2009 ArrayToImage Method difference

CAR# 205929

Member
Pratt
Posts: 36
0 Kudos

Re: Vision 2009 ArrayToImage Method difference

Has this problem been fixed in Vision 2010?

John A. Lively
NDE Engineer
Pratt & Whitney
Member
esmaham
Posts: 100
0 Kudos

Re: Vision 2009 ArrayToImage Method difference

Hi John,

 

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

 

Thanks and have a great day.