fabiochiu/medium-articles huggingface dataset:
Can You Trust Your Heart?
By: Jocelyn Soriano
Tags: Spirituality, Christianity, Life, Religion, Catholic

Our hatred for evil is different from our hatred for something good.

Our hatred for all evil things stem from our natural desire for goodness. It is supported by our conscience and our sense of justice. It is remedied by compassion and mercy for our fellowmen who fall.

But our hatred for goodness is warped and unnatural. It is a form of envy and makes us lie to ourselves, to who we are supposed to be. What remedy is there to satisfy those who hate good men when the only desire of that will is to see good men fall?

Some good men may indeed fall. But by God’s grace they can rise again. Goodness always has a way to triumph in the end.

Let us therefore examine our hearts and pray that God may purify our thoughts and our desires. We are weak and sinful. But with God’s mercy, we can be healed. We can be whole. We can rise again!

The heart is deceitful above all things

and it is exceedingly corrupt.

Who can know it?

“I, the LORD, search the mind.

I try the heart,

even to give every man according to his ways,

according to the fruit of his doings.”

— Jeremiah 17, WEBBE
The Heavy Crown
By: Denise Thong
Tags: Catholic, Short Story, Christianity, Childrens Stories, Moral Stories

A few weeks later, the king passed away.

His brother ascended to the throne.

He was a wise king and the kingdom prospered under his care. He had only one wife and many children from that wife.

Formerly corrupt state governors were removed and replaced with virtuous ones and his courts were filled with lively discussions and debates.

On his death bed, his son, the crown prince, asked, “Father, you are a good king. Whenever I am with you, the crown seemed so light on your head. You make being a king look easy.”

The wise king replied, “Well son, the crown is a heavy thing. And if I had a choice, I would not wish it on you. But like me, it seems like you were born to carry this weight. To be able to bear the heavy crown, you will have to shed yourself of all other attachments. Before I became king, I lived high up the mountains with very little creature comforts and provisions. With time, I forgot that I was a prince, or even a man. I was as much a creature of God as that wild fox or that tree. Though I am the king of this kingdom, God is the creator of every little thing in this world. I am but a steward of this little kingdom that he has assigned to me. On your uncle death’s bed, he reminded me to send out an undercover servant to every state to keep track of the condition of our land. This advice stuck to me. I wondered often how an undercover Angel would report my every move to our Heavenly King. Henceforth, I treated everyone as an undercover Angel and I never took liberties with them. With time, the crown grew lighter.”

The Prince asked, “How did you resist all the temptations? I heard many stories of the offers of money, beautiful women, fine fabrics, exotic food, rare herbs and spices when you first ascended to the throne.”

The wise king smiled, “Well, people offered me these things because my brother used to like them. They wanted to buy my favour with these gifts. When I was tempted to accept them, I thought of the despair on my brother’s face when he passed away. None of these ‘fine things’ satisfied him. I refused the first few offers and soon, the offers became less and less frequent. Today, you hardly see people offering me such things — they simply assume that I have no desire for them.”

The Prince embraced his father, “I love you father and I am so proud of the life you led.”

With that, the wise king smiled and breathed his last.
Pope Francis declares Year of St. Joseph
By: Joseph Serwach
Tags: Spirituality, Christianity, Religion, Faith, Catholic

Pope Francis Declares “Year of St. Joseph.” As we noted in March “Now is the Time of St. Joseph.’’ as a new consecration to the protector of the Church coincided with the pandemic... Now through December 8, 2021:
What a wonderful woman
By: Anne Mendis
Tags: Faith and Life, Praise And Worship, Mother Mary, Praise God, Catholic

What a wonderful woman and mother you are Mother Mary! Today is the day which you conceived Jesus. Every Christian is waiting for Christmas day, for the birth of the Son of God. There is so much to admire with your journey with God because of how you were a humble, loving, and compassionate you were in serving God.

Every rosary bead that I pray, I keep in mind your life and how you carried not only your crosses, but the crosses of others without burden or complaint. You calmly and peacefully served the Lord all the days of your life. I find that when I pray the rosary everyday that I am moved to live my life in a way that is meaningful and pleasing to God. I know that God is not moved by perfection or by performance, but through belief followed by action.

You, Mother Mary are the shining example of the greatness that God has given each and everyone of us! Through every rosary and prayer I hope to one day achieve a level of greatness in the way I practice kindness, patience, and servitude to God. What a wonderful woman you are, What a wonderful example you are Mother Mary!
Every Nation on Earth Will Adore You Lord
By: Kevin Reber
Tags: Liturgy, Christianity, Culture, Philosophy, Catholic

The Importance of Culture in the Liturgy

Photo by caleb pudewell on Unsplash

The Liturgy is the actions of the people in praise of God, and as such it must grow out of the culture of the people. It is for this reason that the Church recognizes several different rites, or forms of ritual, for the worship of God. The most prominent of these is the Roman Rite, but there are also the Eastern Rites within the Eastern Churches and the localized rites of the Roman Rite. The history of these different rites are complex, but in a very simple manner, each evolved out of the different customs of the people so that the liturgy was best able to communicate to them the truths of God.

It is for this reason that the Second Vatican Council called for a revitalization of the rites of the Church and allowed for an opportunity of the localization of the Roman Rite. The Roman Rite was made much more simple in its very structure so that each culture can adapt it to speak to itself better, and in certain circumstances, such as in the Congo, it allowed for new rites to emerge.

