MapWinGIS:Image GetRow

This is a back-up of the WIKI.
Not all links might work
We're working on a new wiki.

Main Page | Recent changes | View source | Page history | Log in / create account |

Printable version | Disclaimers | Privacy policy

GetRow

Gets a row of pixels from the image.


VB.NET Usage

Function GetRow(Row As Integer, ByRef Vals() As Integer) As Boolean

            Parameters

Row

The row of pixels you want to get from the image.
Vals() Reference parameter. An array which will return the pixels in the specified row of the image.
ReturnValue A boolean value representing the success or failure of getting the row of pixels from the image.

Sample Code

    Private Sub GetRow()
        Dim image As New MapWinGIS.Image(), image2 As New MapWinGIS.Image()
        Dim row As Integer, i As Integer, j As Integer
        Dim pixels(400) As Integer
        Dim success As Boolean
        'Open image from file
        image.Open("C:\test.bmp")
        'Create a new image to copy rows of pixels to
        image2.CreateNew(400, 500)
        'Set the row to get the pixels from
        row = 0
        'Get 400 rows x 400 columns of pixels from image and copy them into image2
        For i = 1 To 400
            'Get the pixels from the specified row in the image
            success = image.GetRow(row, pixels(0))
            'Get 400 pixel values from the row retrieved from image
            For j = 1 To 400
                'Copy the current pixel into image2
                image2.Value(i, j) = pixels(j)
            Next
            'Advance to the next row in the image
            row = row + 1
        Next
        'Add the new image to the map
        Map1.AddLayer(image2, True)
    End Sub
  

VB 6 Usage

Function GetRow(Row As Long, ByRef Vals() As Long) As Boolean
            Parameters

Row

The row of pixels you want to get from the image.
Vals() Reference parameter. An array which will return the pixels in the specified row of the image.
ReturnValue A boolean value representing the success or failure of getting the row of pixels from the image.

Sample Code

    Private Sub GetRow()
        Dim image As New MapWinGIS.image, image2 As New MapWinGIS.image
        Dim row As Long, i As Long, j As Long
        Dim pixels(400) As Long
        Dim success As Boolean
        'Open image from file
        image.Open ("C:\test.bmp")
        'Create a new image to copy rows of pixels to
        image2.CreateNew 400, 500
        'Set the row to get the pixels from
        row = 0
        'Get 400 rows x 400 columns of pixels from image and copy them into image2
        For i = 1 To 400
            'Get the pixels from the specified row in the image
            success = image.GetRow(row, pixels(0))
            'Get 400 pixel values from the row retrieved from image
            For j = 1 To 400
                'Copy the current pixel into image2
                image2.value(i, j) = pixels(j)
            Next
            'Advance to the next row in the image
            row = row + 1
        Next
        'Add the new image to the map
        Map1.AddLayer image2, True
    End Sub

Retrieved from "http://mapwindow.org/wiki/index.php/MapWinGIS:Image_GetRow"

This page has been accessed 1,580 times. This page was last modified on 9 November 2005, at 16:45.