25 - Reading Images, Splitting Channels, Resizing using openCV in Python

DigitalSreeni
20 May 201920:10

Summary

TLDRIn this Python for Microscopists tutorial, the host introduces OpenCV, a library for computer vision applications like image and video processing. The video focuses on five fundamental image processing techniques in OpenCV: splitting and merging channels, resizing images, denoising, edge detection, and image enhancement through histogram equalization. The host demonstrates how to manipulate images using OpenCV in Python, including reading and displaying images, and emphasizes the importance of understanding the BGR color convention in OpenCV. The tutorial is practical, providing step-by-step coding examples to help viewers grasp these essential image processing operations.

Takeaways

  • 😀 OpenCV is a library dedicated to computer vision applications, including image and video processing, with a focus on real-time video analysis.
  • 🔎 It's widely used for various applications such as facial recognition, object detection, motion tracking, and optical character recognition, which are also beneficial for microscopy image processing.
  • 🖼️ The tutorial introduces five basic pre-processing operations in image processing using OpenCV: splitting and merging channels, scaling, denoising, edge detection, and histogram equalization.
  • 🌐 To install OpenCV in Python, use the command 'pip install opencv-python' in the command prompt.
  • 📚 Importing OpenCV in Python is done using 'import cv2'.
  • 📸 To open an image in OpenCV, use 'cv2.imread', which can read images in color or grayscale depending on the flag provided (0 for grayscale, 1 for color, -1 for native).
  • 🎨 The script clarifies that OpenCV reads color images in BGR format by default, not RGB, which is a common source of confusion.
  • 📊 The tutorial demonstrates how to extract individual pixel values and explains that images in OpenCV are stored as numpy arrays.
  • 🔄 It shows how to split and merge image channels using both numpy slicing and the 'cv2.split' function, as well as how to merge them back using 'cv2.merge'.
  • 🔍 The script also covers image resizing using 'cv2.resize', explaining the use of scaling factors and interpolation methods like 'cv2.INTER_LINEAR' for image upscaling.
  • 📈 The tutorial is part of a series, with the remaining topics such as image smoothing, denoising, edge detection, and image enhancements to be covered in subsequent videos.

Q & A

  • What is OpenCV and what is it used for?

    -OpenCV is a library dedicated to computer vision applications, including image and video processing, especially real-time videos. It is used for various applications such as facial recognition, object detection, motion tracking, optical character recognition, and microscopy image processing.

  • Why is OpenCV useful for microscopy image processing?

    -OpenCV is useful for microscopy image processing because it can automatically detect and analyze objects like cells or nuclei, similar to object detection applications. It can also analyze time series data where cells evolve or divide, akin to real-time video analysis.

  • What are the five basic pre-processing operations in image processing using OpenCV mentioned in the tutorial?

    -The five basic pre-processing operations in image processing using OpenCV mentioned are: splitting and merging channels, scaling or resizing images, denoising or smoothing, edge detection, and enhancing images using histogram equalization.

  • How does OpenCV represent color images by default?

    -By default, OpenCV represents color images in the BGR (Blue, Green, Red) format, not RGB.

  • How can you view the individual pixel values of an image in OpenCV?

    -You can view individual pixel values by accessing the numpy array that represents the image. For example, to view the top-left pixel, you can use the coordinates (0, 0) on the image array.

  • What is the significance of the 'cv2.imread' function in OpenCV?

    -The 'cv2.imread' function is used to load images in OpenCV. It's a common function across many packages, and it's used to read images as grayscale or color, depending on the argument passed (0 for grayscale, 1 for color, or -1 for the native image including alpha channel).

  • How can you split the color channels of an image using OpenCV?

    -You can split the color channels of an image by using either numpy array slicing to manually extract each channel or by using the built-in 'cv2.split' function, which separates the image into its blue, green, and red components.

  • What is the purpose of the 'cv2.merge' function in OpenCV?

    -The 'cv2.merge' function is used to combine separate color channel images back into a single color image.

  • How can you resize an image using OpenCV?

    -You can resize an image using the 'cv2.resize' function, where you can specify the new dimensions or use scaling factors. You also need to specify the interpolation method, such as 'cv2.INTER_LINEAR' or 'cv2.INTER_CUBIC'.

  • What is the difference between the interpolation methods 'cv2.INTER_LINEAR' and 'cv2.INTER_CUBIC' in image resizing?

    -Both 'cv2.INTER_LINEAR' and 'cv2.INTER_CUBIC' are interpolation methods used in image resizing. 'cv2.INTER_LINEAR' is used for zooming in on an image, while 'cv2.INTER_CUBIC' is suitable for zooming out, as it provides smoother results by using a more complex algorithm that takes into account the surrounding pixels.