While many in the Church are still upset about this idea, I think it is extremely important to the life of the Church. The Roman Rite has become dominant in the world by the fact of the Western powers colonizing and spreading westernization, but, indigenous and local cultures are just as important. The Western world is not the only one sanctified by God, but instead, all nations have been sanctified, and as such their unique cultures should also be elevated to the worship of God in the liturgy.

This elevation will be profound for the communities they serve, but also for the life of the Church. John Paul II desired the Church pray with “both lungs,” the eastern and western, but truly the Church is supposed to cry out to God in multiple voices, the voices of all peoples. The inclusion of other cultures in the liturgy cannot hurt the Church but instead will only strengthen Her.
#2 Come, Let Us Worship
By: Vic Alcuaz
Tags: Church History, Culture, Art, History, Catholic

“The depiction of Jesus’ birth is itself a simple and joyful proclamation of the mystery of the Incarnation of the Son of God.”

These words of Pope Francis recall how the birth of Jesus has inspired generations of artists throughout history to evangelize through beauty. Every week the Vatican Museums and Vatican News offer a masterpiece from the pontifical collections, which are accompanied with a reflection from the Popes.

A splendid nighttime scene of the Nativity and the Annunciation to the shepherds, in which St. Joseph is depicted as an old man, shown from behind as he sleeps next to a dead tree, which alludes to his exclusion from the birth of the Son of God.

The two women near Mary — who are the midwives of which the apocryphal gospels speak — represent those people who believe (the woman who looks toward the Virgin) and those who doubt (Salome, who turns her back).

In the background an angel lights up the sky appearing to the shepherds. But the supernatural light which radiates from the Child, placed humbly on the ground, is much brighter.
All Power Comes from God
By: Jocelyn Soriano
Tags: Spirituality, Christianity, Life, Religion, Catholic

Pilate therefore said to him, “Aren’t you speaking to me? Don’t you know that I have power to release you, and have power to crucify you?” Jesus answered, “You would have no power at all against me, unless it were given to you from above. — John 19, WEB

There are times when we may feel overwhelmed by the things happening around us. We feel helpless as things become out of our control. We do our very best, but things still don’t seem to work out the way they should.

Times like that, don’t be disheartened. For though we may not see now why such things happen or why God has allowed it so, God knows what He is doing and He is still in control of everything.

Power does not rest upon man. It comes from God! Therefore God gives and God takes away. If He ever allows certain things to happen, it is only to bring about a greater good.

One day we shall see. But today, we must trust. We trust though we cannot see. All we can be certain of is that God reigns. He is Lord of heaven and earth, and He is a Just and Merciful God.
A Voice of One Crying Out
By: Riqard Perlleshi
Tags: Christ, Baptism, Advent, Repentance, Catholic

As it is written in Isaiah the prophet:

Behold, I am sending my messenger ahead of you;

he will prepare your way.

A voice of one crying out in the desert:

We are exhorted in the Gospels time and time again that “Whoever has ears, ought to hear.” And we think we do — part of living our human life in the 21st century is the power and privilege of being able to hear, not just one thing, but all things. We take pleasure and pride in our hearing ears. We place in our hearts the sweet songs which set them on fire; we deliver new dreams and sweet promises to our egos, satisfying ourselves with the stories we tell about ourselves and the stories we tell of others.

But inevitably, other noises make themselves heard too; our convenient harmony encounters the sounds and noises from other artists and noisemakers which don’t accommodate our convenient music. Our pleasures become supplanted by the anxiety we face in the morning, our securities destroyed by illness, our happiness eroded when encountering the spiritual wounds of our past and present.

He who has ears ought to hear — but what are we hearing? What good is our hearing when there are so many sounds of self satisfaction circling around us? What good are our ears when they are lost in the noise of lies which drowns out the voice of Truth? What good are our ears when the voice of suffering is the only one we allow — when we cannot find the voice of the One who would seek to be our Life and Comfort even in the midst of our pain? What happens when we only hear those voices that emanate from our broken kingdom, instead of the voice of the one who cries out to us from the humble desert?

Those who have ears, ought to hear! But we don’t! We go against our design, relentlessly posturing and positioning, never allowing the true situation of our hearts to be heard, contorting the Word which cries out to us the true path. Running out of options, we distract, displace, and hide until we forget. We cover our ears, hoping to avoid that voice in the desert. Why are we so afraid?
knowHis.love
By: Adam D
Tags: Conversion, Life, Hope, Truth, Catholic

Some of my friends at Steubenville posted this interview recently on their website. Enjoy!

https://youtu.be/CCifs0VKkZo
#65 Beauty That Unites
By: Vic Alcuaz
Tags: Church History, Vatican, Art, Catholic

#65 Beauty That Unites

Masterpieces from the Vatican Collection accompanied by comments from the words of the Popes

Beauty creates communion.

It unites onlookers from a distance, uniting past, present and future.

Pope Francis has recalled this on a number of occasions. The Church has always translated the universality of the Good News into the language of art.

From this premise, this dramatic moment in history characterized by uncertainty and isolation, gives rise to this initiative which is a partnership between the Vatican Museum and Vatican News:

Masterpieces from the Vatican Collection accompanied by comments from the words of the Popes.

