cpp

Accessing data of leptonica PIX data

Posted on

This is mainly as a reference   /** * Get Pixel value at given point */ l_uint32 pixAtGet(PIX* pix, int_t x, int_t y) { l_int32 wpl = pixGetWpl(pix); l_uint32* data = pixGetData(pix); l_uint32* line = data + y * wpl; l_uint32 value = GET_DATA_BYTE(line, x); return value; } /** * Get Pixel value at given […]

cpp

Tokenizing/splitting string in c++

Posted on

This method uses strtok to tokeninze our string given a specific delimeter, results of that are put into supplied vector. There are few other ways we can do this but this one is straight forward. #include <iostream> #include <string> #include <string.h>   #include <memory> #include <stdlib.h> #include <stdio.h> #include <list> #include <vector>   using namespace […]