OCRudoku  v1.0
Resolve word grid with ease
Loading...
Searching...
No Matches
Spliting.h File Reference
#include <SDL2/SDL.h>
Include dependency graph for Spliting.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pixel_cluster
 

Functions

void spilt_grid_vertical (SDL_Surface *surface, SDL_Rect rect)
 
int * get_grid_vertical_split (SDL_Surface *surface, SDL_Rect rect, int *nb_splits)
 Calculates the vertical split positions in a given SDL surface.
 
int * get_grid_horizontal_split (SDL_Surface *surface, SDL_Rect rect, int *nb_splits)
 Calculates the horizontal split positions in a given SDL surface.
 
SDL_Rect ** get_grid_split (SDL_Surface *surface, SDL_Rect rect, int *first_dim, int *second_dim)
 Splits a given SDL surface into a grid of rectangles.
 
SDL_Rect ** get_word_list_split (SDL_Surface *surface, SDL_Rect rect, int *word_nb)
 Splits a given SDL surface into a list of words.
 
void export_split_word_list (SDL_Surface *surface, SDL_Rect rect, const char *save_dir)
 Exports the split word list of a given SDL surface to a specified directory.
 
void export_split_grid (SDL_Surface *surface, SDL_Rect rect, const char *save_dir)
 Exports the split grid of a given SDL surface to a specified directory.
 
void export_word_cluster (SDL_Surface *surface, pixel_cluster *clusters, size_t cluster_nb, size_t word_nb, char *word_dir)
 
void export_grid_cluster (SDL_Surface *surface, pixel_cluster *clusters, size_t cluster_nb, char *grid_dir, int *sx, int *sy)
 
pixel_cluster ** get_main_linkages (SDL_Surface *surface, size_t *nb_linkages, size_t **linkages_len)
 
void export_main_linkages (SDL_Surface *surface, pixel_cluster **linkages, size_t nb_linkages, size_t *linkages_len, char *res_dir, int *sx, int *sy)
 
SDL_Rect get_grid_rect (pixel_cluster *linkages, size_t nb_linkages)
 
size_t get_grid_cluster (size_t nb_linkages, size_t *linkage_len)
 

Function Documentation

◆ export_grid_cluster()

void export_grid_cluster ( SDL_Surface * surface,
pixel_cluster * clusters,
size_t cluster_nb,
char * grid_dir,
int * sx,
int * sy )

◆ export_main_linkages()

void export_main_linkages ( SDL_Surface * surface,
pixel_cluster ** linkages,
size_t nb_linkages,
size_t * linkages_len,
char * res_dir,
int * sx,
int * sy )

◆ export_split_grid()

void export_split_grid ( SDL_Surface * surface,
SDL_Rect rect,
const char * save_dir )

Exports the split grid of a given SDL surface to a specified directory.

This function splits the specified rectangular area of the SDL surface into a grid based on the brightness threshold defined by split_margin. It then exports each split area as a PNG image to the specified directory.

Parameters
surfaceThe SDL_Surface to analyze and split.
rectThe SDL_Rect defining the area of the surface to analyze and split.
save_dirThe directory where the split images will be saved.

◆ export_split_word_list()

void export_split_word_list ( SDL_Surface * surface,
SDL_Rect rect,
const char * save_dir )

Exports the split word list of a given SDL surface to a specified directory.

This function splits the specified rectangular area of the SDL surface into a list of words based on the brightness threshold defined by split_margin. It then exports each split word as a PNG image to the specified directory.

Parameters
surfaceThe SDL_Surface to analyze and split.
rectThe SDL_Rect defining the area of the surface to analyze and split.
save_dirThe directory where the split images will be saved.

◆ export_word_cluster()

void export_word_cluster ( SDL_Surface * surface,
pixel_cluster * clusters,
size_t cluster_nb,
size_t word_nb,
char * word_dir )

◆ get_grid_cluster()

size_t get_grid_cluster ( size_t nb_linkages,
size_t * linkage_len )

◆ get_grid_horizontal_split()

int * get_grid_horizontal_split ( SDL_Surface * surface,
SDL_Rect rect,
int * nb_splits )

Calculates the horizontal split positions in a given SDL surface.

This function analyzes the brightness of pixels in the specified rectangular area of the SDL surface and determines the positions of horizontal splits based on the brightness threshold defined by split_margin.

Parameters
surfaceThe SDL_Surface to analyze.
rectThe SDL_Rect defining the area of the surface to analyze.
nb_splitsPointer to an integer where the number of splits will be stored.
Returns
An array of integers representing the horizontal split positions.

◆ get_grid_rect()

SDL_Rect get_grid_rect ( pixel_cluster * linkages,
size_t nb_linkages )

◆ get_grid_split()

SDL_Rect ** get_grid_split ( SDL_Surface * surface,
SDL_Rect rect,
int * first_dim,
int * second_dim )

Splits a given SDL surface into a grid of rectangles.

This function analyzes the brightness of pixels in the specified rectangular area of the SDL surface and determines the positions of vertical and horizontal splits based on the brightness threshold defined by split_margin. It then creates a grid of SDL_Rect structures representing the split areas.

Parameters
surfaceThe SDL_Surface to analyze.
rectThe SDL_Rect defining the area of the surface to analyze.
first_dimPointer to an integer where the number of horizontal splits will be stored.
second_dimPointer to an integer where the number of vertical splits will be stored.
Returns
A 2D array of SDL_Rect structures representing the split grid.

◆ get_grid_vertical_split()

int * get_grid_vertical_split ( SDL_Surface * surface,
SDL_Rect rect,
int * nb_splits )

Calculates the vertical split positions in a given SDL surface.

This function analyzes the brightness of pixels in the specified rectangular area of the SDL surface and determines the positions of vertical splits based on the brightness threshold defined by split_margin.

Parameters
surfaceThe SDL_Surface to analyze.
rectThe SDL_Rect defining the area of the surface to analyze.
nb_splitsPointer to an integer where the number of splits will be stored.
Returns
An array of integers representing the vertical split positions.

◆ get_main_linkages()

pixel_cluster ** get_main_linkages ( SDL_Surface * surface,
size_t * nb_linkages,
size_t ** linkages_len )

◆ get_word_list_split()

SDL_Rect ** get_word_list_split ( SDL_Surface * surface,
SDL_Rect rect,
int * word_nb )

Splits a given SDL surface into a list of words.

This function analyzes the brightness of pixels in the specified rectangular area of the SDL surface and determines the positions of vertical splits based on the brightness threshold defined by split_margin. It then creates a list of SDL_Rect structures representing the split words.

Parameters
surfaceThe SDL_Surface to analyze.
rectThe SDL_Rect defining the area of the surface to analyze.
word_nbPointer to an integer where the number of words will be stored.
Returns
A 2D array of SDL_Rect structures representing the split words.

◆ spilt_grid_vertical()

void spilt_grid_vertical ( SDL_Surface * surface,
SDL_Rect rect )