Jump to content

Search the Community

Showing results for tags 'augmented reality'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. I am coming across a certain error in a certain script #comments-start Augmented Reality Setup Pre-Alpha testing Himanshu Goel 23rd March 2012- Friday #comments-end #include <guiconstantsex.au3> #include <windowsconstants.au3> #include <gdiplus.au3> #include <array.au3> #include <winapi.au3> #include "_Fann.au3" Dim $pixelarray Local $file_in="marker.jpg" Local $file_out="detect1.jpg" _GDIPlus_Startup() _FileImageToArray($file_in, $pixelarray) for $x=1 to $width for $y=1 to $height if $pixelarray[$x][$y]="000000" Then $pixelarray[$x][$y]="FFCC33" EndIf Next Next _FileArrayToImage($file_out, $pixelarray) MsgBOx(0,"Done", "Done!") _GDIPlus_Shutdown() ;Functions ;Convert Image to pixel color information array Func _FileImageToArray($filename, ByRef $aArray) Local $Reslt, $stride, $format, $Scan0, $iW, $iH, $hImage Local $v_Buffer, $width, $height Local $i, $j $hImage = _GDIPlus_ImageLoadFromFile($filename) $iW = _GDIPlus_ImageGetWidth($hImage) $iH = _GDIPlus_ImageGetHeight($hImage) $Reslt = _GDIPlus_BitmapLockBits($hImage, 0, 0, $iW, $iH, $GDIP_ILMREAD, $GDIP_PXF32ARGB) ;Get the returned values of _GDIPlus_BitmapLockBits () $width = DllStructGetData($Reslt, "width") $height = DllStructGetData($Reslt, "height") $stride = DllStructGetData($Reslt, "stride") $format = DllStructGetData($Reslt, "format") $Scan0 = DllStructGetData($Reslt, "Scan0") Dim $aArray[$width][$height] For $i = 0 To $iW - 1 For $j = 0 To $iH - 1 $v_Buffer = DllStructCreate("dword", $Scan0 + ($j * $stride) + ($i * 4)) $aArray[$i][$j] = Hex(DllStructGetData($v_Buffer, 1), 8) Next Next _GDIPlus_BitmapUnlockBits($hImage, $Reslt) _GDIPlus_ImageDispose($hImage) Return EndFunc ;==&gt;_FileImageToArray ;Convert pixel information array to Image Func _FileArrayToImage($filename, $aArray) Local $iW = UBound($aArray, 1), $iH = UBound($aArray, 2), $sResult = "" Local $hBMP, $hImage1, $Reslt, $width, $height, $stride, $format, $Scan0 Local $sResult, $v_BufferA Local $i, $j $hBMP = _WinAPI_CreateBitmap($iW, $iH, 1, 32) $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) $Reslt = _GDIPlus_BitmapLockBits($hImage1, 0, 0, $iW, $iH, $GDIP_ILMWRITE, $GDIP_PXF32ARGB) ;Get the returned values of _GDIPlus_BitmapLockBits () $width = DllStructGetData($Reslt, "width") $height = DllStructGetData($Reslt, "height") $stride = DllStructGetData($Reslt, "stride") $format = DllStructGetData($Reslt, "format") $Scan0 = DllStructGetData($Reslt, "Scan0") $v_BufferA = DllStructCreate("DWORD[" &amp; $height * $width &amp; "]", $Scan0) For $j = 0 To $height - 1 For $i = 0 To $width - 1 DllStructSetData($v_BufferA, 1, Execute("0x" &amp; $aArray[$i][$j]), ($j * $width) + $i + 1) ; "+1" - base 1. Next Next _GDIPlus_BitmapUnlockBits($hImage1, $Reslt) _GDIPlus_ImageSaveToFile($hImage1, $filename) _GDIPlus_ImageDispose($hImage1) _WinAPI_DeleteObject($hBMP) Return EndFunc ;==&gt;_FileArrayToImage It gives me an invalid subscript error where as this code works perfectly Error Code C:Documents and SettingsOwner.HOMEMy DocumentsAugmented Reality ResearchPattern RecognitionNeural Network WORKINGpre-alpha 1.au3 (48) : ==> Array variable subscript badly formatted.: Dim $aArray[$width][$height] Dim $aArray[^ ERROR >Exit code: 1 Time: 2. #include <gdiplus.au3> #include <array.au3> #include <winapi.au3> $file=FileOpenDialog("Choose Your Image", @WorkingDir , "JPG (*.jpg)") Opt("MustDeclareVars", 0) _GDIPlus_Startup() Dim $pixelarray Local $file_in = $file ; "image1-before.jpg" ; Local $file_out ="test.jpg"; "image1-after.jpg" $save=FileOpen("information.txt",1) _FileImageToArray($file_in, $pixelarray) $x_size=UBound($pixelarray,1) $y_size=UBound($pixelarray,2) $x_size-=1 $y_size-=1 for $x=1 to $x_size for $y=1 to $y_size FileWrite($save,$pixelarray[$x][$y]) Next Next FileClose($save) FileCLose($file) ;FUNCTIONS ; code by Malkey: thanks man! Func _FileImageToArray($filename, ByRef $aArray) Local $Reslt, $stride, $format, $Scan0, $iW, $iH, $hImage Local $v_Buffer, $width, $height Local $i, $j $hImage = _GDIPlus_ImageLoadFromFile($filename) $iW = _GDIPlus_ImageGetWidth($hImage) $iH = _GDIPlus_ImageGetHeight($hImage) $Reslt = _GDIPlus_BitmapLockBits($hImage, 0, 0, $iW, $iH, $GDIP_ILMREAD, $GDIP_PXF32ARGB) ;Get the returned values of _GDIPlus_BitmapLockBits () $width = DllStructGetData($Reslt, "width") $height = DllStructGetData($Reslt, "height") $stride = DllStructGetData($Reslt, "stride") $format = DllStructGetData($Reslt, "format") $Scan0 = DllStructGetData($Reslt, "Scan0") Dim $aArray[$width][$height] For $i = 0 To $iW - 1 For $j = 0 To $iH - 1 $v_Buffer = DllStructCreate("dword", $Scan0 + ($j * $stride) + ($i * 4)) $aArray[$i][$j] = Hex(DllStructGetData($v_Buffer, 1), 8) Next Next _GDIPlus_BitmapUnlockBits($hImage, $Reslt) _GDIPlus_ImageDispose($hImage) Return EndFunc ;==&gt;_FileImageToArray ; code by Malkey: thanks again ;) Func _FileArrayToImage($filename, $aArray) Local $iW = UBound($aArray, 1), $iH = UBound($aArray, 2), $sResult = "" Local $hBMP, $hImage1, $Reslt, $width, $height, $stride, $format, $Scan0 Local $sResult, $v_BufferA Local $i, $j $hBMP = _WinAPI_CreateBitmap($iW, $iH, 1, 32) $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) $Reslt = _GDIPlus_BitmapLockBits($hImage1, 0, 0, $iW, $iH, $GDIP_ILMWRITE, $GDIP_PXF32ARGB) ;Get the returned values of _GDIPlus_BitmapLockBits () $width = DllStructGetData($Reslt, "width") $height = DllStructGetData($Reslt, "height") $stride = DllStructGetData($Reslt, "stride") $format = DllStructGetData($Reslt, "format") $Scan0 = DllStructGetData($Reslt, "Scan0") $v_BufferA = DllStructCreate("DWORD[" &amp; $height * $width &amp; "]", $Scan0) For $j = 0 To $height - 1 For $i = 0 To $width - 1 DllStructSetData($v_BufferA, 1, Execute("0x" &amp; $aArray[$i][$j]), ($j * $width) + $i + 1) ; "+1" - base 1. Next Next _GDIPlus_BitmapUnlockBits($hImage1, $Reslt) _GDIPlus_ImageSaveToFile($hImage1, $filename) _GDIPlus_ImageDispose($hImage1) _WinAPI_DeleteObject($hBMP) Return EndFunc ;==&gt;_FileArrayToImage I can't seem to figure out my mistake Any Ideas?
×
×
  • Create New...