Hello,<br><br><br>Just to introduce, I am a student in internship in French Guyana.I'm French and I have not wrote in English thing's for a wile so sorry for my bad English.<br><br>I'm a beginning in GDAL in c (for the moment) with Ubuntu<br>
<br>I am trying to make a program extracting target from pictures in tif(geotiff) for example Size X: 17553 // Size Y: 15226 ..<br><br>To detect target,I used a algorithm which get the mean of a windows 5x5 and compare the energies off the windows with the central pixel.<br>
<br>I wants to improve my software in order to be faster because for the moment it spend 200s<br><br>To run through every pixel I used the process below<br><br> hScanBloc1 = (GByte *) CPLMalloc(sizeof(GByte)*5);<br>
hScanBlocOut = (GByte *) CPLMalloc(sizeof(GByte)*1);<br>
<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote"><div style="margin-left: 80px;">for( iLine = 0; iLine < nYSize-5; iLine++)<br> {<br>
for( iCol = 0; iCol < nXSize-5; iCol++ )<br> {<br><br> //Get line from the windows<br> eErr1 = GDALRasterIO( hBand1, GF_Read, iCol, iLine , 5, 1, hScanBloc1, 5,1, GDT_Byte, 1, 1); <br>
eErr2 = GDALRasterIO( hBand1, GF_Read, iCol, (iLine+1), 5, 1, hScanBloc2, 5,1, GDT_Byte, 1, 1);<br> eErr3 = GDALRasterIO( hBand1, GF_Read, iCol, (iLine+2), 5, 1, hScanBloc3, 5,1, GDT_Byte, 1, 1);<br>
eErr4 = GDALRasterIO( hBand1, GF_Read, iCol, (iLine+3), 5, 1, hScanBloc4, 5,1, GDT_Byte, 1, 1);<br> eErr5 = GDALRasterIO( hBand1, GF_Read, iCol, (iLine+4), 5, 1, hScanBloc5, 5,1, GDT_Byte, 1, 1);<br>
<br> //Get all value in the Windows <br> for(iWindows=0;iWindows<5;iWindows++)<br> {<br> Value=Value+hScanBloc1[iWindows];<br> Value=Value+hScanBloc2[iWindows];<br>
Value=Value+hScanBloc3[iWindows];<br> Value=Value+hScanBloc4[iWindows];<br> Value=Value+hScanBloc5[iWindows];<br> }</div></blockquote><div><br> </div>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote"> hScanBlocOut[0]=FinalValue;<br> eErr = GDALRasterIO( hBandOut1, GF_Write,iCol,iLine ,1,1 , hScanBlocOut, 1,1, GDT_Byte, 1, 1);<br>
<br><br> <br> CPLErr eErr;<br> eErr = GDALRasterIO( hBandOut1, GF_Write,iCol,iLine ,1,1 , hScanBlocOut, 1,1, GDT_Byte, 1, 1);<br></blockquote>
<br><br>I read on help and <i>gdal.h</i> File Reference that it could exist faster way so I have some ideas like : <br> Merging the code to c++<br> Using Read/Write block <br> Use Tile/Block to accelerate the process<br>
Use the Warpprocess to calulate windows mean's faster <br><br>I hope you understand my request and it was clear<br> <br>Thanks for advance<br><br>Best Regards<br><br>Nicolas<br clear="all"><br>-- <br>
Nicolas Degarne<br> 76 rue de Nancy<br> 94170 Le Perreux<br>06 84 93 80 94<br><a href="mailto:nicolas.degarne@gmail.com" target="_blank">nicolas.degarne@gmail.com</a><br>
<br>