Apply MinFilter on an Image Using Pillow Library

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

292 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

Insert New Node After Kth Node in Linked List using Golang

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

Delete Node After Kth Node in Linked List using Go

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

118 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

Update Node Value After Kth Node in Linked List in Go

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

92 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

Update Node Value After the Kth Node in Golang

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

Delete Node After the Kth Node in Go

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

Insert a New Node After the Kth Node in Go

Rishikesh Kumar Rishi
Updated on 18-Mar-2021 06:25:43

130 Views

ExamplesAdd node 15 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 add the node 15 as the next node.Step 5 − If node value 10 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 ... Read More

Update Last Node Value in a Linked List using Golang

Rishikesh Kumar Rishi
Updated on 18-Mar-2021 06:22:45

285 Views

ExampleApproach 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 − Else, update the last node value to 41.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    for temp != nil {       fmt.Printf("%d ", temp.value)       temp = temp.next   ... Read More

Update First Node Value in a Linked List using Go

Rishikesh Kumar Rishi
Updated on 18-Mar-2021 06:09:03

226 Views

ExampleApproach 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 − Else, update the first node value to 29.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    for temp != nil {       fmt.Printf("%d ", temp.value)       temp = temp.next   ... Read More

Delete Last Node from a Linked List in Golang

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

450 Views

ExamplesApproach to solve this problem −Step 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Go to the next node and return the updated head.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    for temp != nil {       fmt.Printf("%d ", temp.value)   ... Read More

Advertisements