Fra Giovanni da Fiesole known as Fra Angelico (1395–1455), Capture and Stoning of Saint Stephen, lunette of the upper portion of the Stories of Saint Stephen and Saint Lawrence, fresco, 1448–1449, Vatican Apostolic Palace, Niccoline Chapel (Pope Nicholas V 1447–1455. © Musei VaticaniPope John Paul II, Homily in Bydgoszcz, 7 June 1999
Humor is a serious thing.
By: Jacob Warila
Tags: Philosophy, Religion, Humor, Catholic

Humor is a serious thing. As he was being led to the executioner’s block, Saint Thomas More joked to him “if you get me up, I’ll get myself down”, and again, on the scaffolding, More said “don’t cut my beard, it did not do treason”. Saint Lawrence famously told his torturers as he was being burned alive “turn me over, I’m done on this side”.

Now, generally, we consider execution and torture to be major inconviences, and we certainly think them as weighty situations to be in, and yet these saints both demonstrated levity at their ends.

Often we like to think about what we would do if we were in such martyr’s shoes, and our imaginations alone are enough to convince us that humor in the face of our own death is an extraordinary thing. It’s easy for us to chalk the mental fortitude of these saints up to their holiness, and conclude that in the same situation we wouldn’t have nearly the same mettle. Having come to such a conclusion, we can escape our imaginations and rest easy knowing we almost certainly won’t be burned alive or beheaded. I think that approach, which focuses on the martyrdom of the saints misses the one crucial fact, that insofar as it is never certain that we aren’t on death’s door, we may already be in those saints shoes and walking towards our death.

With More and Lawrence as our examples then, let’s avoid being dull or melancholy at the thought of our own mortality, but rather find some way to innocently make light at the thought of our ends. Furthermore, we have no excuse to get frustrated and mopey at any minor inconvenience, while saints quipp at the scaffold. Instead, we should be able to poke fun at any hindrance to earthly comfort, after all, if you’re worried about earthly comfort, anything is more convenient than dying.

Take the thought of your death seriously- and laugh about it.
Catholic Christmas Gifts: Remember It’s His Birthday Celebration
By: Joseph Serwach
Tags: Christmas, Religion, Books, Book Review, Catholic

Christmas celebrates the birth of Jesus, so at least one of your Christmas presents should be a reminder of Christ.

Gift cards, clothes, and toys are fine gifts. But when your atheist nephew thinks Christmas is now “secular,’’ what about a gift or two reminding loved ones of the reason for the season? Reminders of the King Christmas honors?

Enough with the elves — what about Mary?

For years, consumers bought the Elf on the Shelf. Now Catholics are advocating an alternative: Mary on the Mantle. The Mary doll is here for Advent, preparing families for the coming of Jesus.

For kids and grandchildren

Our granddaughter’s favorite? We watch the “Brother Francis’’ cartoons on Formed.org. They explain the faith in a fun and entertaining way. The stories are available on DVD and via music, books, and apps. Please also consider:

The Spider Who Saved Christmas by New York Times bestselling author Raymond Arroyo and illustrated by Randy Gallegos. The top-selling Catholic book is soaring up the New York Times Best Seller list. Arroyo (an EWTN and Fox News regular) reveals the origin of Christmas tinsel in the story of a cave-dwelling spider who is there for the Christmas story.

The Grumpy Old Ox, by Anthony DeStefano, tells the story of a mean-spirited, prideful ox who lost his sight — both physically and spiritually — but who nevertheless experiences the transformative power of God’s grace after he witnesses the birth of Jesus Christ in a stable.

New Vatican cookbook for loved ones who love recipes

The Vatican Christmas Cookbook, by former Swiss Guard (and chef) David Geisser, includes beautiful images and 70 original recipes served at the Vatican during the Advent and Christmas seasons over more than a thousand years. The cookbook follows his original bestseller, The Vatican Cookbook.

Great 2020 Catholic books to help loved ones grow their faith

How about a good Catholic film on DVD or digital download?

A good Catholic film shows how we all take the gifts we are given and do something good with them.

Several Catholic films have been soaring in popularity.

Some of the better recent Catholic films include:
Santa Barbara
By: Vic Alcuaz
Tags: Saints Angels, Inspiration, History, Catholic

Santa Barbara

Saint Barbara, also known as the Great Martyr Barbara, was an early Christian Greek martyr born mid-third century in Heliopolis, Phoenicia.

Barbara was the daughter to a rich pagan named Dioscorus. After the death of Barbara’s mother, Dioscorus dedicated his life to his only daughter.

Barbara was known for being extremely beautiful. As a way of “protecting” her, Dioscorus shielded her from the world by locker her high up within a tower. He allowed only her pagan teachers to see her.

Barbara spent her days gazing upon the hills and admiring all of God’s creations. She often pondered about the “First Cause and Creator of so harmonious and splendid a world.” She soon realized the idols her father and teachers worshiped were not of God’s creation.

Barbara secretly became a Christian and dedicated her life to knowing the true God and making Him known to others. She offered herself completely to the Lord, choosing a life of consecrated virginity.

As Barbara grew older, her father, Dioscorus began presenting men to her for marriage. She refused them all and warned her father that his persistence could forever damage their relationship.

Dioscorus allowed for Barbara to leave her tower, hoping some freedom would change her attitude. Barbara used this opportunity to meet other Christians. They taught her about the Lord Jesus, the Holy Trinity and the Church. A priest from Alexandria, disguised as a merchant, baptized Barbara into Christ and His Church.

While Barbara was out exploring the world, her father had a private bath-house built for her. The original architectural plans were for two windows to be built, but, while her father was away, Barbara advised the workers to make a third window ? creating a Trinity of light.

Barbara’s bathhouse became a place full of healing power and many miracles occurred there. St. Simeon Metaphrastes even compared it to the stream of Jordan.

After Dioscorus returned, Barbara informed him she had become a Christian and would no longer worship his idols. Full of rage, her father grabbed his sword and went to strike her. Before he could do so, Barbara ran off.

Her father chased after her, but was abruptly stopped when a hill blocked his way. The hill opened and hid Barbara within a crevice. Dioscorus searched and searched for his daughter, but could not find her.

Dioscorus came across two shepherds and asked them if they had seen her. The first denied, but the second betrayed Barbara. Some legends indicate that he was turned to stone and his flock was turned into locusts.

Her father Dioscorus beat his daughter, locked her up and starved her. He then handed her over to Martianus, the prefect of the city. Together, they continued to beat and torture her, but Barbara never renounced her Christian faith. She prayed to Jesus and he appeared to heal her wounds. This only made Martianus try harder to get her to renounce the Lord and her Christian faith. She refused and her Lord gave her strength to stand firm.
Put on the filter and we’ll clean out the fillers: Spatial Filtering and Morphological Operations with Images in Python
By: Nico Aguila
Tags: Image Processing, Python, Morphological Operations, Spatial Filtering, Data Science

Spatial Filters

Filters are basically matrices that apply a specific value onto a pixel based on their neighbors. In order to apply these matrices, convolution is done.

Let’s take a look at this cute little ornament and set it as our object of interest for this post:

#import libraries

from skimage.io import imread, imshow

from skimage.color import rgb2gray

import numpy as np plant = rgb2gray(imread('medium/plant.jpg'))

imshow(plant)

Such a cute little ornament

The appearance of the image can be changed by simply applying filters to all the pixels. Some filters applied are shown below:
Spot the blob on the job: Image Detection, Labeling, and Measurement using Python
By: Nico Aguila
Tags: Image Processing, Python, Blob Detection, Red Blood Cells, Data Science

Connected Components

Despite LoG appearing accurate in blob detection for our reference image, all three algorithms try to identify the blobs by marking them as circular objects. Since not all objects are circular, and that there are even objects of irregular shape, connected components in an image can be considered as objects of interest instead. However, connected components rely heavily on the image structure, which is why image cleaning is a must, which can be done using morphological operations.

Using our cleaned image earlier, region properties of the connected components can be identified.

from skimage.measure import label, regionprops

label_im2 = label(img_morph)

imshow(label_im2)

Connected components mapped with their corresponding region properties

The connected components are mapped as pixels wrapped again in matrices, just like how filtering and morphological operations to their job, by identifying objects in which to apply their operations on.

Given the coordinates on the image, we can determine the connected components via the regionprop module in Python, and actually try counting how many red blood cells are in the image. Let’s start by checking a reference value to which we can set to start the red blood cell count

area_list = []

for prop in props:

area_list.append(prop.area) min(area_list)



By using the area parameter of regionprop, we can determine the sizes of the red blood cells identified by the algorithm.

208

We can now set 208 as the threshold value to count all objects identified in the image.

rbc_bw = label(img_morph)

rbc_props = regionprops(rbc_bw) fig, ax = plt.subplots(figsize=(18, 8)) ax.imshow(rbc) rbc_count = 0

for i, prop in enumerate(filter(lambda x: x.area > 207, rbc_props)):

y1, x1, y2, x2 = (prop.bbox[0], prop.bbox[1],

prop.bbox[2], prop.bbox[3])

width = x2 - x1

height = y2 - y1

r = plt.Rectangle((x1, y1), width = width, height=height,

color='b', fill=False)

ax.add_patch(r)

rbc_count += 1

print('Red Blood Cell Count:', rbc_count) Red Blood Cell Count: 263

Red blood cells identified by the algorithm, with their corresponding bounding boxes

And there you have it, you can now have a general idea on how to count objects identified by your algorithm
How to improve the print quality of your image using just your home printer
Tags: Pdf, Image Processing, Printing

Before thinking you need a Canon pixma or an Epson workforce to get crisp prints you can only get with a premium printer; you should take a look at what your current printer can do first.

For reference, I used a 600 ppi dell c1760nw laser printer. It is an inexpensive printer with plenty of inferior qualities. But for this analysis, giving me 600 pixels per inch is not one of them.

My problem started when I just blindly converted all my images into pdf and thought what I see was what I get. The image looked clean on my computer screen, I thought it would look the same from the printer. It did not, I somehow manage to convert a 1080p image into a 480p image. I naturally blamed the printer for not living up to my expectations at first.

After a while, I decided to step back and review my images again. As I zoomed in on the image, I noticed artifacts that were not seen in the original image and played around with a bunch of different pdf conversion. Below are three different methods of converting to pdf which explicitly show that not all pdfs are created equal.

Different image quality from converting to pdf

All three of these pdf documents started off from the same image file, but only gimp managed to replicate the image exactly. The first one was done by directly copying the image onto a word file and using the convert to pdf built into Microsoft word. Word compressed the image and created some artifacts in the printed document. The second option was an image converted from a png directly into a pdf using print to pdf. The pdf driver again compressed the image and pixelated the image even worse than word. The final document uses gimp’s export to pdf function and actually transferred the image pixel for pixel onto the document.

(As a side note, if you have the choice of what image format to choose, make sure to save your image in a lossless format like png instead of a lossy format like jpeg. For low resolution images, you may get undesirable compression that will trickle down into the pdf and create subpar prints. i.e. Trash going in — trash coming out)

So I encourage you to go and experiment with your file formats and play around with your printer. If you still cannot accept the quality of your prints; you should now consider getting the printer upgrade you wanted.
How to adjust brightness of an image with Python?
By: Ahmet Nuri Yılmaz
Tags: Image Processing, Python Packages, Image Editing, Opencv, Python

With the method described in this article, we can adjust brightness of an image through a simple python image-processing package: “impytool”

impytool, is an opencv based open-source python package and it is being developed for facilitates some image processing operations.

You can get detailed information from the pypi.org page of the package.
Knock out… accidents.. In this article we will see how…
Tags: Accident, Image Processing, Safty Measures, Computer Vision, Automation Tools

In this article we will see how computer vision could help us to insure our safety.

The figure given below clearly shows that drivers’ fault is the single most important factor responsible for accidents. Drivers’ fault accounted for 78% of total accidents, 76.5% of total injuries and 73.7% of total fatalities in 2018.

source: internet

From distracted driving to drunk driving to careless driving, one inattentive decision could be the difference between a safe drive and a life-threatening situation. But what if we could neutralize human error in such cases also? What if there were a way so that we can monitor bad driving and prevent those unnecessary activity likely to cause accidents before the accidents themselves occur? What if we could keep tracking safety measures like seatbelt, helmet.

This is where computer vision comes in. With computer vision and advanced transportation systems , we can provide drivers with a safety net. These technologies make it possible to minimize human error in every day life, assisting drivers at the wheel with tools to protect them and features that will keep them from committing irrevocable serious mistakes and accidents.

And it does more than just that. Computer vision helps us as a complete sensory apparatus, one that parallelly takes in the environment around you and analyzes it for threats, obstacles, and other related situations that you’d need to react to while driving.
How an image is seen by computer:
By: Pradeep Pujari
Tags: Image Processing, Computer Vision

How an image is seen by computer:

Digital image is a matrix of numbers of size m x n (2D array). We call size of the matrix : m x n as resolution of the image. Each pixel value can range from 0 to 255. Pixel stands for pixel elements. To simplify further, here we consider only grey images, it means there is no color channel. Below, we can print the matrix values of this cat image. For details with code, please see here

Below code prints its pixel values.

im_32 = im.resize((32,32))

display(im_32)

print('Resolution', im_32.size)



im_matrix = np.matrix(im_32) #converting image to matrix

print(im_matrix) [[ 90 101 105 ... 101 98 89]

[ 96 104 108 ... 104 100 94]

[ 99 105 111 ... 107 102 96]

...

[ 47 56 81 ... 48 42 42]

[ 50 61 73 ... 44 43 40]

[ 49 45 60 ... 39 40 40]]

A pixel value of zero represents black and gradually increases towards bright, 255 being the brightest.

Update Operation: Since, an image is a numeric matrix, we can update pixel value(s) to any number between 0 to 255 both inclusive. But we can not update a pixel value to a negative number, all negative updates rounded to zero. Similarly, if you try to update number above 255, it updates to 255. This is because each pixel is represented as uint8 type, meaning unsigned ( can not take negative sign) integers from 0 to 255. Below code to update pixel value.

pixels = im_32.load()

print(pixels[2,2])

pixels[4,4]=0

Multiply Operation: Function to reduce each pixel value by half, we multiply each pixel by 0.5. So the image will look darker.

def half(pixel, num=0.5):

return pixel * num



half_im = im_32.point(half)

display(half_im)

Invert each pixel’s value: Subtract each pixel value from 255 which means if the pixel value is 5, its inverted value is 255–5 = 250.

def inv(pixel, num=255):

return num — pixel

Applying more functions:

We can also think of an image as a function-f(x)

a) Clamping the image with f(x) = (100/255)x + 100 or b) Quadratic transformation with f(x) = 255(x/255)²

