Reading Video Files With Matlab For Image Processing

  Рет қаралды 16,718

CodingLikeMad

CodingLikeMad

Күн бұрын

This matlab tutorial video shows how to load video files in matlab using the videoReader object for image processing. Covers things like reading movie files in matlab, rewind and fast forwarding to a specific time, and extracting and analyzing a movie frame in the matlab API. This is critical to get started doing matlab video processing.
If you want to read Matlab's own documentation on this, check out: www.mathworks.com/help/matlab...
You can also look at our previous video on writing data to movie files with matlab here: • Making Videos From Fig...
The video used in the example is from NASA's Johnson Space Center, further details of usage (and additional very cool videos) can be found via:
eol.jsc.nasa.gov/FAQ/
The source file used was hosted from wikimedia, found here:
commons.wikimedia.org/wiki/Fi...

Пікірлер: 31
@Schubs
@Schubs 4 жыл бұрын
This was great! Thank you very much - I would love to see more!
@abidmehmoods
@abidmehmoods 4 жыл бұрын
doing a thesis on this topic... really helpful video. Thanx
@faranjadoon4622
@faranjadoon4622 2 жыл бұрын
excuse me i need help regarding this topic
@algola7024
@algola7024 Жыл бұрын
Wow -This is great content. I appreciate your work into this.
@CodingLikeMad
@CodingLikeMad Жыл бұрын
The humidity in the region of my socks is increasing rapidly.
@FelTContreras
@FelTContreras 3 жыл бұрын
very good job :)
@Schubs
@Schubs 4 жыл бұрын
Sorry to comment again, but what would I need to change in my code so I could do image processing with the frames? In my case I have an expanding circle I have a formula to calculate the area for, but I want to inject that into my loop. can I directly inject it into the loop as the code stands?
@CodingLikeMad
@CodingLikeMad 4 жыл бұрын
You should be able to process each frame in the loop as it's loaded. For large files this is virtual ly required as you will run out of memory. For small files you can load and store each frame and then work on the data cube.
@harshgarg4438
@harshgarg4438 2 жыл бұрын
Liked the video, can you make a video on how to get object speed like car on highways using matlab.
@rohankulkarni5386
@rohankulkarni5386 4 жыл бұрын
Can I transform the frames and then display it. So I am looking for a technique where in I want to have a bird's eye view of the video. I am planning to extract each frame and then use the perspective transformation method to transform the frame in top view format.
@CodingLikeMad
@CodingLikeMad 4 жыл бұрын
Hi Rohan! You can indeed transform the frames and then display it. The frame that is grabbed and then imaged in the code is a 3 channel (RGB) image, you can do whatever you like to it once it is extracted, including applying a technique which adjust perspective. I don't know anything about such techniques though, but the raw data can be collected and manipulated for almost anything you want to do using the code in this video. Goodluck! ~Kyros
@crazyishwarya479
@crazyishwarya479 4 жыл бұрын
Could you please upload a video on facial expression detection using MATLAB...
@alonso7327
@alonso7327 3 жыл бұрын
Great video, thanks so much, do you know how to get some plot from the video?.
@CodingLikeMad
@CodingLikeMad 3 жыл бұрын
To make a plot, just calculate per frame whatever you are interested in, drop it in a vector, and then plot at the end after all frames are looped over. Thanks :)
@kammelna
@kammelna 4 жыл бұрын
Hi, Thanks for sharing. I have a dataset that contains 64 columns and 46 rows when converting each row to an 8*8 matrix I can see a picture or a video frame. Now I have done this conversion and data became 8 columns by 368 rows, but I don't know how to read the data as a video. the data set is for classifying human activity, can you please assist with this? Many thanks
@CodingLikeMad
@CodingLikeMad 4 жыл бұрын
Hi Kammelna, It sounds to me like you don't really have a video file per se, but rather someone has already converted the video file into a matrix for you, and then smushed the 8x8 frames together into one giant matrix and handed you that. What you do next depends on how you want to work with the data, but probably the right first step is to make a routine that generates those 8x8 frames, and saves them into a matrix with the correct dimensionality. IE, something of size [8,8,1,46]. You can do this potentially with the reshape command, or just a for loop if it is easier to write and you don't have the speed concerns(it sounds like you mostly already have this). A matrix like this is actually already appropriate for feeding into tensor flow for classification of images actually, if you have access to the deep learning toolbox: www.mathworks.com/solutions/deep-learning/convolutional-neural-network.html (although with only 46 samples this will be likely impossible to use productively). Just my thoughts on how to handle it. Each image is accessible via a command like img(:,:,1,index), where index = 1 to 46. You may want to apply a squeeze() operation to deal with the singleton dimensions. Also, I'm assuming your images are grey scale here, otherwise the size is [8,8,3,46]. Best, Kyros
@kammelna
@kammelna 4 жыл бұрын
CodingLikeMad Hi Kyros, Thanks for your quick response. Yes you’re right the dataset is given as you mentioned. As for the 46 samples, they are only for one activity and there are 9 activities in total, also the same activities are performed by 6 different subjects. So in total I think the samples are around 55K. Thanks for your suggestions and Will try them. Regards.
@xallen22
@xallen22 4 жыл бұрын
Could this be used to receive a live feed from a camera? Or does the video have to be saved to the computer first?
@CodingLikeMad
@CodingLikeMad 4 жыл бұрын
You absolutley can, either using the figure loop I show here, or the preview command as discussed in the video :)
@xallen22
@xallen22 4 жыл бұрын
CodingLikeMad okey, cool! Would it work wirelessly as well? I mean, if I want to transmit a live video from another room and receive it to matlab
@xallen22
@xallen22 4 жыл бұрын
CodingLikeMad And do you think can I use this for the transmitting side as well?
@CodingLikeMad
@CodingLikeMad 4 жыл бұрын
The webcam interface is usb based. I'm not familiar with any way to this wirelessly, with this setup, but there might be some kind of wireless usb bridge? Let me.know if you find one :)
@khadizatunsuha1999
@khadizatunsuha1999 3 жыл бұрын
Can you please show how to select region of interest in a video . I have tried doint it. But it is not working inside a loop ,the same frame is showing for the entire video...
@CodingLikeMad
@CodingLikeMad 3 жыл бұрын
In the video I copy the image frame to a temporary variable. This is essentially an array, and you can crop it directly by selecting a region of it, ie, temp = vid.readFrame() temp = temp( 200:400, 300:600, :) imshow( temp, 'Parent', ax) At least, I think that should work, let me know if something goes wrong.
@hamedmmsulimanSuliman
@hamedmmsulimanSuliman 4 жыл бұрын
Please, I need to calculate a speed of moving object. Can you help me please.
@CodingLikeMad
@CodingLikeMad 4 жыл бұрын
Hi There, I'm not sure how much help I can be, but I will try. I assume since you are commenting on this video, you have video of the object that is moving. If it is not moving at a right angle to the camera direction, it will be very difficult to get any useful information out. The general approach you want to use for this is to assume that the speed of an object is constant (briefly) between two frames of the video. If you have a lab setup, you can take video of the object with a reference next to it. These look like rulers basically, usually black and white, with known spacing. You can then just measure how many pixels per marker distance (so if 10 pixels = 1 marker, and 1 marker = 10 cm, then 1 pixel = 1 cm). You can then use the frame rate of the video (accessible from the video format, or the video object, as described in this video), and just divide by the time 1 frame takes (or just multiply by the frame rate, it's the same thing). Now if you don't have a reference, you have a whole different problem. You need to generate one somehow. If you known the size of the object, it can be it's OWN reference I think actually (this is how human eyes work - it's why a fly looks like it is moving very fast, when in fact it is still walking speed). Another possibility is to work out the field of view of the camera after the fact in degrees per pixel, and then estimate the distance to the object and work out the remaining side of the triangle. Another option is to use known landmarks which happen to be nearby. So if you were trying to figure out how fast a car was going as it sped past your house, you could use road markers that you measure the distance between for example. Anyway, giving more general advice is probably not helpful, but those are my thoughts on how to do what you asked. If you are asking about non-video motion, probably the easiest thing is record it on video as above :p Good luck! -Kyros
@oldacc2508
@oldacc2508 Жыл бұрын
Idk why but i wrote the same script to just play video but for some reason it's only plays 1 frame per 5 seconds, readframe taking too much time and I don't know why! Myabe it's because matlab installed on hdd instead of ssd? But i dont have free space on ssd.
@oldacc2508
@oldacc2508 Жыл бұрын
I got 1920x1080 29fps video, maybe it's too much, i tried 1280x720 29fps, it's slow too
@CodingLikeMad
@CodingLikeMad Жыл бұрын
Is the video itself on the ssd? That may help. Otherwise I'm not sure.
@akilandeswari.p4205
@akilandeswari.p4205 3 жыл бұрын
Sir pls upload the video for removing rain and snow particles from the video and the output have video with out any rain particals using matlab function
@CodingLikeMad
@CodingLikeMad 3 жыл бұрын
That sounds like a really cool project! Unfortunately, I have no idea how to do with matlab functions... I think I could imagine doing it with neural networks using pixel mapping? Boy what a tough project though. Sorry I can't help, good luck! Let me know if you figure out how to do it!
Matlab Basics: Histograms
6:01
CodingLikeMad
Рет қаралды 50 М.
Image Processing in MATLAB Tutorial 1 - Acquisition and Display
7:33
The Motivated Engineer
Рет қаралды 111 М.
Can you beat this impossible game?
00:13
LOL
Рет қаралды 64 МЛН
1❤️#thankyou #shorts
00:21
あみか部
Рет қаралды 45 МЛН
How to bring sweets anywhere 😋🍰🍫
00:32
TooTool
Рет қаралды 20 МЛН
I Need Your Help..
00:33
Stokes Twins
Рет қаралды 168 МЛН
Git MERGE vs REBASE
16:12
Academind
Рет қаралды 1 МЛН
MinimalChat - A Simple and Customizable LLM Chat App
9:30
Fahd Mirza
Рет қаралды 288
Understanding SPI
11:50
Rohde Schwarz
Рет қаралды 64 М.
Top 5 Beginner PCB Design Mistakes (and how to fix them)
12:52
Altium Academy
Рет қаралды 196 М.
What is Apache Kafka?
9:35
The ASF
Рет қаралды 94 М.
Animating Plots In Python Using MatplotLib [Python Tutorial]
10:17
CodingLikeMad
Рет қаралды 69 М.
OAuth 2.0 and OpenID Connect (in plain English)
1:02:17
OktaDev
Рет қаралды 1,7 МЛН
Intro to Node-RED: Part 1 Fundamentals
9:47
Opto Video
Рет қаралды 651 М.
ВСЕ МОИ ТЕЛЕФОНЫ
14:31
DimaViper Live
Рет қаралды 35 М.
Где раздвижные смартфоны ?
0:49
Не шарю!
Рет қаралды 680 М.
cool watercooled mobile phone radiator #tech #cooler #ytfeed
0:14
Stark Edition
Рет қаралды 8 МЛН
iPhone 12 socket cleaning #fixit
0:30
Tamar DB (mt)
Рет қаралды 26 МЛН
Интереснее чем Apple Store - шоурум BigGeek
0:42
КОПИМ НА АЙФОН В ТГК АРСЕНИЙ СЭДГАПП🛒
0:59