Posts

Showing posts from March, 2018

C# Tutorial for Beginner : Chapter 10 Array 2-Dimension

Image
Introduction An array monitors various snippets of data in single line order, a one-dimensional record list. Notwithstanding, the information related with specific frameworks (an advanced picture, a tabletop game, and so forth.) lives in two measurements. To picture this information, we require a multi-dimensional information structure, that is, a multi-dimensional array. A two-dimensional array is extremely simply an array of arrays (a three-dimensional array is an array of arrays of arrays). The accompanying declaration makes a two-dimensional array of four lines and two segments. float[,] numbers = new float[3, 20]; Example Explanation  To make you more understand to this 2-dimension array, follow this example. Given a 2 dimensional array with size 6x6 as shown below. This array is illustrated with rows and columns. The first dimension is like a line and a second dimension is like a column Array 6 x 6 We focus on the position of the blue array Focusing Ar...

Quantization of Image Data Implementation in C#

Image
Introduction  This time we will share how to create an application to change the threshold value from black-and-white to the average value of the gray degree of all points and add textBox so that the user can change the threshold value according to the user's wishes. Besides that we also will add textBox to input quantization value. So the user can change the quantization as desired. Application Screenshoot A black-and-white image is an image that contains only black or white. Black is valued 0 and white is valued 255. To make the picture in black and white, the original color will be gray degree and each pixel will be compared with its threshold value. Normally, the black-and-white degree image has a 128 threshold value, so if the color value is less than 128, then the color is changed to 0 (black), and which is greater than or equal to 128 will be converted to 255 (white). Consider the example image below. Figure 1. The original image is predominantly dark When vi...

Image Processing : Display Layer RGB and Grayscale in C#

Image
This time we will show you how to create apps to display layer red, green, blue, grayscale red, greyscale green, greyscale blue, and sepia. Application Screenshoot Listings Program using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Image { public partial class Form1 : Form { Bitmap originalBitmap, objBitmapRed, objBitmapGreyscaleRed ; Bitmap objBitmapGreen, objBitmapGreyscaleGreen ; Bitmap objBitmapBlue, objBitmapGreyscaleBlue, objBitmapSepia; public Form1() { InitializeComponent(); } private void loadButton_Click(object sender, EventArgs e) { DialogResult d = openFileDialog.ShowDialog(); if (d == DialogResult.OK) { originalBitmap = new Bitmap(openFileDialog.FileName); ...

Basic Image Processing Implementation to Read Pixel in C#

Image
In this post we will share how to create an application to read data every pixel in an image. The implementation is application can read and copy images, rotate images by 90 o   and 180 o , and flipped vertically and horizontally. How this application look like In the application there are six buttons that have different functions. The Load button is used to read the image data in the directory. Here is a function on the Load button. private void loadBtn_Click(object sender, EventArgs e) { DialogResult d = openFileDialog.ShowDialog(); if(d == DialogResult.OK) { objBitmapInit = new Bitmap(openFileDialog.FileName); pictureBox1.Image = objBitmapInit; } } In code above there is a DialogResult object to hold the image file from the dialog of the OpenFileDialog object. When the DialogResult object successfully holds the image file, the image file will be inserted in the Bitmap object based on the file name. After that the Bitmap object will...

Binary to Decimal Conversion and Vice Versa with Illustration and Example

Image
Introduction Radix is a Latin word for "root". Root can be considered a synonym for base in the arithmetical sense. In mathematical numeral systems, the radix or base is the quantity of one of a kind digits, including zero, used to render to numbers in a positional numeral system. For instance, in the base-10 or decimal number framework (the most well-known framework being used today), there is an aggregate of 10 digits utilized (0,1,2,3,4,5,6,7,8,9), thusly, its radix is 10. In the base-2 or binary number framework (utilized inside by almost all PCs), there are two numbers utilized (0, 1), so its radix is two. Different words that are synonymous with radix are base and root, in a arithmetic sense.  In any standard positional numeral system, a number is traditionally composed as (x) y with x as the series of digits and y as its base, in spite of the fact that for base ten the subscript is normally expected (and discarded, together with the match of enclosures), a...

C# Tutorial for Beginner : Chapter 9 Recursion

Image
Introduction A recursive function is a function which either calls itself or is in a potential loop of function calls. This empowers the function to rehash itself a few times, yielding the outcome and the finish of every iteration. In modern programming languages, if a program enables you to call a function inside a similar function, at that point it is known as a recursive call of the function. Why I mention modern programming language ? It because some old languages do not support recursive. I don't know COBOL does (it unquestionably didn't at one time), however I can't exactly envision anyone minding much either. Fortran 77 does not allow recursion but it is allowed since Fortran 90, yet requires that you utilize the recursive keyword to reveal to it that a subroutine is recursive. PL/I was essentially the same - recursion was bolstered, however you needed to unequivocally let it know what procedures were recursive. I question there are numerous more than that how...

C# Tutorial for Beginner : Chapter 8 Dictionary

Image
Introduction Dictionary in C# is same as language dictionary. Each language dictionary is a collection of words and their definitions, regularly recorded one after another in order in at least one particular dialects. Similarly, the Dictionary in C# is a collection of Keys and Values, where key resembles word and value resembles definition. The key is indistinguishable in a key-value match and it can have at most one value in the dictionary, however a value can be related with a wide range of keys. This class is characterized in the System.Collections.Generic namespace, so you should import or utilizing System.Collections.Generic namespace. Dictionary<TKey, TValue> is a generic collection where TKey means the type of key and TValue is the sort of value. Perhaps you might heard other collection about "List" or "Hashtable" before. Is there the difference between  them ? Of course there is, although "List", "Hashtable", "Dictionary...

C# Tutorial for Beginner : Chapter 7 Single-Dimension Array

Image
Introduction An array keeps a settled size consecutive group of elements of a similar type. An array is utilized to keep a group of information, however it is regularly more valuable to think about an array as an accumulation of variables of a similar type put away at bordering memory areas. Rather than pronouncing singular variable which somehow make your code become messy, for example, value0, value1, ..., until value100, you proclaim one array variable, for example, numbers and utilize value[0], value[1], and ..., value[100] to speak to singular factors. A particular element in an array is gotten to by a record. All arrays comprise of bordering memory areas. The most minimal deliver relates to the first element and the most noteworthy deliver to the last element.Okay, in this post, I will explain single-dimension array. If there single then there must be double or more, right ? Of course there more other type than single-dimension. I will discuss the other in future post. Now,...