Programming Articles - Page 2656 of 3366

Working with Images in Python?

George John
Updated on 30-Jul-2019 22:30:26

3K+ Views

One of the most popular and considered as default library of python for image processing is Pillow. Pillow is an updated version of the Python Image Library or PIL and supports a range of simple and advanced image manipulation functionality. It is also the basis for simple image support in other Python libraries such as sciPy and Matplotlib.Installing PillowBefore we start, we need python and pillow. Incase of Linux, pillow will probably be there already, since major flavour of linux including Fedora, Debian/Ubuntu and ArchLinux includes Pillow in packages that previously contained PIL.The easiest way to install it is to ... Read More

Short Circuiting Techniques in Python?

Chandu yadav
Updated on 30-Jul-2019 22:30:26

2K+ Views

A common mistake for people new to programming is a misunderstanding of the way that boolean operators works, which stems from the way the python interpreter reads these expressions. For example, after initially learning about "and " and "or" statements, one might assume that the expression X = (‘x’ or ‘y’) would check to see if the variable X was equivalent to one of the strings ‘a’ or ‘b’. This is not so. To understand, what i’m trying to say, start an interactive session with the interpreter and enter the following expressions:>>> 'x' == ('x' or 'y') True >>> 'y' ... Read More

NZEC error in Python?

Arjun Thakur
Updated on 30-Jul-2019 22:30:26

908 Views

NZEC is non-zero exit code.Exit codes are codes (number) return by running program to operating system upon either their successfully termination (Exit code 0) or failed termination due to error (Non zero exit code).As python or Java programming language supports exception handling, we can use exception handling using try-catch blocks to catch this error.NZEC error is a runtime error and occurs mostly when negative array index is accesed or the program which we have written is utilizing more memory space than the allocated memory for our program to run.In python Exception class is the super class of all the errors ... Read More

Line detection in python with OpenCV?

Ankith Reddy
Updated on 30-Jul-2019 22:30:26

3K+ Views

In this post, we are going to learn, how to detect lines in an image, with the help of a technique called Hough transform.Hough transform?Hough transform is a feature extraction method to detect any simple shape, if you can represent that shape in mathematical form. It somehow manage to detect the shape even if it is broken or distorted a little bit. We will see how it works for a line.A “simple” shape is one that can be represented by only a few parameters. For example, a line can be represented by two parameters only (slope, intercept) and a circle ... Read More

Packaging and Publishing Python code?

George John
Updated on 30-Jul-2019 22:30:26

278 Views

Python provides a very simple way of creating or publishing packages.Package management in Python is available through different tools−Pip- It remains one of the preferred choices because it virtually eliminates any manual installs and updates of software packages to operating systems. It manages full lists of packages and their corresponding version numbers, which fosters precise duplication of entire package groups in a distinct, separate environment.Python Package Index (PPI) is a public package repository of user-submitted packages that can be installed using pip .i.e. pip install package_name.Below is a step-by-step procedure on how to upload the package.Step 1: Have a package ... Read More

Mouse and keyboard automation using Python?

Chandu yadav
Updated on 30-Jul-2019 22:30:26

2K+ Views

In this section, we’ll try to automate the movements of mouse and keyboard using pyautogui module in python.Pyautogui is a library that allows you to control the mouse and keyboard to do various things.It  is a cross-platform GUI automation Python module for human beings.As it is a third party library, we need to install it.pip install pyautoguiMouseBelow is program to automate the movement of your mouse. On running your programme, you can see the mouse movement with every command. I run below command on CLI so as to capture the mouse movement. You can try with others different values too.Example>>> ... Read More

Using OpenCV in Python to Cartoonize an Image

Arjun Thakur
Updated on 31-Mar-2023 15:38:22

1K+ Views

Currently there are lots of professional cartoonizer applications available in the market but most of the them are not freeware. In order to get the basic cartoon effect, we just need the bilateral filter and some edge dectection mechanism. The bilateral filter will reduce the color palette, which is essential for the cartoon look and edge detection is to produce bold silhouettes.We are going to use openCV python library to convert an RGB color image to a cartoon image.AlgorithmFirstly apply the bilateral filter to reduce the color palette of the image.Then conver the actual image to grayscale.Now apply the median ... Read More

OpenCV Python Program to blur an image?

Ankith Reddy
Updated on 30-Jul-2019 22:30:26

630 Views

OpenCV is one of the best python package for image processing. Also like signals carry noise attached to it, images too contain different types of noise mainly from the source itself (Camera sensor). Python OpenCV package provides ways for image smoothing also called blurring. This is what we are going to do in this section. One of the common technique is using Gaussian filter (Gf) for image blurring. With this, any sharp edges in images are smoothed while minimizing too much blurring.Syntaxcv.GaussianBlur(src,  ksize,  sigmaX[,  dst[,  sigmaY[,  borderType=BORDER_DEFAULT]]] )Where−src – input imagedst – output imageksize – Gaussian kernel size[ height width]. If ksize ... Read More

Permutation and Combination in Python?

Chandu yadav
Updated on 30-Jul-2019 22:30:26

1K+ Views

In this section, we are going to learn how to find permutation and combination of a given sequence using python programming language.One of the key advantage of python over other programming language is that it comes with huge set of libraries with it.We are going to use python inbuilt package to find permutation and combinations of a given sequence.Algorithm to find the Permutation and combinationStep 1 : Import required package. First step is to import the required package, as we are going to use itertools package, so we just import it using.>>> import itertools >>>Step 2: Get all permutation & combination ... Read More

How to print Unicode character in C++?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:26

6K+ Views

To print the Unicode characters, the process is very similar to the actual printing process in C++.We can put the Unicode value with the prefix \u. Thus we can successfully print the Unicode character.Note: If the console does not support Unicode, then you cannot get the correct result. Here we have used the Linux system to solve this problem.Example#include using namespace std; int main() {    cout

Advertisements