Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php+gd]jak znalesc 2 slowa ?, szukanie 2 takich samych slow na obrazku
kriqs
post
Post #1





Grupa: Zarejestrowani
Postów: 148
Pomógł: 0
Dołączył: 31.05.2006

Ostrzeżenie: (0%)
-----


witam

to jest obrazek wyjsciowy:
http://img90.imageshack.us/my.php?image=recruiteron6.jpg

teraz jak znalesc x i y slowa ktore sie powtarza (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)


narazie malo mam:
  1. <?
  2. function getcolor( $img , $x , $y )
  3. {
  4. $rgb = imagecolorat($img , $x, $y);
  5. $c['r'] = ($rgb >> 16) & 0xFF;
  6. $c['g'] = ($rgb >> 8) & 0xFF;
  7. $c['b'] = $rgb & 0xFF;
  8.  
  9.  return $c;
  10.  }
  11.  
  12.  
  13.  
  14. function filtr( $img , $w , $h )
  15. {
  16. $im = imagecreate($w , $h );
  17. $color = imagecolorallocate($im, 255,255,255);
  18. $color2 = imagecolorallocate($im, 0,0,);
  19.  
  20. //var_dump( $height );
  21.  
  22.  
  23.  
  24. for ( $y = 0 ; $y <= $h ; $y ++ )
  25. {
  26. for ( $x = 0 ; $x <= $w ; $x ++ )
  27. {
  28. $c = getcolor( $img , $x , $y );
  29. $c2 = getcolor( $img , $x , $y+);
  30. $c3 = getcolor( $img , $x , $y+);
  31. $c4 = getcolor( $img , $x-, $y );
  32. $c5 = getcolor( $img , $x-, $y );
  33.  
  34. if ( $c['r'] > 70 && ($c2['r'] > 70 || $c3['r'] > 70) && ($c4['r'] > 70 || $c5['r'] > 70) )
  35. {
  36. //var_dump( $c );
  37. imagesetpixel($im,$x,$y, $color2);
  38. }
  39. }
  40. }
  41.  
  42. return $im;
  43.  
  44. }
  45.  
  46.  
  47.  
  48. $img = imagecreatefromjpeg( 'r.jpg' );
  49. list($width, $height, $type, $attr) = getimagesize('r.jpg');
  50.  
  51.  
  52. $im = filtr( $img , $width , $height );
  53. //$im = filtr2( $im , $width , $height );
  54.  
  55.  
  56. header("Content-type: image/png");
  57. imagepng($im );
  58. imagedestroy($im);
  59. ?>

http://img132.imageshack.us/my.php?image=pomocya8.jpg

ktos wie jak to rozkminic (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 26.09.2025 - 10:42