Outlines

00:00

💻 Introduction to OpenCV for Microscopy Image Processing

This paragraph introduces an OpenCV tutorial aimed at microscopists, focusing on its applications in microscopy image processing. OpenCV is a library used for computer vision tasks, including real-time video analysis and image processing. It's applicable for tasks such as facial recognition, object detection, and character recognition. The tutorial will cover five basic image processing operations: channel splitting and merging, image scaling or resizing, denoising or smoothing, edge detection, and image enhancement through histogram equalization. The presenter also discusses installing OpenCV using pip and demonstrates how to import and read an image using OpenCV, highlighting the difference between reading an image in color or grayscale.

05:00

🖼️ Understanding Color Channels in OpenCV

The presenter explains how to examine individual pixel values in an image using OpenCV, which is imported as a numpy array. They clarify that the color convention in OpenCV is BGR, not RGB, which is crucial for accurate image processing. The tutorial proceeds to demonstrate how to extract individual color channels from an image using both numpy slicing and the built-in OpenCV function 'split'. Additionally, the presenter shows how to visualize images using 'cv2.imshow' and discusses the importance of setting the wait key and window properties correctly to avoid issues with image display.

10:00

🔄 Channel Splitting and Merging in OpenCV

This section delves into the process of splitting and merging color channels in an image using OpenCV. The presenter first uses numpy array slicing to extract individual color channels and then demonstrates the use of the 'cv2.split' function for the same purpose. They also cover the reverse operation, merging separate color channels back into a single color image, using the 'cv2.merge' function. The importance of using the correct variable names and channel order when merging channels is emphasized.

15:01

🔍 Resizing Images with OpenCV

The paragraph discusses the process of resizing images in OpenCV. The presenter introduces the 'cv2.resize' function, explaining the two methods for resizing: using scaling factors or specifying new dimensions. They also touch on the concept of interpolation methods, which determine how new pixels are calculated when resizing images. The presenter demonstrates resizing an image using a scaling factor and shows the original and resized images using 'cv2.imshow'. The practicality and simplicity of image resizing in OpenCV are highlighted.

20:04

📈 Concluding and Previewing Upcoming Topics

In the final paragraph, the presenter concludes the current tutorial and provides a preview of upcoming topics. They acknowledge that covering image smoothing, denoising, edge detection, and image enhancement in one video would be too lengthy, and thus decide to create a separate video for these advanced image processing techniques. The presenter thanks the viewers for their attention and sets the stage for further tutorials on pre-processing functions in OpenCV.

Mindmap

Keywords

💡OpenCV

OpenCV, which stands for Open Source Computer Vision Library, is a highly popular library used for computer vision applications. In the video, it is introduced as a library dedicated to processing images and videos, particularly for real-time video analysis. It's highlighted for its utility in microscopy image processing, such as detecting cells or nuclei, and is central to the video's theme of teaching image processing operations.

💡Image Processing

Image processing refers to the techniques and methods used to analyze and improve images. It is a core theme of the video, where the tutorial focuses on basic operations in image processing using OpenCV. The script mentions several image processing operations such as splitting channels, resizing, denoising, and edge detection.

💡Facial Recognition

Facial recognition is a computer vision application mentioned in the script, where OpenCV can be used to identify and verify individuals from images or video frames. It is an example of the diverse applications of OpenCV, showcasing its broad utility beyond just microscopy.

