Giter VIP home page Giter VIP logo

banglatext2image's Introduction

BanglaText2Image

Convert any bangla text to image. This tool will help to generate synthetic data for bangla OCR training

Example data sample

Text Image
ঙ্গি
ষ্টি
দৃষ্টিভঙ্গি কেমন হতে পারে

Dependency

sudo apt install default-jre
sudo apt install default-jdk

Project structure

├── corpus
│   └── bn-data-map.txt # contain the text which need to convert to image
├── data  # unique class based data
│   ├── 0
│   ├── 1
│   ├── 2
│   ├── 3
│   └── 4
├── fonts # bangla fonts
│   └── Siyamrupali.ttf
├── README.md
└── src
    ├── BanglaTextToImage.java
    └── textToImage.java

How to run

আপনি যদি ক্লাস ভিত্তিক ডাটা সেট বানাতে চান তাহলে এই স্ক্রিপ্ট বাবহারেন করতেন পারেন। যেমন আপনি একটা টেক্সট ফাইলে সব বাংলা বর্ণমালা রেখে প্রতিটা বর্ণমালাকে একটা ক্লাস ধরে ডাটা জেনারেট করতে পারেন। সেই ক্ষেত্রে প্রতিটা ক্লাস আর জন্য ফোল্ডারে data/{0..n} ডাটা জমা হবে

javac BanglaTextToImage.java
java BanglaTextToImage

Configs

Some of the config variable you may need to update based on your need

public static String BN_DATA_MAP_PATH = "../corpus/bn-data-map.txt";
// you can put multiple fonts here
public static String FONTS_DIR = "../fonts";
// shere your images will be saved
public static String DATA_SAVED_DIR = "../data";

// set font size and font color
public static int[] FONT_SIZES = {30, 40, 50};
public static int[] BG_COLOR   = {255, 230, 205};
	
public static int IMAGE_NAME_COUNTER = 1;
public static int NUMBER_OF_CLASS = 11; // number of class you have
// 5 line will be taken from `bn-data-map.txt`
public static int CHUNK_TO_TAKE = 5; // CHUNK_TO_TAKE must be <= chunks.lenght()

Sentence to image

Convert bangla sentece to Image

এই স্ক্রিপ্টে যেকোনো বাংলা লেখা দিলে সেটাকে ইমেজে কনভার্ট করে দিবে।

javac TextToImage.java
java TextToImage

This will output an image like

banglatext2image's People

Contributors

mehadi92 avatar menon92 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.