im_matrix = np.matrix(im_32)

im_matrix = (np.square(im_matrix/255))*255 #f(x) = 255(x/255)²

Averaging images: Averaging images is a simple way of reducing image noise. Computing an average image from a list of images is by simply adding their matrices and dividing with the number of images, assuming the images all have the same size.

def compute_average(imlist):

""" Compute average of a list of images """

# open first image and make into array of type float

avg_im = np.array(Image.open(imlist[0]), 'f')

for imname in imlist[1:]:

try:

avg_im += np.array(Image.open(imname))

except:

print(imname + '...skipped')

avg_im /= len(imlist)

# return average as uint8

return np.array(avg_im, 'uint8')

All the code used in this lesson is here.https://github.com/ppujari/drl-nd/blob/master/image_arithmetic.ipynb
"View the past in any location from a computer screen"
By: Dan Lee Richardson
Tags: Time Machine, View Past, Image Processing, Future Technology

"View the past in any location from a computer screen"

this might sounds Scifi Fiction, but the reality is it can be done through massive computer power and special algorithms, just like movies and Games are created.

To keep things simple for the into, I will use simple examples. For an example, if I think many of you have used your laptop or PC to view digital photos of your past. By clicking on different pictures, the screen in front of you show the image you took in the past.

Now I want to ask you what got changed when you select different image? The only thing that got change was the pixels in the screen, thousands of pixels changed there colors depending on the picture. If we take a basic computer screen, it has 1024 columns and 768 rows. So basically there are 1024 * 768 pixels (tiny dots) in a computer screen.

