After learning the fundamentals of image processing, here are a few takeaways:
First, let’s see our source image:
from skimage.io import imread, imshow
from skimage.color import rgb2graycarrier = imread('aircraft_carrier.jpg')
carrier_gray = rgb2gray(carrier)
imshow(carrier_gray);
Then, we define our template. For this image we just choose one of the planes:
template = carrier_gray[648:744,775:838]
imshow(template);
import numpy as np
import matplotlib.pyplot as plt
import skimage.io as skio
from skimage import img_as_ubyte, img_as_float
from skimage.io import imread, imshowplt.figure(dpi=200)
plant = imread('plantA_1.jpg')
imshow(plant);
Let’s try preparing this image for segmentation. We also crop the borders of the image as there some to be extra pixels from the original picture:
from skimage.morphology import erosion, dilation, opening, closing
from skimage.measure import label, regionprops
from skimage.color import label2rgbdef multi_dil(im,num):
for i in range(num):
im = dilation(im)
return imdef multi_ero(im,num):
for i in range(num):
im = erosion(im)
return implt.figure(dpi=200)
leaves = 1.0 * ((plant/255) < 0.4)[5:-5,5:-5,0]
imshow(leaves);
In this article, I will tackle how to project an image from a perspective to a top-down view. We will use the following book cover for this purpose:
This should be straight forward. We will identify the corners of the book in the original image. We go about this counter-clockwise starting from the upper-left corner:
Since I’ve already established the fundamentals in Seeing the World in Code, this is going to be a relatively short article about how you can use the RGB and HSV channels. We will use the image I used in White Balancing to get the labels out of the bottles in the image:
Let us try the RGB channel first:
from skimage.io import imread, imshowimg = imread('img1.jpg')# RGB Channels
img_r = img[:,:,0]
img_g = img[:,:,1]
img_b = img[:,:,2]
# Segmenting the image through their RGB channels res_b = ((img_r < 101) & (img_g < 101) & (img_b >=101))/255 red_b…
Agriculture is one of the key contributors to economies that have arable land to its resources. In this time that most industries are integrating smart technologies, agriculture cannot be left behind. I come from a country and a community where agriculture is the foundation to development thus talking about smart agriculture is close to my heart.
This article will discuss a simple way how we can use image processing to aid in smart agriculture. Specifically, we will try to localize crop trees to aid farmers in monitoring them by using morphological operations and blob detection. …
We’re living in a world overrun by filters and airbrushed models. However, I personally believe that beauty and meaning are found where truth is. The same goes for images. So, we perform image enhancements, primarily to restore images to how they should really look.
This article will discuss the following white balancing techniques for image enhancement:
For the white balancing algorithms, we will be using this photo:
255. It’s a number I’ve seen for the longest time and only ever considered it as a value that I enter in dialog boxes on some photo-editing software. However, using Python code to perform image processing has definitely given a new meaning to “255” along with everything I know and do not know about digital images.
Let us begin by Zooming into a 2x2 black and white image. In order for us to visualize this, we will use numpy as we will mostly process images using their numeric array form.
import numpy as np
from skimage.io import imshow, imread
For…
Am I doing this data science thing right?