MapWindow Home
Search MapWindow.org


  • Home
    • Download
    • Why MW
    • FAQ
    • Contact
  • Products
    • MapWindow
    • ActiveX
    • Plug-ins
  • Software Dev
    • Sample Code
    • Scripts
    • Source
    • Bugs
    • Support
    • Languages
  • Site Tools
    • Forums
    • Tutorials
    • Mailing Lists
    • Team
    • Site Stats
    • Links
  • Get Stuff
    • Buy a CD
    • Buy a T-Shirt
    • MW Book
    • ActiveX Book
    • Donate
    • Buy Support
  • Documentation
    • MWGIS App. User Guide
    • GISTools User Guide
    • MW Plug-ins Dev. Guide
    • MWGIS ActiveX Dev. Guide
    • MWGeoProc Dev. Guide

MapWinGIS:Image GetRow

From MapWindow GIS

Jump to: navigation, search

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://www.mapwindow.org/wiki/index.php/MapWinGIS:Image_GetRow"
Views
  • Page
  • Discussion
  • View source
  • History
Personal tools
  • Log in / create account
  • What links here
  • Related changes
  • Upload file
  • Special pages
  • Printable version
  • Permanent link

Geospatial Software Lab

Copyright © 2008 - MapWindow Open Source Team
( last updated: December 03 2008.)
Home | Donate | Download | MapWindow GIS Desktop | MapWinGIS.ocx | Plug-ins | Contact | Lists | Bugs | Sample Code | Documentation
Code Repository | Open Source License | Discussion Forum | Wiki | Join the Team | Site Statistics | Links