💡Object Detection

Object detection is the process of identifying and locating objects in images or video. The script uses the example of detecting cells or nuclei in microscopy, which is akin to object detection in other contexts. This concept is integral to understanding the application of OpenCV in image processing for specific tasks.

💡Real-Time Video Analysis

Real-time video analysis involves processing video feeds as they are being captured, without significant delays. The script mentions that OpenCV is particularly useful for such applications, emphasizing its capability to handle dynamic and continuous data streams like those in microscopy where cells may be evolving or dividing.

💡Channel Splitting and Merging

Channel splitting and merging are operations in image processing where the individual color channels of an image are separated or combined. In the script, the tutorial demonstrates how to extract and recombine the blue, green, and red channels of an image using OpenCV, which is crucial for advanced image manipulation and analysis.

💡Denoising

Denoising, also referred to as smoothing in the script, is the process of reducing noise or random variations in images. It's one of the pre-processing operations mentioned that can improve the quality of images before further analysis, which is essential for accurate results in applications like microscopy.

💡Edge Detection

Edge detection is a technique used to identify the boundaries or edges of objects within an image. The script lists it as one of the pre-processing operations that can be performed using OpenCV. It's a fundamental step in image analysis, helping to define the shape and structure of objects in an image.

💡Histogram Equalization

Histogram equalization is a method used to improve the contrast of images by redistributing the intensity values. The script mentions it as a technique for image enhancement, which can make features within an image more distinguishable and is particularly useful in preprocessing for microscopy images.

💡Anaconda Distribution

The Anaconda Distribution is a platform used for scientific computing and data science, which includes a range of tools and libraries like OpenCV. In the script, the presenter mentions using the Spider IDE, which is part of the Anaconda distribution, to demonstrate the use of OpenCV, indicating the integration of these tools in a typical workflow.

Highlights

Introduction to OpenCV, a library dedicated to computer vision applications.

OpenCV's wide range of applications including facial recognition, object detection, motion tracking, and optical character recognition.

Relevance of OpenCV for microscopy image processing, such as automatic cell and nuclei detection.

Tutorial on five basic pre-processing operations in image processing using OpenCV.

Explanation of splitting and merging channels in multi-channel images.

Guidance on scaling or resizing images using OpenCV.

Denoising or smoothing images as a pre-processing step.

Edge detection as a fundamental operation in image processing.

Enhancing images using histogram equalization in OpenCV.

How to install OpenCV using pip in Python.

Importing OpenCV in Python and opening an image file.

Understanding image dimensions and channels using the shape attribute.

Reading images in grayscale versus color and the impact on image dimensions.

The default color channel order in OpenCV is BGR, not RGB.

How to extract individual pixel values from an image.

Using numpy array slicing to split image channels.

Built-in function 'split' in OpenCV to separate image channels.

Merging image channels back into a single color image using 'merge'.

Demonstration of resizing images with scaling factors and interpolation methods.

Practical example of resizing an image and comparing the original and resized versions.

Announcement of a follow-up video covering image smoothing, denoising, edge detection, and image enhancements.

Transcripts

play00:00

hey guys you're watching Python

play00:02

tutorials on my channel Python for

play00:04

microscopists on YouTube in today's

play00:08

tutorial let's talk about open CV this

play00:11

would be an introductory video for open

play00:13

CV and as I mentioned in one of my

play00:15

previous videos open CV is library

play00:19

that's dedicated for computer vision

play00:21

type of applications it can be images it

play00:24

can be videos and especially the

play00:26

real-time videos now open CV is used for

play00:31

many many types of applications for

play00:33

example facial recognition object

play00:36

detection motion tracking optical

play00:39

character recognition and many many

play00:40

others now they're still useful for

play00:43

microscopy image processing applications

play00:46

because let's say you have a bunch of

play00:49

cells of nuclei that you want to

play00:51

automatically detect this is no

play00:53

different than any other object

play00:55

detection type of application if you

play00:58

have a time series you know where the

play01:00

cells are evolving there where the cells

play01:02

are dividing for example this can be

