Advertisement
Guest User

Untitled

a guest
Apr 30th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include <stdio.h>
  2. #include "captcha.h"
  3.  
  4.  
  5. double get_btm_right_density(int height, int width, int start_row, int start_column, int box_height, int box_width, int pixels[height][width]){
  6. int y = start_row+(box_height-1)*0.5, x = start_column+((box_width-1)*0.5);
  7. double density = 0, total_pixels = 0, n_black_pixels = 0;
  8. while(y >= start_row){
  9. while(x <= start_column+(box_width-1)){
  10. total_pixels ++;
  11. //printf("%d\n", width);
  12. if(pixels[y][x] == 1){
  13. n_black_pixels ++;
  14. }
  15. x++;
  16. }
  17. x = start_column+((box_width-1)*0.5);
  18. y--;
  19. }
  20. //printf("black pix = %lf, total pix = %lf \n", n_black_pixels, total_pixels);
  21. //printf("%f\n", (column_sum/n_black_pixels + 0.5)/width);
  22. return (n_black_pixels/total_pixels);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement