Skip to content

Scilab IPCV

Image Processing and Computer Vision Module for Scilab 6.0!

  • Installation
    • Installation IPCV v1.1
    • Installation IPCV v1.2
  • Getting Started
  • Subscribe for FREE
  • Support Us
  • Courses
    • Artificial Intelligence with Scilab
    • Image Processing with Scilab

Generating Tag Cloud

October 8, 2017

We always see tag cloud or text cloud from the web, tags could be single words or more, and the counts of each tag appeared is shown with font size or color.

This tutorial does not need IPCV or other extra modules to be installed, it could be done by simply using Scilab. However, the output image could be imported into Scilab with IPCV module.

First, we will show a few simple techniques to plot strings or texts on Scilab figure, followed by using a pre-written library to generate more complicated tag cloud by giving the vector of string with the corresponding frequencies of each string.

Let’s start with a simple example:

tag_text = ['Hello';'World'];
tag_count = [6;4];
plot2d([0, 1], [0, 1], 0);
xstring(0.1, 0.9, tag_text(1));
gce().font_size = tag_count(1);
xstring(0.3, 0.9, tag_text(2));
gce().font_size = tag_count(2);

tag_text = ['Hello';'World']; tag_count = [6;4]; plot2d([0, 1], [0, 1], 0); xstring(0.1, 0.9, tag_text(1)); gce().font_size = tag_count(1); xstring(0.3, 0.9, tag_text(2)); gce().font_size = tag_count(2);

This will generate the image as below:

We could further working on the strings properties such as the color by modifying the entities’ properties. For example, changing the color of the word “world” could be done by following line:

gce().font_color = 2;

gce().font_color = 2;

gives following result:

In order to build a nicer tag cloud, we created a function to automate the process. Download the function and sample data from this link , unzip it and change the current folder to the location in Scilab console to use the library.

load generate_textcloud.bin;
load tagsdata.sod;
generate_textcloud(tag_text,tag_count);

load generate_textcloud.bin; load tagsdata.sod; generate_textcloud(tag_text,tag_count);

The following image would be generated.

The function “generate_textcloud” could take more input parameters to make the text cloud looks better, the full calling syntax is:

generate_textcloud(tag_text,tag_count,x_spacing,y_spacing,sz_inc,colormap,isbold)

where:

tag_text : A (m x 1) string matrix of the text to generate text cloud
tag_count : A (m x 1) double matrix correspond to the counts of the text appearance
x_spacing : Spacing between words in a row, in the range of 0.01 – 0.2
y_spacing : Spacing between words in col, in the range of 0.01 – 0.2
sz_inc : Size to increase or decrese for all words, in the range of 1 – 10
colormap : Colormap could be in 3 format, [r g b], color string such as “blue”, and standard colormap such as hsvcolormap(64) etc.
isbold : To plot the text in bold, %t or %f

The default parameters are:

generate_textcloud(tag_text,tag_count,0.02,0.1,0,’blue’,%t)

Some examples of using different parameters:

1. Generating text cloud in red color

generate_textcloud(tag_text,tag_count,0.02,0.1,0,[1 0 0],%t);

generate_textcloud(tag_text,tag_count,0.02,0.1,0,[1 0 0],%t);

Result:

2. Generating text cloud in colormap

generate_textcloud(tag_text,tag_count,0.02,0.1,0,hsvcolormap(6),%t);

generate_textcloud(tag_text,tag_count,0.02,0.1,0,hsvcolormap(6),%t);

Result:

3. Generating text cloud with more x spacing

generate_textcloud(tag_text,tag_count,0.1,0.1,0,hsvcolormap(6),%t);

generate_textcloud(tag_text,tag_count,0.1,0.1,0,hsvcolormap(6),%t);

Result:

4. Generating text cloud with bigger font

generate_textcloud(tag_text,tag_count,0.02,0.1,1,hsvcolormap(6),%t);

generate_textcloud(tag_text,tag_count,0.02,0.1,1,hsvcolormap(6),%t);

Result:

The image could then be saved by clicking on the menu item File –> Export to, and give a filename for the exported image.

If you need to read the image into Scilab, use IPCV module.

Share on Facebook Share
Share on TwitterTweet
Share on Google Plus Share
Share on LinkedIn Share
Send email Mail

Post navigation

Previous Post:

Puzzling Deep Learning Network

Next Post:

Image Stitching (New Feature in v1.2)

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Support Us

By Buying Us Coffee :)

Topics

  • Computer Vision & Hardware Interfaces
  • Feature Detection, Description and Matching
  • Image Fusion
  • Image Linear Filtering
  • Image Reading, Display and Exploration
  • Image Stitching
  • Image Types and Color Space Conversions
  • Installation
  • Introduction
  • Machine Learning & Deep Learning
  • Morphological Operations
  • Object Detection
  • Object Recognition
  • Spatial Transformations
  • Super Resolution
  • Uncategorized
  • Utilities

Recent Posts

  • Deep Learning Inference with Scilab IPCV – Lenet5 with MNIST Visualization
  • Deep Learning Inference with Scilab IPCV – Pre-Trained Lenet5 with MNIST
  • What’s New in IPCV 2.0
  • Computer Vision – Live Video from Webcam
  • Drawing Shapes by Overwriting Pixel Value




Tags

Affine affine transform Clarifai cnn computer vision convert to binary image convolution convolutional neural network correlation covert rgb to gray deep learning dnn feature detection feature extraction Google Vision API graphic user interface gui image 3d plot image filtering image matching image measurement image processing image reading image resize image rotation image scaling image shearing image stitching image transform installation introduction linear regression machine learning map mapping morphology object detection object removal panoramic perspective perspective transform scilab spatial transform sudoku translation
© 2021 Scilab IPCV