play01:05

very close to the real time video

play01:07

analysis so in this tutorial I am going

play01:11

to talk about five basic pre-processing

play01:15

operations in image processing using

play01:19

open CV one would be splitting and

play01:21

merging channels if we have

play01:22

multi-channel images like red green and

play01:24

blue images scaling or resizing if you

play01:30

want to call them scaling these images

play01:32

denoising or smoothing if you want to

play01:35

call it and edge detection and finally

play01:40

enhancing images using histogram

play01:42

Equalization all of these are very

play01:45

useful operations if you want to perform

play01:47

for example image segmentation okay

play01:50

so let's jump into our spider IDE which

play01:54

is part of anaconda distribution and

play01:57

first of all I should have actually

play01:59

mentioned OpenCV I think this is the

play02:01

first video where we are talking about

play02:03

open CV if you want to install OpenCV if

play02:07

you do not have it already this is where

play02:10

the biggest issue is with open CV once

play02:12

you have it in stir

play02:13

it's very easy to use it OpenCV exists

play02:16

in you know see it also in Python so for

play02:20

Python in your command prompt you can do

play02:24

pip install and to install OpenCV this

play02:30

is a bit tricky open CV - Python this

play02:34

actually works at at least this is how I

play02:37

installed it on my system here so it's

play02:40

pip install OpenCV - python ok to import

play02:44

it we are going to import it using

play02:45

import c v2 this is how we import open

play02:51

CV in open CV to open an image let's say

play02:57

let's say we're gonna open a CV - dot M

play03:03

read again this M read is pretty much

play03:06

common in most packages as you as you

play03:08

probably can imagine and the format is

play03:11

pretty much the same C v2 dot MB I'm

play03:14

gonna import an image called RGB Y dot

play03:19

jpg okay

play03:21

so this is we'll see the will will see

play03:25

the image in a minute so RG b y dot jpg

play03:29

and let's go ahead and first print i am

play03:34

g dot shape okay i just want to print

play03:37

the shape and let's see what it is it is

play03:39

a 586 by 415 image and three channels so

play03:44

you can see right away that this is a a

play03:47

color image now you can read images as

play03:51

gray or as color so if you actually say

play03:53

0 right next to it now let's run this a

play03:59

586 by 4:15 so this means 0 basically

play04:04

means we are reading our image as a gray

play04:07

level image if i put 1 it should be 586

play04:13

415 and three this means we are reading

play04:16

it as a color image let's see what

play04:18

happens if I put two it says 586 by 4:15

play04:22

to is basically nothing but the native

play04:24

image without making any changes

play04:26

including the alpha Channel I've never

play04:29

tried to in so I don't want to

play04:33

experiment in this video but to is

play04:35

basically if you have also want to

play04:37

import the alpha Channel okay so now we

play04:41

are importing our color image so let's

play04:45

let's actually have a look at this image

play04:48

so I'm going to open this image and I

play04:51

let me okay so we can see exactly what

play04:55

what we are looking for okay so that

play05:00

image is loaded on my different screen

play05:02

so let me go ahead and drag it so this

play05:04

is nothing but blue on the top left

play05:06

yellow here on the top right green and

play05:08

red let's go ahead now and look at how

play05:13

to extract or how to look at individual

play05:16

pixel values okay so to look at

play05:19

individual pixel values again this is

play05:21

nothing but a a numpy array okay so the

play05:26

image when you import it into cb2 is

play05:29

nothing but a numpy array so to look at

play05:32

pixel values all you need to do is let's

play05:34

say let's look at top left so all you

play05:38

need to do is just type okay this is my

play05:41

image and I just want to look at zero

play05:43

comma zero okay so what is this this is

play05:46

my top left pixel so top left pixel is

play05:50

38 3 and 0 okay

play05:53

so typically when you look at when you

play05:56

look at by the way this is a 8 bit image

play06:00

so the values go from 0 to 255 now this

play06:04

is saying this is 38 3 and 0 so our

play06:08

typical convention is that this is a RGB

play06:11

image right color image red green and

play06:14

