Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "captcha.h"
- 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]){
- int y = start_row+(box_height-1)*0.5, x = start_column+((box_width-1)*0.5);
- double density = 0, total_pixels = 0, n_black_pixels = 0;
- while(y >= start_row){
- while(x <= start_column+(box_width-1)){
- total_pixels ++;
- //printf("%d\n", width);
- if(pixels[y][x] == 1){
- n_black_pixels ++;
- }
- x++;
- }
- x = start_column+((box_width-1)*0.5);
- y--;
- }
- //printf("black pix = %lf, total pix = %lf \n", n_black_pixels, total_pixels);
- //printf("%f\n", (column_sum/n_black_pixels + 0.5)/width);
- return (n_black_pixels/total_pixels);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement