Day-3: Image Processing and ML
#MLOps

Day-3: Image Processing and ML

Image Processing

* Computer Vision of Picture is done by Image processing.

Image processing Involves Creating a photo, Cropping a Photo, Opening a Photo.

Image processing is done by Array(Numpy Array)

* Let's Play with Numpy with some useful examples

Example(1).

(1.1) List of 1, 2, 3, 4

No alt text provided for this image

(1.2) Names Vimal, Pop, Krish

No alt text provided for this image
  • Shape command is used to know the type of DIMENSION in Image processing.
  • The above result of shape is 1D, also Called VECTOR

(1.3) Lets do example in 2D array,

No alt text provided for this image

In this, we use Matrix i/p and o/p is shown.

The SHAPE here is " 2D Array ".

* In Data Science, we use Multi-Dimensional Array.

(1.4) Lets do example in converting 1D to 2D array,

No alt text provided for this image

Reshape command is used to convert 1D to 3D array as shown above

This way of reshaping is also used in Image Processing.

  • 1D array is called Vector
  • 2D or more than 2D is called Metrix or Multi-Dimensional Array

(1.5) Lets do example in creating array of Zero's using command line.

No alt text provided for this image

(1.6) Lets do example in creating Algebraic expressions.

No alt text provided for this image

From all these above examples, we use these Array concepts in Image Processing.

* Let's work on

Image Processing

by discussing Image Viewing, Creating Imaging and Cropping Image.

Image Viewing:

  • Double clicking will Open an image, its program written by someone.
  • We here, use Python programming in Viewing, Cropping and creating a Photo.

* Practice and result is shown below,

No alt text provided for this image

* Should Import cv2 module, " import cv2 "

Check cv module in panda list, if not there in list. Install it by running

" pin install opencv-python "

* Run " x = cv2.imread('1.jpg') "

the jpg should be in same working directory of python code file

this Command will read the jpg from directory.

* Run

No alt text provided for this image



Hi is name in braces which is choosy.

In waitkey(), braces should be time in (millisec).

The Destroy command, will autoclose the pic after the time mentioned in waitkey command.

Color to Gray Conversion:

No alt text provided for this image

Creating Photo:

No alt text provided for this image

* Create a Table and make into Rows * Columns.

Fill the boxes with some color as above, leaving some boxes in white. We can observe it as Numeric '1' from distance.

Any Image is exactly same as table with rows and columns.

* In a box, it will have data. this data in Picture is called " Pixel ".

this pixel will have color.

* According to RAM(loading)/CPU(Process)/H.D(Store), they never understand the color . They understand the Number only.

  • Any color in box is stored as a Number in H.D as a " R B G ", this is shown by RAM through CPU.
  • In Numpy Array, the pixel data will be in " B G R " form.

* In Every box, we have multiple data it is called 3D array or Multi-Dimensional Array.

  • All colorful images are 3D array.
  • Range of R/B/G: 0-255
  • Image == Numpy Array
  • Black & White is 2D Array
  • Gray image is 2D Array.

Cropping a Photo:

Lets do a basic example, before going to cropping discussion.

No alt text provided for this image

the same procedure is done in Cropping a Picture.

Lets jump on cropping pic, as below

Use cases

(1) Specifying a Green Dot in pic:

No alt text provided for this image

(2) Drawing a Green line on pic:

No alt text provided for this image

(3). Main Agenda of cropping a pic:

No alt text provided for this image

Day-3 & Day-4 ML concepts are repeated and little advanced on Day-4. So, will update it in 9th(Day-4) Article.






To view or add a comment, sign in

More articles by Abdul G.

  • Advance CNN

    In general, Model creation needs a dataset, hardware resource, time, and money. Data collection for a requirement is a…

  • CNN example and Standard Architecture

    CNN Example: Let's apply our previous article analogy and do an example by constructing 2 C.L, 2 P.

  • CNN Architecture

    In the last article, we had found the important features of the image. Let's discuss the convolution process in-depth…

    4 Comments
  • Feature Extraction

    In MNIST dataset, we have images of size 28*28 b/w (0-9), even without Feature extraction, we can predict the output…

  • Convolutional Neural Network(CNN)

    If we have a dataset with a limited no. of Rows and Columns, we use Traditional M.

  • Multi-Classification Model

    In N.N, we know info.

  • Activation Function and Deep Learning example

    Activation Function: Let's discuss Activation function, where, when, and how it is used. For this example, We can do…

  • Deep Neural Networks

    The brain has lots of Neurons, data from the outside world makes brian to learn, and brain gest experience, the output…

  • Interactive Graph

    If we want to analyze, features selection, or finding the correlation or visual model of the mind for the future of…

  • Day-2

    In this article, Let's discuss a Use case followed in back old days. Use Case: Let's take a client ABC requires a…

Others also viewed

Explore content categories