So how many image/videos you watch on the screen, this number of pixels doesn’t gets changed. Only each pixels colors gets changed.

Now this is the Intresting part, consider you have all the images of the past to present in a folder, and computer is displaying one by one. So for each picture in past, only the pixels color gets changed!

So all your life’s pictures are just a pixel color combination. All the pictures from past to future is inside a 2^(1024 * 768) number of combinations (back & white photos).

Now the power of 2 into (1024 * 768) is and un imaginable amount of combinations (larger than the amount of stars in Universe).

So how you are going to find the correct combination pixels to se the image of the past? Well, this is where the special algorithms I developed in past 8nyears comes in. Without those algorithms, it’s like searching for a needle in a ocean (but the ocean is huge as the universe).

I will write about the algorithms on next articles. Until then, keep in touch.
Concurrent Image Processing in Go
By: Ismayil Shahaliyev
Tags: Programming, Golang, Concurrency, Image Processing, Goroutines

Iterating over an image

Our next step was to create a mask for the image to draw our result on. However, as we are going to define it in the main function, let’s, for now, assume that we already have a copy of the image called res .

Now we should write a code for our main logic to iterate over the whole image by square-sized steps.

for x := startX; x < sizeX; x = x + squareSize {

for y := startY; y < sizeY; y = y + squareSize {

// process the image

}

}