blue so red is 38 green is 3 and blue is

play06:17

0 which means on the top left we should

play06:19

have red but I have blue on the top left

play06:22

in OpenCV when you read color images by

play06:27

default the convention is not RGB it is

play06:29

B G or blue green and red and please

play06:34

remember this otherwise you can mess up

play06:36

your calculations you can verify this by

play06:40

opening an image using matplotlib pipe

play06:44

lot and then when you just do not

play06:47

convert anything you open it then all

play06:49

the colors look pretty weird so you can

play06:51

do that exercise by yourself just to

play06:53

show you one more time let's now go to

play06:57

our top right image or it image is 586

play07:01

by 4:15 so if I just do 0 and 400 this

play07:07

should give me top right and well let's

play07:14

do all four corners by not and the other

play07:16

one would be 580 this would be bottom

play07:25

and finally let's do the bottom right

play07:31

and you can guess what the coordinates

play07:33

would be 580 by 400 okay it's hundred

play07:38

something but this is close enough we

play07:40

should so let me open up the image and

play07:45

now you look at this top left is 38 I'm

play07:49

in blue and if you look at the top right

play07:52

this seems to be no blue at all but

play07:54

green plus red okay which is nothing but

play07:57

yellow bottom left is no blue no red and

play08:00

green b:g are again the whole point of

play08:03

I'm trying to make here is that the

play08:05

images when you read it in open CV it is

play08:08

BG are not RGB okay so I hope we got the

play08:12

point and by the way let me go ahead and

play08:13

zoom the left hand side so you can

play08:16

easily see this without me zooming and

play08:18

digitally so once we have the image so

play08:24

let me go ahead and delete this and now

play08:26

let's see how to split we have a RGB

play08:28

image now how can we split the channels

play08:30

well because this is an umpire array we

play08:33

know how to do that right I mean blue

play08:35

equals nothing but my image and then I

play08:37

want to use all my pixels from X all my

play08:41

pixels from Y but in Z okay in the color

play08:45

space I just want 0 this is nothing but

play08:47

all of my blue blue pixels so if I

play08:52

actually

play08:54

I'm actually thinking about whether I

play08:55

should talk about how to show images

play08:58

using cb2 let's go ahead and do that so

play09:01

far until now we've used matplotlib

play09:03

pie plot module to have a look at images

play09:08

to have a look at histograms and

play09:10

everything so let me introduce how to I

play09:14

mean see v2 dot I M show this is how you

play09:19

can actually visualize images I like

play09:22

this better than pie part because in pie

play09:24

plot the output is only shown within my

play09:28

console

play09:29

it can be very tiny sometimes but the

play09:32

good thing with pie plot is you can

play09:34

arrange you know things in in a specific

play09:36

way so you can it's it looks very

play09:39

professional let's say but with CV to

play09:42

dot M show it uses whatever your native

play09:44

default photo viewer is on Windows in

play09:48

fact I don't know what it is on Windows

play09:50

10 I know they we have some sort of a

play09:52

photo view or on every window so we'll

play09:55

see so it uses the native windows photo

play09:58

viewer okay now one thing you need to be

play10:00

careful about when you do see v2 dot M

play10:03

show which I'm going to talk about in a

play10:04

second blue image let's say our blue

play10:08

this is not blue image this is just blue

play10:10

pixels okay so our blue pixels is

play10:13

nothing but blue if I go ahead and run

play10:16

this it's gonna hang the reason is

play10:20

whenever you have CV to M show go ahead

play10:23

and blindly put I think that K is

play10:27

uppercase in weight key and always put

play10:31

this CV to dot I'm gonna tell exactly

play10:34

what this is

play10:35

destroy all and W is probably uppercase

play10:40

I think so so the weight t is nothing

play10:44

but after M shell is done it looks for

play10:48

how long do you want the window to be

play10:50

opened and the weight key basically

play10:52

tells if it is 0 that means indefinitely

play10:54

until I close it until I hit hit the

play10:57

close and if you put like 100 it is 100

play11:00

milliseconds the window is up for 100

