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.
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.
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.
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 i As Short
Dim j As Short
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
Dim PixelArray As New NationalInstruments.Vision.PixelValue2D(data)
Dim PixelArray2 As Object = CType(data, Object)
imageViewer1.Image.Type = NationalInstruments.Vision.ImageType.I16
axCWIMAQViewer1.Image.Type = CWIMAQImageTypes.cwimaqImageTypeI16
It creates an image that is rotated in the Vision 2009 viewer relative to the CWIMAQ viewer.
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.
Unfortunately this CAR 205929 still open and R&D still working on it as of today.
Thanks and have a great day.