Skip to content

Commit

Permalink
error in array size
Browse files Browse the repository at this point in the history
  • Loading branch information
totoantibes committed Apr 30, 2020
1 parent 8d5667b commit 7bd21bd
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions LumixCamera/Driver.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ Public Class Camera
End If
Dim Tiffimagefile As IO.FileStream
Tiffimagefile = New FileStream(TiffFileName, IO.FileMode.Open)
ReDim cameraImageArray(cameraNumX + 1, cameraNumY + 1) ' there are 3 channels: RVB.
ReDim cameraImageArray(cameraNumX - 1, cameraNumY - 1) ' there are 3 channels: RVB.

Dim decoder As New TiffBitmapDecoder(Tiffimagefile, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default)
Dim stride As Int32
Expand All @@ -1094,8 +1094,8 @@ Public Class Camera
If CurrentROM = 1 Then
Dim pixels(bitmapSource.PixelHeight * stride) As UShort
bitmapSource.CopyPixels(pixels, stride, 0)
For y = 0 To (cameraNumY - 1)
For x = 0 To (cameraNumX - 1)
For y = 0 To (cameraNumY - 2)
For x = 0 To (cameraNumX - 2)
index = x * 3 + (y * stride / 2) 'because of the 16 bit instead of the 8 bit per channel this /2 is needed.
'cameraImageArray(x, cameraNumY - y - 1, 0) = pixels(index)
'cameraImageArray(x, cameraNumY - y - 1, 1) = pixels(index + 1)
Expand Down Expand Up @@ -1142,11 +1142,9 @@ Public Class Camera
Throw New ASCOM.InvalidOperationException("Call to ImageArrayVariant before the first image has been taken!")
End If

ReDim cameraImageArrayVariant(2 * cameraNumX - 1, 2 * cameraNumY - 1)
For i As Integer = 0 To cameraImageArray.GetLength(1) - 1
For j As Integer = 0 To cameraImageArray.GetLength(0) - 1
cameraImageArrayVariant(j, i) = cameraImageArray(j, i)
cameraImageArrayVariant(j, i) = cameraImageArray(j, i)
ReDim cameraImageArrayVariant(cameraNumX - 1, cameraNumY - 1)
For i As Integer = 0 To cameraNumY - 1
For j As Integer = 0 To cameraNumX - 1
cameraImageArrayVariant(j, i) = cameraImageArray(j, i)
Next
Next
Expand Down

0 comments on commit 7bd21bd

Please sign in to comment.