play11:02

milliseconds it's gone after 100

play11:04

milliseconds what do you want to do I

play11:05

want to destroy

play11:07

windows that's exactly this next line is

play11:09

okay so let's go ahead and run this and

play11:12

the window let me move this image from

play11:14

the other screen so this is what I have

play11:16

here okay so you can see that I'm only

play11:20

looking at blue pixels in fact there

play11:23

seem to be a few blue pixels right along

play11:26

this line yeah so let's go ahead and do

play11:30

one more actually let's not do all just

play11:33

do one more let's do red pixels so you

play11:37

can see so red pixels and show me red

play11:42

but then we haven't defined what right

play11:44

is okay so let me copy this and red is

play11:47

nothing but BG all right B equals to

play11:50

zero green is one red is two so all I

play11:53

need to do is two right there and this

play11:55

is right this is how you can extract and

play11:58

why not you know let's go ahead and do

play12:01

one so that way we can see all three and

play12:07

let's add another line here so we can

play12:12

see green pixels and what do we want to

play12:16

see green let's run this and now we

play12:20

should see again let me drag these other

play12:23

windows so these are red and the green

play12:27

okay so if you look at the original

play12:30

image not sure if I have it open anymore

play12:33

if you look at the original image we

play12:35

have yellow on the top right which is

play12:37

nothing but a mixture of green and red

play12:39

so you see red right there bottom right

play12:41

is red so you see right here

play12:43

bottom left was green so you see green

play12:47

right here okay so and blue we only have

play12:50

it at one location right there

play12:52

so I'm splitting so now instead of M

play12:55

show I could have just in saved that you

play12:57

know we can save these images so this is

play12:59

how you can extract you can separate the

play13:01

channels but there is an easier way in

play13:04

fact so after all this there is an

play13:07

easier way if you actually do see v2 dot

play13:10

split your image this image is split

play13:14

into red green up oops sorry

play13:17

I make this mistake blue green and red

play13:20

so you can assign this to blue green red

play13:26

okay so blue green red equals two and

play13:30

let me go ahead and delete these lines

play13:32

this is equivalent to whatever I have

play13:35

defined before okay so if I go ahead and

play13:38

run this one more time you see exactly

play13:41

the same result

play13:42

okay so extracting the channels we

play13:45

looked at it a couple of ways one using

play13:48

the traditional numpy approach where we

play13:51

are only slicing or numpy array and the

play13:55

other one is just using the built-in

play13:57

function split with the function within

play14:00

the cv2 okay so this is how we can

play14:03

extract and by the way once we have this

play14:06

once we have these split let's say you

play14:08

do some image segmentation or whatever

play14:11

and then you end up with three different

play14:13

images you know and you want to combine

play14:15

them into RGB channels and get like one

play14:17

image one color image that has all these

play14:19

then exact opposite of split we have

play14:22

something called merge so you can just

play14:24

say image merged equal to c v2 dot

play14:29

merged and this would be so when we

play14:33

merge this we need to tell exactly what

play14:35

are the three images that we are merging

play14:37

so obviously in this case blue green and

play14:40

red this is the name of my Emma you know

play14:44

my my images here just so I'm not

play14:48

confusing you these are just names it

play14:50

doesn't have to be blue green and red

play14:52

okay it can be BG or if you want in

play14:55

which case this would be B G R okay so

play14:58

I'm not just typing some color names

play15:01

here it's whatever variable name you

play15:03

give give here for each of these

play15:05

channels that's what we are trying to

play15:07

combine here okay so now instead of all

play15:11

of these showing all of this let's

play15:13

actually just say combined image or

play15:16

merged image is nothing but image so

play15:24

this merged operation takes BGR and

play15:26

stacks the images accordingly so you can

play15:29

clearly see see v2 has no

play15:33

attribute emerged CV to my white shirt

play15:37

oh it's merch okay so let's run it there

play15:44

it is

play15:44

here is the image and it's a smashed

play15:47

this is just the reverse we split the

play15:50

channels and we merge them back together

play15:52

okay so this is merging images and so on