We can get rid of starting variables by specifying them as 0 , however, as we are going to use goroutines and give them different starting points by modifying the function, we will keep them.

Now we can write the logic for processing an image. We will have to create a temporary mask for finding the average color of each square in the image. For this, we are going to use Go’s image package, which is simple and nice. It is also powerful if your task is only consisting of manipulating rectangles and drawing simple shapes.

Let’s create a mask for each rectangle in the image, find the average of its colors, and then draw the averaged color on our result mask.

temp = image.NewRGBA(image.Rect(x,y, x+squareSize, y+squareSize))

The code above creates a rectangle by defining starting and ending points and then parses it into the RGBA color model.

color = averageColor(x, y, x+squareSize, y+squareSize, res)

This code, on the other hand, finds the average color for each square. We will soon define the logic for the averageColor function.

draw.Draw(res, temp.Bounds(), &image.Uniform{color}, image.Point{x, y}, draw.Src)

Finally, we draw the averaged color into the resulting mask (which we will define in the main function). Let’s connect all the dots to get the whole picture.

func processImage(startX, startY, sizeX, sizeY, squareSize, goroutineIncrement int, res draw.Image) {

var temp image.Image

var color color.Color for x := startX; x < sizeX; x = x + goroutineIncrement {

for y := startY; y < sizeY; y = y + squareSize {

// creating a temporary mask for the square

temp = image.NewRGBA(image.Rect(x, y, x+squareSize, y+squareSize))

// finding the average color for the square

color = averageColor(x, y, x+squareSize, y+squareSize, res)

// setting the color for the square

draw.Draw(res, temp.Bounds(), &image.Uniform{color}, image.Point{x, y}, draw.Src)

}

}

}
Median Cut Algorithm
By: Manas Jain
Tags: Java, Image Processing, Color Quantization, Compression, Median Cut

What is Color Quantization?

Color Quantization is the process of reducing the number of distinct colors used in an image. Color quantization is critical for displaying images with many colors on devices that can only display a limited number of colors, it also enables efficient compression of certain types of images.

Color Quantization on a Grey color scale

Color Quantization and GIF

The Graphical Interchange Format (GIF) image we use only supports 8bits per pixel that is 256 colors while something like JPEG supports 16 million colors. Color Quantization algorithms like the Median Cut Algorithm helps us to reduce the color space from 16 million to 256.

Median Cut Algorithm

Find the smallest box containing all the colors in the image. Sort the color codes along the longest axis of the box (Sort the pixels on the color axis with the highest range). Split the box into two regions at the median of the sorted list. Repeat the above process until the original color space has been divided into desired regions (Eg 64). Replace each pixel with the color with least euclidean distance from the generated color pallet.

Color Reduction Using Median Cut Algorithm

Code

The following github repository contains the Code for a Java application that takes a “P6” PPM(Portable Pixel Map) image as an input and generates a color pallet of desired size and reduces the color space of the image using it. https://github.com/manasjain0405/median-cut
OpenCV Kullanımı ile Kontur Çıkarımı
By: Buse Yaren Tekin
Tags: Image Processing, Extraction, Opencv, Contour, Görüntü İşleme

AI Specialist at SimurgAI, Software Engineer ML Intern at Towards AI
Python的DICOM 影像正負片讀取兩種方式
By: Chin-Yi Ji
Tags: Image Processing, TensorFlow, Dicom, Medical, Python

TensorFlow I/O

TensorFlow I/O is a collection of file systems and file formats that are not available in TensorFlow's built-in…
How To Send Images Into Flask API via URL
By: Burak Şenol
Tags: Programming, Image Processing, API, Flask, Python

After a little introduction, let’s start our project without wasting time. First of all, we will need some Python libraries to do our operations.

pip install Flask pip install pillow

After installing the necessary libraries, let’s design an API endpoint that will take as a input the image URLs with the HTTP-POST method.

