Found 26504 Articles for Server Side Programming

Applying Gaussian Blur to an image using the Pillow library

Prasad Naik
Updated on 18-Mar-2021 07:00:17

922 Views

In this program, we will blur an image using a Gaussian filter. The ImageFilter class in the pillow library contains a function called GaussianBlur() which helps to apply the gaussian blur filter. It takes only one parameter that is blur radius.Original ImageAlgorithmStep 1: Import Image and ImageFilter from Pillow. Step 2: Open the image. Step 3: Call the gaussianblur() method and specify the radius Step 4: Display the output.Example Codefrom PIL import Image, ImageFilter im = Image.open('image_test.jpg') im1 = im.filter(ImageFilter.GaussianBlur(radius = 9)) im1.show()Output

Applying MedianFilter on an image using Pillow library

Prasad Naik
Updated on 18-Mar-2021 06:59:40

996 Views

In this program, we will apply a minimum filter on an image using the pillow library. In median filtering, the value of each pixel in a selected window of the image is replaced by the median of that window. The filter function is used to apply different filters using the pillow library.Original ImageAlgorithmStep 1: Import Image from Pillow. Step 2: Open the image. Step 3: Call the filter function and specify the median filter. Step 4: Display the output.Example Codefrom PIL import Image, ImageFilter im = Image.open('testimage.jpg') im1 = im.filter(ImageFilter.MedianFilter(size = 7)) im1.show()Output

Applying ModeFilter on an image using Pillow library

Prasad Naik
Updated on 18-Mar-2021 06:57:46

271 Views

In this program, we will apply a minimum filter on an image using the pillow library. In mode filtering, the value of each pixel in a selected window of the image is replaced by the mode of that window. The filter function is used to apply different filters using the pillow library.Original ImageAlgorithmStep 1: Import Image from Pillow. Step 2: Open the image. Step 3: Call the filter function and specify modefilter. Step 4: Display the output.Example Codefrom PIL import Image, ImageFilter im = Image.open('testimage.jpg') im1 = im.filter(ImageFilter.ModeFilter(size = 7)) im1.show()Output

Applying MaxFilter on an image using Pillow library

Prasad Naik
Updated on 18-Mar-2021 06:57:21

495 Views

In this program, we will apply a minimum filter on an image using the pillow library. In maximum filtering, the value of each pixel in a selected window of the image is replaced by the maximum pixel of that window. The filter function is used to apply different filters using the pillow library.Original ImageAlgorithmStep 1: Import Image from Pillow. Step 2: Open the image. Step 3: Call the filter function and specify maxfilter. Step 4: Display the output.Example Codefrom PIL import Image, ImageFilter im = Image.open('testimage.jpg') im1 = im.filter(ImageFilter.MaxFilter(size = 7)) im1.show()Output

Applying MinFilter on an image using Pillow library

Prasad Naik
Updated on 18-Mar-2021 06:55:06

293 Views

In this program, we will apply a minimum filter on an image using the pillow library. In minimum filtering, the value of each pixel in a selected window of the image is replaced by the minimum pixel of that window. The filter function is used to apply different filters using the pillow library.Original ImageAlgorithmStep 1: Import Image from Pillow. Step 2: Open the image. Step 3: Call the filter function and specify minfilter. Step 4: Display the output.Example Codefrom PIL import Image, ImageFilter im = Image.open('testimage.jpg') im1 = im.filter(ImageFilter.MinFilter(size = 7)) im1.show()Output

Golang program to insert a new node after the Kth node (K is not in the linked list)

Rishikesh Kumar Rishi
Updated on 18-Mar-2021 06:54:51

114 Views

ExampleAdd node 15 after 50((K is not in the linked list)) value node.Approach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Iterate the given linked list.Step 4 − If node value 50 is not found, return the head without adding any node.Example Live Demopackage main import (    "fmt" ) type Node struct {    value int    next *Node } func NewNode(value int, next *Node) *Node{    var n Node    n.value = value    n.next = next    return ... Read More

Golang Program to delete the node after the Kth node (K is not in the linked list).

Rishikesh Kumar Rishi
Updated on 18-Mar-2021 06:38:28

119 Views

ExamplesDelete node after 50(K is not in the linked list) value node.Approach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Iterate the given linked list.Step 4 − If node value 50 is not found, return the head without deleting any node.Example Live Demopackage main import "fmt" type Node struct {    value int    next *Node } func NewNode(value int, next *Node) *Node{    var n Node    n.value = value    n.next = next    return &n } func TraverseLinkedList(head ... Read More

Golang Program to update the node value after the Kth node (When K is not in the linked list).

Rishikesh Kumar Rishi
Updated on 18-Mar-2021 06:35:54

94 Views

ExamplesUpdate node after k=50 value nodeApproach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Iterate the given linked list.Step 4 − If node value 10 is not found, return the head without updating any node.Example Live Demopackage main import "fmt" type Node struct {    value int    next *Node } func NewNode(value int, next *Node) *Node{    var n Node    n.value = value    n.next = next    return &n } func TraverseLinkedList(head *Node){    temp := head   ... Read More

Golang Program to update the node value after the Kth node.

Rishikesh Kumar Rishi
Updated on 18-Mar-2021 06:32:36

126 Views

ExamplesUpdate node after k=10 value nodeApproach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Iterate the given linked list.Step 4 − If temp.value is 10, then update temp.next.value=data.Step 5 − If node value 10 is not found, return the head without updating any node.Example Live Demopackage main import "fmt" type Node struct {    value int    next *Node } func NewNode(value int, next *Node) *Node{    var n Node    n.value = value    n.next = next    return &n ... Read More

Golang program to delete the node after the Kth node.

Rishikesh Kumar Rishi
Updated on 18-Mar-2021 06:29:24

125 Views

ExamplesDelete node after 10 value node.Approach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Iterate the given linked list.Step 4 − If temp.value is 10, then override that node’s next value with its next node’s next value.Step 5 − If node value 10 is not found, return the head without deleting any node.Example Live Demopackage main import "fmt" type Node struct {    value int    next *Node } func NewNode(value int, next *Node) *Node{    var n Node    n.value ... Read More

Advertisements