play15:58

and now let's look at a resizing images

play16:02

so I promised to show you five things

play16:04

and the second one would be resizing

play16:06

images so let me delete all of this and

play16:08

let's go ahead and read a small image

play16:11

one of the small images I have is effect

play16:14

okay you'll see that in a second and

play16:16

resized is nothing but you know let's

play16:19

assign a variable called resized and the

play16:22

way you do that is see v2 dot resize

play16:25

okay this is it

play16:27

most operations in OpenCV even the

play16:30

advanced ones you know typically are one

play16:32

line sometimes we have to do some

play16:34

pre-processing to get to that one line

play16:36

but it's very easy to implement so in

play16:39

this case our input image is image and

play16:42

there are some parameters you know you

play16:44

can actually look at when it's when you

play16:46

do resize it should come up with I'm not

play16:49

sure it should have actually prompted

play16:52

with okay what input parameters can

play16:54

actually go in there if you look at the

play16:56

documentation you know that there is one

play16:58

there is another one that you can input

play17:00

and the other one that you need to do is

play17:02

FX I don't know why it's not prompting

play17:05

what is the scaling factor in X there

play17:08

are two ways you can actually zoom our

play17:10

scale you can give actual dimensions of

play17:12

to what size you want to scale the image

play17:15

or resize the image or the scaling

play17:17

factor so in this example I'm just

play17:18

giving a scaling factor in Y and then

play17:21

there is something called interpolation

play17:23

okay when you expand the image by two

play17:25

times how do you want to fill the pixels

play17:28

in between because you're adding pixels

play17:31

right so there are various algorithms

play17:33

again you can go ahead and look at you

play17:37

know the documentation and one is the

play17:41

one I know there is like in Terraria

play17:44

I believe in Terraria is when you string

play17:47

the image that works very well

play17:49

interlinear is when you zoom in or inter

play17:52

pubic is also so you can either use

play17:54

inter cubic or inter inter linear again

play17:58

you can look at documentation online so

play18:01

all you need to do is in upper cases in

play18:04

Turk Ubik I think this is pretty much it

play18:07

so let's do CV to dot M show and let's

play18:12

see original image which would be IMG

play18:16

and let's also look at let me copy that

play18:19

line let's also look at resized image we

play18:25

call that resized and do not ever forget

play18:30

this CV to dot

play18:32

wait he I shouldn't have deleted that CV

play18:37

to dot B is not uppercase okay that

play18:47

should work now so let's go ahead and

play18:49

run this

play18:50

there is the small monkey and on my

play18:53

other screen

play18:54

it's the resized image resized image in

play18:57

X it's two times ya if I move this this

play19:00

is one that's two invites two times one

play19:02

and two right there okay so if I look at

play19:06

the image size it should be it should be

play19:08

too tired it should be right there

play19:11

resized image is 660 by four forty and

play19:14

our regular image is three thirty by two

play19:16

220 okay you can look at that in

play19:18

variable Explorer so resizing image is

play19:21

pretty much straight forward you know

play19:23

it's as easy as easy as that so let me

play19:27

cover two more topics which probably

play19:29

makes this a relatively long video in

play19:34

fact let's do this I'm gonna record

play19:37

another video in fact I thought of

play19:39

actually covering the image smoothing I

play19:41

mean be noising edge detection and

play19:42

something else saying that is going to

play19:44

take a while and nobody likes to watch

play19:46

one hour video and learn only five

play19:49

things in fact nobody wants to watch

play19:51

five hour I mean one hour video so it's

play19:54

almost twenty minutes so let me go ahead

play19:55

and stop here and create another video

play19:57

for the next topic which is

play20:00

smoothing or denoising edge detection

play20:03

and image enhancements these are all the

play20:06

pre-processing functions thank you very

play20:08

much

Rate This

5.0 / 5 (0 votes)

相关标签
OpenCVPythonImage ProcessingMicroscopyFacial RecognitionObject DetectionMotion TrackingOptical Character RecognitionReal-Time Video AnalysisComputer Vision
您是否需要英文摘要?