Cross-Correlation for Particle Image Velocimetry (PIV) using MATLAB

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ก.ย. 2024

ความคิดเห็น • 111

  • @Willa1980
    @Willa1980 5 ปีที่แล้ว +20

    Hi, this video seems very nice, good work! Cheers, William from PIVlab

  • @arpansow3870
    @arpansow3870 3 ปีที่แล้ว

    Omg ! This means a lot !! I have learned PIV imaging in just 3 videos ! Amazing ! Thanks @Tanmay

  • @omarsalem5832
    @omarsalem5832 หลายเดือนก่อน

    great explanation , thank you!

  • @songswrittenbyme
    @songswrittenbyme 6 ปีที่แล้ว

    Thanks Tanmay for the fluid explanation. This was extremely helpful.

  • @arnabchakraborty6342
    @arnabchakraborty6342 6 ปีที่แล้ว

    thank you Tanmay, you did great. I am looking to capture strains in an arch. hopefully I shall be able to do it now.

  • @sreelakshmig1698
    @sreelakshmig1698 7 ปีที่แล้ว +1

    It is really very well explained video Tanmay. We are actually looking forward about how to capture shear strain under plane strain condition.

  • @pawandev23
    @pawandev23 4 ปีที่แล้ว

    good job Mr. Tanmay!

  • @alexandradupere5377
    @alexandradupere5377 3 ปีที่แล้ว

    you just saved my life bro

  • @yernurchakenov4659
    @yernurchakenov4659 4 ปีที่แล้ว +1

    Thanks, very good implementation

  • @sreedharmatkm
    @sreedharmatkm 6 ปีที่แล้ว

    Great video with excellent presentation. Thank you, it helps a lot for beginners like me.

  • @ashutoshpati7874
    @ashutoshpati7874 7 ปีที่แล้ว +1

    Thank you Tanmay.

  • @Alimaliyu
    @Alimaliyu 6 ปีที่แล้ว

    Fantastic explanation. Very useful.

  • @amonahud3250
    @amonahud3250 2 ปีที่แล้ว +1

    @Tanmay ,Your tutorial makes cross cotrelation easy to understand.
    I am using PIV technique in thermoacoustic device. I acquired data inside a hear exchanger channel by PIV but now I need to stitch 6 data together through Matlab to have images for full channel. Unfortunately, I don't know how to that in matlab as I don't have coding background. Would great if you could help, how can I contact you? Many thanks

  • @roshanjoshi8069
    @roshanjoshi8069 3 ปีที่แล้ว

    Thank you very much for the video. It was very helpful.

  • @muhammadnawaz9818
    @muhammadnawaz9818 3 ปีที่แล้ว +1

    Hi Sir! Your videos are very informative. Can you please make a video on how we can perform this experiment in a lab and if we put some flexible vegetation at different location in a channel then on which locations we have to find velocities. Also if you suggest some manuals on how to setup PIV and calculate velocity ? Your response is highly appreciated.

    • @TanmayAgrawal7
      @TanmayAgrawal7  2 ปีที่แล้ว

      Look up the book ob PIV by Raffel. That is pretty much everything you'd need.

  • @berkcanozturk655
    @berkcanozturk655 3 ปีที่แล้ว

    Great video, really helpful.

  • @user-kr8ev8rs9t
    @user-kr8ev8rs9t ปีที่แล้ว

    Hello, I am confused why I always get a peak on the center of correlation matrix

  • @sanjaykalita711
    @sanjaykalita711 3 หลายเดือนก่อน

    Can you please tell me logic behind starting from 200 and ending at 864 matlab code line number 20

  • @VikiJoker1924
    @VikiJoker1924 ปีที่แล้ว

    It seems this process is now made easier with the invention of the MATLAB extension, PIVLab by WIlliam Thielicke, could you make another video if possible using PIVLab?

  • @madepython
    @madepython 6 ปีที่แล้ว

    Thank you Tanmay

  • @nabil9223
    @nabil9223 4 ปีที่แล้ว

    Thanks for these two videos. Can you please uplode the Powerpiont in the discription?

  • @kumaruiuc3498
    @kumaruiuc3498 7 ปีที่แล้ว +3

    Hello Tanmay
    Thank you for the video introduction to cross correlation. My background is particle localization and I am new to the field of PIV and therefore I have the following question.
    I have movies with 3D information of particle flow with time (with less density than your movies so I can do particle localization and particle trajectory linking) and I would like to do their time-dependent PIV.
    As i understand there is the cross correlation strategy which most people seem to use in 2D and there is the method of localizing particle positions, linking trajectories and therefore getting velocity vectors of each particle which seems to be the approach of some research websites doing 3D imaging and consequent PIV.
    Is it a common practice in the field to take the approach of cross correlation while doing 2D PIV and not using the same for 3D maybe because the time tomaximize the cross correlation in 3D space is maybe longer? Or is my naive observation not valid?

  • @mfoucault1984
    @mfoucault1984 7 ปีที่แล้ว

    pretty cool man, congrats. Im just trying to change a little bit your code to do the same thing but in polar coordinates, for a fluid in a magnetic agitator.

    • @TanmayAgrawal7
      @TanmayAgrawal7  7 ปีที่แล้ว

      Please feel free to do the same. If possible, please share your code which could help others.

  • @souradippaul7466
    @souradippaul7466 5 ปีที่แล้ว

    It is a nice video about cross correlation in a image. Can you please explain the displacement part ?

  • @muhammadchoudhry5864
    @muhammadchoudhry5864 4 ปีที่แล้ว

    I followed your script and I am getting this error: 'Unable to perform assignment because the size of the left size is 1-by-1 and the size of the right side is 2-by-1. Error in cross correlation (line 53) dpx(i,j) = xpeak1 - xgrid(I); ........anyone ? any help would be appreciated!

  • @shareyguleria54
    @shareyguleria54 6 ปีที่แล้ว +1

    Can you please tell how to fit correlation peak with Gaussian curve to determine the peak location approximately and getting position data with some accuracy?

  • @ChiefEngr-GabsonAcademy
    @ChiefEngr-GabsonAcademy 7 ปีที่แล้ว +4

    I am looking for ways to like this video more than once, if not 1million times.
    Is the 2nd and last video on PIV?

    • @TanmayAgrawal7
      @TanmayAgrawal7  7 ปีที่แล้ว +1

      Thanks for the kind words.
      Most probably, yes. But at max, there could be one more.

    • @maheshtom9003
      @maheshtom9003 7 ปีที่แล้ว

      hello tanmay what correlation is used here. Is it direct correlation or FFT type?

    • @TanmayAgrawal7
      @TanmayAgrawal7  7 ปีที่แล้ว +1

      It is FFT based cross-correlation.

    • @maheshtom9003
      @maheshtom9003 7 ปีที่แล้ว

      thanks for the quick reply.to do this cross correlation..do I need to install along with MATLAB additional software like PIV 4 toolbox or PIVlab? or can it be done directly on MATLAB alone?(I have MATLAB 2009)

    • @TanmayAgrawal7
      @TanmayAgrawal7  7 ปีที่แล้ว +1

      No. MATLAB's image processing toolbox is all you need. It contains the inbuilt function normxcorr2 about which you can read more on au.mathworks.com/help/images/ref/normxcorr2.html

  • @yogeshwarang2043
    @yogeshwarang2043 2 ปีที่แล้ว

    can you explain about the multi-pass option to obtain the velocity field of the captured images? Can share any literatutre related to that

  • @melvinabraham3451
    @melvinabraham3451 6 ปีที่แล้ว

    Tanmay dude this is a pretty good tutorial , good job
    Btw, would a 30 fps DSLR or 120 fps Iphone suffice for a small setup ?

    • @MrKestable
      @MrKestable 6 ปีที่แล้ว

      I was thinking the same...

  • @jasonwong2726
    @jasonwong2726 ปีที่แล้ว

    Don't know if I will get a response, but using your code and my images, my test_ima and b arrays appear to be all zeros, why is this the case?

    • @TanmayAgrawal7
      @TanmayAgrawal7  ปีที่แล้ว

      Can you check the start and end indices?
      Debugging line by line might be the way to go.

  • @Abubakrqureshi5075
    @Abubakrqureshi5075 4 ปีที่แล้ว

    Hi Tanmay,
    Nice explaination for the topic. If you please explain how did you do the rescaling for the peaks' location. It will highly be appreciated.
    Thanks,

    • @TanmayAgrawal7
      @TanmayAgrawal7  4 ปีที่แล้ว

      It's a shifting of coordinates you can imagine. The way normxcorr2 works is that it gives a zero padding in the system.

  • @sumitzanje9660
    @sumitzanje9660 3 ปีที่แล้ว

    I'm getting following error:
    Error using normxcorr2>checkIfFlat (line 283)
    The values of TEMPLATE cannot all be the same.
    Error in normxcorr2>ParseInputs (line 250)
    checkIfFlat(T);
    Error in normxcorr2 (line 61)
    [T, A] = ParseInputs(varargin{:});

    • @TanmayAgrawal7
      @TanmayAgrawal7  3 ปีที่แล้ว

      Hi,
      I think your template is a uniform matrix with no changes at all. That is why...

  • @ansumansahu5245
    @ansumansahu5245 4 ปีที่แล้ว

    as per the point mentioned at 3:56 mins Can you explain how to find the x and y displacements of the center of the window?

  • @yuvanscircle3437
    @yuvanscircle3437 6 ปีที่แล้ว +1

    Awesome stuff!
    I tried running your commands on Matlab, but it's not working. I used an image from google images twice and displaced the particles a little bit in the +y-direction. However, I kept getting the following error:
    Index exceeds matrix dimensions.
    Error in CrossCorrelation (line 57)
    test_imb = imageb((test_xmin-x_disp_max):(test_xmax+x_disp_max),...
    I realized maybe the images where small or not clear enough. So I tried creating 2 images in Paint with white dots on a black background. However, I got the following error:
    Error in CrossCorrelation (line 65)
    dpx(i,j) = xpeak1 - xgrid(i);
    Please let me know what to do. I am very fascinated by the video!

    • @TanmayAgrawal7
      @TanmayAgrawal7  6 ปีที่แล้ว

      Thank you. These errors are usually encountered when there is some problem with the window sizes or when you are doing something wrong with the indexing.
      I am not sure if the code is universally correct, but a double-checking wouldn't hurt :)

  • @alexanderbraun8742
    @alexanderbraun8742 4 ปีที่แล้ว

    Nice job, thx.

  • @8880Blue
    @8880Blue 6 ปีที่แล้ว

    Its really work. Could you please publish Matlabcode?

  • @SGK2325
    @SGK2325 4 ปีที่แล้ว +1

    can you share piv images for matlab prg

  • @deepbhatt2254
    @deepbhatt2254 4 ปีที่แล้ว

    Hello, Great video bro...but i got an error while running the same programme for a test section can you help me with this

  • @ansumansahu5245
    @ansumansahu5245 4 ปีที่แล้ว

    Could you explain Line number 61 and 62 of the code ?

  • @christianarmstrong754
    @christianarmstrong754 4 ปีที่แล้ว

    Hi, really nice work Tanmay!
    Just to inundate you with another question, has MATLAB updated its language? I tried to run your code. However in MATLAB 2020a, the matrices: test_ima and test_imb, are not fully populated with values. It seems that the for loop does not iterate past i = 1, filling even that window with arbitrary values. Therefore the normxcorr2 func reports that the template and image values cannot be the same and the script does not advance. Your code obviously runs in MATLAB 2016a as evident in the video, however the exact same code with similar image resolutions does not function in MATLAB 2020a. I understand this is an older video, however any advice would be great. Thanks.

    • @TanmayAgrawal7
      @TanmayAgrawal7  4 ปีที่แล้ว

      Not sure what's going on there. I haven't run it in my current version of MATLAB. Please have a look manually what's going wrong and more importantly, why the two matrices are of similar size.

    • @christianarmstrong754
      @christianarmstrong754 4 ปีที่แล้ว +1

      @@TanmayAgrawal7 Thank you for your reply. After some experimenting with the code, I found an embarassingly simple cause of error. The template image had areas of identically dark areas where pixel values were uniform. When the first window of the template tried to be compared with that of the subsequent image, MATLAB was identifying the entire image to be the same. Reframing the template to cover a more complex area of system (with regards to the 2D signal produced) and/or changing the window size rectified the issue. Thanks again for your help.
      Best wishes, Christian

  • @flowingcode8069
    @flowingcode8069 6 ปีที่แล้ว

    Thank you very much. It was very helpful. :-)

  • @ASHISHKUMAR-be7ly
    @ASHISHKUMAR-be7ly 6 ปีที่แล้ว

    thanxx tanmay :)

  • @mehbubbasha2615
    @mehbubbasha2615 3 ปีที่แล้ว

    hii, thank you for the introduction to cross correlation, can we find the voricity by defining the density of vectors? or else can you help to explain how to find vorticity of the flow field.

    • @TanmayAgrawal7
      @TanmayAgrawal7  3 ปีที่แล้ว

      You need to calculate vorticity the mathematical way, using gradients, after calculating velocity.

  • @nazimbennini9721
    @nazimbennini9721 4 ปีที่แล้ว

    the sequence at 12:14 reminded me something I was doing some months ago in Matlab using the same image processing functions you're using and I had to do some tests to find out actully that fact about rows and columuns which made my program giving really weird results at first ...
    Nice video overall
    Please I have a question, I have read that the computational cost is much higher with direct cross-correlation than for fft cross-correlation. do you know about the fft cross-correlation ?

    • @TanmayAgrawal7
      @TanmayAgrawal7  4 ปีที่แล้ว

      FFT works with frequency space. Functions like normxcorr2 take advantage of that.

  • @lovelyboy1366
    @lovelyboy1366 7 ปีที่แล้ว

    Thanks for the video.
    How about 3d cross correlation? Is it easy to use it on 2 images from different angles to extract out of plane displacement? (Z direction)

    • @TanmayAgrawal7
      @TanmayAgrawal7  7 ปีที่แล้ว

      I believe you are talking about stereo PIV, is that correct?

  • @cwprsselvabalan7872
    @cwprsselvabalan7872 3 ปีที่แล้ว

    good

  • @mohammadhdaib3300
    @mohammadhdaib3300 5 ปีที่แล้ว

    when i was reading some articles about PIV. I read something called planar self-calibration and volumetric self-calibration, are the the same as correlation or an other types of correlation?????
    thanks a lot for your videos.

    • @mohammadhdaib3300
      @mohammadhdaib3300 5 ปีที่แล้ว

      when i tried to find a definition of it. i found it is a method to correct the misalignments between laser light sheet and calibration plane.
      but i don't have any idea wt is calibration plane and laser light sheet.

    • @TanmayAgrawal7
      @TanmayAgrawal7  5 ปีที่แล้ว

      Yes. Calibration during an experiment is to make sure that your data is meaningful once you get it and you can get some sort of reference to measure it against. Correlation on the other hand is a post processing tool.

  • @asharmd2001
    @asharmd2001 7 ปีที่แล้ว

    Hi! Have you calculated turbulent energy dissipation rate from PIV/LDA datas using MATLAB code? Thanks.

  • @solnik6236
    @solnik6236 5 ปีที่แล้ว

    hi .thanks for video its realy helpfull . I'm using your code but i have a problem that i couldn't find answer for it can you help me ?
    at the line of 63 dpx(i,j)=xpeak1 - xgrid(i);
    i have an eror :
    "Assignment has more non-singleton rhs dimensions than non-singleton subscripts"
    how i can fix it ?
    it says the dimensions doesnt match but i cant accept that .
    i tryed this code on 2014 2016a 2017b matlabs and all of them had this error .

    • @TanmayAgrawal7
      @TanmayAgrawal7  5 ปีที่แล้ว

      This is a very common problem and is usually encountered when the size of windows/image do not match their counterparts. OR. When you are trying to assign a matrix to another which is not of same size. Please do careful debugging. It should be solvable.

    • @santiagocanozapata9572
      @santiagocanozapata9572 5 ปีที่แล้ว

      Hola, ¿lo lograste solucionar?

  • @mostafanagi8406
    @mostafanagi8406 5 ปีที่แล้ว

    Thanks, but how can i overlay the flow vectors on the image, the coordinates are different

    • @TanmayAgrawal7
      @TanmayAgrawal7  5 ปีที่แล้ว

      Can you explain in detail what you meant?

  • @ludwigprandtl39
    @ludwigprandtl39 4 ปีที่แล้ว

    Hello, Tanmay dada, I am from Bangladesh. Can you please tell me what CHC is in terms of PIV analysis? And can its value be negative? like -2? I haven't yet started my PhD. Actually my potential supervisor asked me to do a calculation of determining time averaged velocity field and turbulent kinetic energy from some data which shows the u and v velocity data in different x and y co-ordinates. Can you help me in this?

    • @TanmayAgrawal7
      @TanmayAgrawal7  4 ปีที่แล้ว +1

      Hello. I'm not sure what CHC is since I'm not an expert in PIV. Please consult research papers.

  • @ramavathjagadeesh1030
    @ramavathjagadeesh1030 ปีที่แล้ว

    Sir can you please share the Matlab code

  • @ahmadsyazwan6555
    @ahmadsyazwan6555 5 ปีที่แล้ว

    I have a picture with double frames and i need to change it to individual single frame to do this in piv. Anyone know how?

    • @TanmayAgrawal7
      @TanmayAgrawal7  5 ปีที่แล้ว

      A very basic tool could be to use snipping tool of windows to do that. Otherwise you can read the full image in MATLAB using imagesc and then make two matrices out of the one big matrix.

  • @nesbittwei6307
    @nesbittwei6307 4 ปีที่แล้ว

    3:27 "Ah Oh" cutie pie lol

  • @ahsanzaman1562
    @ahsanzaman1562 5 ปีที่แล้ว

    How do you interpret the graph you obtained using quiver? what do all those vectors represent? Thanks.

    • @TanmayAgrawal7
      @TanmayAgrawal7  5 ปีที่แล้ว

      It plots the two dimensional matrix as a vector plot. In our case, it's a displacement plot you can say for various X and Y locations.

    • @ahsanzaman1562
      @ahsanzaman1562 5 ปีที่แล้ว +1

      Thank you, Tanmay! You're a superstar!

    • @ahsanzaman1562
      @ahsanzaman1562 5 ปีที่แล้ว

      @@TanmayAgrawal7 Hello again! I need some help with PIV lab and MATLAB for my project. Is it possible I could discuss that with you in length? Kindly let me know. Regards :)

  • @RahmanIITDelhi
    @RahmanIITDelhi 2 ปีที่แล้ว

    Sir how to calibrate .. .

  • @asrithpyla606
    @asrithpyla606 6 ปีที่แล้ว

    How to get 3D plot with correlation coefficient on the z-axis?

    • @TanmayAgrawal7
      @TanmayAgrawal7  6 ปีที่แล้ว +1

      I think you're asking about the surface plot. Use the command surf, that should help.

  • @sevvalsaregulduren1955
    @sevvalsaregulduren1955 3 ปีที่แล้ว

    Can we calculate the velocity of the particle according to this?

    • @TanmayAgrawal7
      @TanmayAgrawal7  2 ปีที่แล้ว +1

      This approach provides a spatially averaged (in the window) velocity. For individual particle, please look up Lagrangian approaches.

    • @sevvalsaregulduren1955
      @sevvalsaregulduren1955 2 ปีที่แล้ว

      @@TanmayAgrawal7 So average velocity can be find from displacement values over time difference between pictures, right? because I could not see it in the code.

    • @TanmayAgrawal7
      @TanmayAgrawal7  2 ปีที่แล้ว

      @@sevvalsaregulduren1955 Precisely! The time difference between the two snapshots is fixed by the camera and the code calculates the displacement between two windows.

  • @manjupoorvi7701
    @manjupoorvi7701 6 ปีที่แล้ว

    Hlo it's showing error at line 54 as index exceeds matrix dimension

    • @TanmayAgrawal7
      @TanmayAgrawal7  6 ปีที่แล้ว

      Please check some of the numbers such as those related to size of the image (pixels). Or the numbers involved in the window. Make sure that the window#2 still lies within the image. Problems might occur when it is close to the boundary, hope that helps

  • @Rahul-ny4ee
    @Rahul-ny4ee 7 ปีที่แล้ว

    make some more using dantec if possible

  • @kbrajasekarababu3878
    @kbrajasekarababu3878 2 ปีที่แล้ว

    Bro could you help me to buy the PIV?

    • @TanmayAgrawal7
      @TanmayAgrawal7  2 ปีที่แล้ว

      What specifically are you after? What is your budget?

  • @aathirahvalmaypriyono6954
    @aathirahvalmaypriyono6954 4 ปีที่แล้ว

    your video is realllyyy save my ass!
    but may I ask, what is the dimension of your image instant1 and instant2? Since I don't know where 864 and 1696 came from for xgrid and ygrid. Thank you!

    • @TanmayAgrawal7
      @TanmayAgrawal7  4 ปีที่แล้ว

      I believe it should be 1080 X 1920. That's where we trimmed the sides to make the dimensions 864 and 1696. Also this is related to the window size so that we are sure that everything fits nicely.

  • @mkschreder
    @mkschreder 5 ปีที่แล้ว

    Talks of windows, windows pops up a useless modal dialog, clicks the dialog, windows derails presentation...

  • @sameerkosurkar7801
    @sameerkosurkar7801 3 ปีที่แล้ว

    I have a project related to this, can you just help me with it ?

    • @TanmayAgrawal7
      @TanmayAgrawal7  3 ปีที่แล้ว

      Please email me on tanmayagrawal7@gmail.com

  • @PaulaGarciaRuiz
    @PaulaGarciaRuiz 4 ปีที่แล้ว

    could you share the tiff files?

    • @TanmayAgrawal7
      @TanmayAgrawal7  4 ปีที่แล้ว +1

      Please write to me on tanmayagrawal7@gmail.com

  • @raghuvanshnarayan916
    @raghuvanshnarayan916 3 ปีที่แล้ว

    can u send me the code??

  • @ernestadisi491
    @ernestadisi491 6 ปีที่แล้ว

    hi, thanks for the vid, would it be possible to ask some questions please via email

    • @TanmayAgrawal7
      @TanmayAgrawal7  6 ปีที่แล้ว

      Yes sure. It's tanmayagrawal7@gmail.com

    • @ernestadisi491
      @ernestadisi491 6 ปีที่แล้ว

      hi tanmay, is it the correct one please, email wont send

    • @ernestadisi491
      @ernestadisi491 6 ปีที่แล้ว

      sorry my mistake, sent it now thank you Tanmay

    • @SahadevanVigneshN
      @SahadevanVigneshN 4 ปีที่แล้ว

      @@TanmayAgrawal7 I am receiving error. Could you help me please?
      Error using normxcorr2>checkSizesTandA (line 272)
      TEMPLATE must contain at least 2 elements.
      Error in normxcorr2>ParseInputs (line 242)
      checkSizesTandA(T,A)
      Error in normxcorr2 (line 61)
      [T, A] = ParseInputs(varargin{:});
      Error in piv_code (line 52)
      correlation = normxcorr2(test_ima, test_imb);

      >>

  • @harshavardhanreddy4671
    @harshavardhanreddy4671 ปีที่แล้ว

    Lqq