By using the “<path:url>” specifier, we ensure that the string that will come after “send-image/” is taken as whole.

If you run this script and test it on your browser, the result will be as follows.
Görüntü İşleme Teknikleri ile Ön İşleme
By: Buse Yaren Tekin
Tags: Image Processing, Python, Görüntü İşleme, Data Preprocessing

AI Specialist at SimurgAI, Software Engineer ML Intern at Towards AI
Numpy Crash Course (Part 1)
By: Faiza Anan Noor
Tags: Image Processing, Arrays, Numpy, Matrix, Python

In the first example, we are accessing the index 2 and index 3 of arr3 and then printing out the summation of their values.

In the second example, we are accessing the row 0,column 1 of the 2d array

Let’s examine what’s happening here by analyzing the 3rd example that is

arr5[0,1,2]

So here the first term 0 refers to the first element of the 3d array which is

[[1.1,2.2,3.3],[4.4,5.5,6.6]]

The second term 1 accesses the 2nd element of this 2d array which is

[4.4,5.5,6.6]

Finally, the last term 2 refers to the 3rd index which is the index 2 which refers to 6.6

FINAL OUTPUT: 6.6

Similarly,

Let’s examine what’s happening here by analyzing the 2nd example that is

arr5[1,1,2]

So here the first 1 refers to the first element of the 3d array which is

[[7.7,8.8,9.9],[10.1,11.1,12.1]]

The second 1 accesses the 2nd element of this 2d array which is

[10.1,11.1,12.1]

Finally, the last term 2 refers to the 3rd index which is the index 2 which refers to 12.1

FINAL OUTPUT: 12.1

Negative Indexing:

Negative Indexing

Here -1 refers to the last element. In other words, this is the first element from the right

Likewise, -2 refers to the 2nd last element and -3 refers to the 3rd last element

So for the example,

arr[1,-1]

We are accessing the 2nd element which is

[6,7,8,9,10]

and so -1 means that we are accessing 10

OUTPUT :10

Accessing array elements specifying the row, columns:

Using step value to access every other element:

Here in the first example, we are returning every other element

In the Second example, we are skipping 2 elements

Slicing Arrays:

Slicing Arrays

Replacing Array values with new ones:

Working with different kinds of arrays:

The data types and characters representing them are:

i - integer

- integer b - boolean

- boolean u - unsigned integer

- unsigned integer f - float

- float c - complex float

- complex float m - timedelta

- timedelta M - datetime

- datetime O - object

- object S - string

- string U - unicode string

- unicode string V - fixed chunk of memory for other type ( void )

OUTPUT

In the last example, conversion of a string type array to integer type isn’t possible and so it raises an error.

Working with Random Values:

Random values in numpy

Here in the first example, we are generating a random float value.

In the second one, we are generating a matrix of dimensions 2x4 with random values

Generating random integer values by specifying the dimension and the range

Generating random float values by specifying the dimension and the range

Shaping and reshaping arrays:

Reshaping arrays

But some conversions might cause an error.

Error in reshaping

Flattening an array

Check out the code for this story by clicking on this link

Part 2, Part 3 will be out soon, so stay tuned!
Data Augmentation with OpenCV
By: Fırat Şahin
Tags: Image Processing, Opencv, Data Augmentation, Computer Vision

OpenCV: Geometric Transformations of Images

Scaling is just resizing of the image. OpenCV comes with a function for this purpose. The size of the image can be…
Create a custom shape mask with Python & Pillow
By: José Fernando Costa
Tags: Image Processing, Python

As with many other things, Python is pretty good for programmatic image editing. This is in large part thanks to the Pillow library. Creating an image from scratch to paste a couple layers on top, or apply some filters is easily accomplished with a few lines of code.

Today, I will show you a short script that creates custom-shape masks. We’ll load a Santa hat without background and add one to it, along with a shadow in less than 20 lines of code!

For the original Santa hat image, please find it here.

If you’re already familiar with Pillow, then this code will look simple to you, and even if this is your first time coming across this library, I think the comments in the code will suffice. But still, let me highlight the most important bits.

On line 8, it is important to create that black rectangle that will become the mask. It must be of the same size/dimensions as the original image and it will be cropped later to the desired shape, so don’t worry about its original shape.

Then, lines 15 and 17 add the shadow and the Santa hat, respectively, as two new layers of the image being created with the script. When adding the shadow, that mask=santa_hat argument does all the magic, because it transforms the rectangle into the same shape as the hat. Of course, it is essential that the original image has a transparent background, otherwise nothing happens.

When pasting the hat itself on line 17, it also requires the mask=santa_hat argument so Pillow keeps the transparent background, i.e., pastes only the hat and not the hat and fills the hat’s background…

Don’t forget to use the mask argument

Proper result

And that’s it! Now you know how to create a custom-shape mask based on another image. I thought this shadow example could be a useful demo, but of course this can be used for many other scenarios. As long as the image you want to custom-shape has the same dimensions of your mask, you should be good to go!
Nice Article !
By: Vinay Chaudhari
Tags: Image Processing, Computer Vision, Masking, Image Recognition, Image Segmentation

Nice Article !

How do I replace mask area with something :

Eg : Another image ?
暗部或亮部拉開: Gamma Correction範例
By: 陳俊伯, Cowbad Chen
Tags: Image Enhancement, Gamma Correction, Image Processing

