cpp

Overloading by return value in C++

Posted on

Here we have a method that allows us to determine return parameter type using templates and operator overloading in C++. This is something that I needed for a project that I am working on where a method call would give me the expected type based on the return type. Usage There is two way of […]

cpp

Creating Javascript accessible object from C++ / CEF

Posted on

Example with Chromium Embedded Framework (CEF) on how to create an object in C++ and make it accessible via Javascript. console.inof(api) Object {ready: true, version: "psql.0.0.1", info: Object, getVersion: function}console.inof(api) Object {ready: true, version: "psql.0.0.1", info: Object, getVersion: function} void ExtractEngineApp::OnContextCreated( CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context) {   auto info = CefV8Value::CreateObject(NULL, NULL); info->SetValue("major", […]

cpp

Calculating partial Hausdorff Distance

Posted on

  struct Point { Point(int_t _x, int_t _y) : x(_x), y (_y) {   }   int_t x; int_t y; };     typedef std::list<Point*> points_t;   double euclideanDistance(const Point& lhs,const Point& rhs) { double p1 = std::pow((float)(rhs.x – lhs.x), 2); double p2 = std::pow((float)(rhs.y – lhs.y), 2); double vd = std::sqrt(p1 + p2);   […]

cpp

Leptonica barcode generation

Posted on

Leptonica provides us with easy way to read barcodes but it does not offer a way to create them(as far as I know). Here is a leptonica function that will allow us to generate CODABAR barcode, in the feature I am planning on adding more type and more options but for now this was all […]

development

Leptonica Tutorial – Cropping

Posted on

Common use is to crop to certain area of an image, this can be quite easily accomplished with following code. BOX* box = boxCreate(x, y, w, h); PIX* dpix= pixClipRectangle(spix, box, NULL);BOX* box = boxCreate(x, y, w, h); PIX* dpix= pixClipRectangle(spix, box, NULL);

development

Leptonica Tutorial – Environment setup

Posted on

Leptonica Development with Eclipse This is the first one of few tutorials that I am writring on using Leptonica image processing library Before we start let’s give credit where the credit is due, and this is goes out to Jay W.(need link) on which this instructions are largely based on. Environment Eclipse MinGW Leptonica I […]

Uncategorized

Quicksort implementation using Linked List

Posted on

About QuickSort Wikipedia QuickSort definition. General idea revolves around partitioning a list where values less than pivot go into left list while greater than go into right list. Pivot here is the first item of the passed in list. We apply this recursively to the sublists them merge left+pivot+right. CPP Code First of all not […]