A novice at Data Science, Computer Vision, and Image Processing. A master’s student at ESLLab, CSIE, CCU, graduated from IM, NTUST.
Drawing and Writing on Images using OpenCV
By: Faiza Anan Noor
Tags: Image Processing, Computer Vision, Matplotlib, Opencv, Python

In this story we are going to go through some functions of OpenCV that can help us draw shapes and place texts on Images according to our will.

First things first, lets show this image using matplotlib in jupyter using the following code:

import cv2 as cv

import matplotlib.pyplot as plt image1=cv.imread(“catto2.png”,1)

image2=cv.cvtColor(image1, cv.COLOR_BGR2RGB)

plt.imshow(image2)

If these steps seem unfamiliar , check out my previous blog

DRAWING RECTANGLES:

Method used for drawing Rectangles:

cv2.rectangle()

Syntax: cv2.rectangle(img, startingPoint, endingPoint, colour, thickness)

Example:

image3=cv.rectangle(image2,(40,40),(200,200),(0,0,0),10)

plt.imshow(image3)

Output for this code is :

Explanation:

Here we are drawing a black rectangle of dimensions (200,200) starting from co-ordinates(40,40) having a thickness of 10px.

DRAWING CIRCLES:

Method used for drawing Circles:

cv2.circle()

Syntax: cv2.circle(img, co-ordinates, radius, colour, thickness)

Code snippet for drawing circles

DRAWING LINES:

Method used for drawing Lines:

cv2.line()

Syntax: cv2.line(img, startingPoint, endingPoint, colour, thickness)

Code snippet for drawing lines

PLACING TEXTS ON IMAGES

The method for placing texts on images expects a lot of parameters, we’ll go over them all one by one.

Syntax:

image = cv2.putText(image, text, org, font, fontScale, color, thickness, lineType)

Parameter description:

image: The image to place a text on

text: The text to be placed on the image

org: The coordinates of the bottom-left corner of the text string in the image. The coordinates are represented as tuples of two values i.e. (X coordinate value, Y coordinate value).

font: The font family used for the text

fontScale: The font scale factor that is multiplied by the font-specific base size.

color: The color of the text

thickness: Thickness of the text

lineType: An optional parameter. It gives the type of the line to be used. Example : cv2.line_AA
Binarization of Image using NumPy
Tags: Numpy, Image Processing, Opencv, Binary Image

In this article, we will learn how to binarize an image using NumPy, and of course, we will use OpenCV for reading the image both in grayscale and RGB.

To understand what binary is — binary is something that is made of two things. In computer terminology, binary is just 0 and 1. If we were to relate the same in the images, it is said as black and white images where —

0 signifies Black

signifies 1 signifies White.

At the initial stages of learning image processing, we often think of a grayscale image as a binary image. Although it is not. But slowly when we pick up the subject, we realize how wrong we were. So, moving ahead, we will learn how to binarize the image with both using the library and without using the library (NumPy is used for matrix operations just to avoid the slowness of the program when used the regular for loops). Besides this, we will also use Matplotlib to plot the results.

RGB and Grayscale Overview

The binary operation works really well for the grayscale images. The problem with the color (RGB) images is that each pixel is a vector representing 3 unique values one for Red, one for Green, and one for Blue.

A typical grayscale image’s matrix would look like —

array([[162, 162, 162, ..., 170, 155, 128],

[162, 162, 162, ..., 170, 155, 128],

[162, 162, 162, ..., 170, 155, 128],

...,

[ 43, 43, 50, ..., 104, 100, 98],

[ 44, 44, 55, ..., 104, 105, 108],

[ 44, 44, 55, ..., 104, 105, 108]], dtype=uint8)

A typical RGB image’s matrix would seem like —

array([[[226, 137, 125], ..., [200, 99, 90]],

[[226, 137, 125], ..., [200, 99, 90]],

[[226, 137, 125], ..., [200, 99, 90]],

...,

[[ 84, 18, 60], ..., [177, 62, 79]],

[[ 82, 22, 57], ..., [185, 74, 81]],

[[ 82, 22, 57], ..., [185, 74, 81]]], dtype=uint8)

If we were to separate R, G, and B pixels from the above matrix. We get.

R matrix

array([[226, 226, 223, ..., 230, 221, 200],

[226, 226, 223, ..., 230, 221, 200],

[226, 226, 223, ..., 230, 221, 200],

...,

[ 84, 84, 92, ..., 173, 172, 177],

[ 82, 82, 96, ..., 179, 181, 185],

[ 82, 82, 96, ..., 179, 181, 185]], dtype=uint8)

G matrix

array([[137, 137, 137, ..., 148, 130, 99],

[137, 137, 137, ..., 148, 130, 99],

[137, 137, 137, ..., 148, 130, 99],

...,

[ 18, 18, 27, ..., 73, 68, 62],

[ 22, 22, 32, ..., 70, 71, 74],

[ 22, 22, 32, ..., 70, 71, 74]], dtype=uint8)

B matrix

array([[125, 125, 133, ..., 122, 110, 90],

[125, 125, 133, ..., 122, 110, 90],

[125, 125, 133, ..., 122, 110, 90],

...,

[ 60, 60, 58, ..., 84, 76, 79],

[ 57, 57, 62, ..., 79, 81, 81],

[ 57, 57, 62, ..., 79, 81, 81]], dtype=uint8)

Whatever operation we compute on the grayscale image, we will need to compute the same on the RGB image but for 3 times separating R, G, and B pixels and finally merging them as a proper RGB image.