Unity + OpenCV Interactive Webcam Video Tutorial

Поділитися
Вставка
  • Опубліковано 11 вер 2024

КОМЕНТАРІ • 63

  • @Hazzel31337
    @Hazzel31337 8 місяців тому +1

    thats amazing, a childs dream bringing real objects into a gameworld, seeing the end result is really tripping me out ^^ thanks for the tutorial

  • @eroc1944
    @eroc1944 2 роки тому +3

    Looks super fun! Thanks for sharing the whole process.

  • @Dan-Levi
    @Dan-Levi 2 роки тому +1

    This is awesome! Had to try it right away :) Been poking around OpenCV in python for some days and bringing it to Unity and C# is amazing :)

  • @roywilliams6355
    @roywilliams6355 2 роки тому +2

    Great tutorial Matt. Could you make one that would allow someone to create a very simple Cube tracking an AR marker through a webcam demo? Essentially the most simple AR demo there is but I want to be able to do it with Open CV. Thanks a million.

  • @RupinChheda
    @RupinChheda 11 місяців тому +1

    I loved this tutorial.

  • @Techne89
    @Techne89 6 місяців тому

    Amzing , I hope you publish more tutorials & lectures

  • @oriolcorella2480
    @oriolcorella2480 11 місяців тому

    THANKS for that video. This content is priceless and really awesome, thanks, thanks and thanks!!

  • @Antypodish
    @Antypodish Рік тому

    Well done. Super cool to watch such fun projects.

  • @CornuDev
    @CornuDev Рік тому +1

    That‘s super cool!

  • @skudgee2
    @skudgee2 Рік тому

    Work like a charm ! Awesome thanks !

  • @S111A111S
    @S111A111S 7 місяців тому +1

    Have you tried combining ARFoundation + OpenCV plus Unity on an Android phone? I tried but got a white background, that is, the AR camera works, but the OpenCV (RawImage) overlay does not, just a white background and that’s it. Is there a way to combine them?

    • @redalaghbissi2132
      @redalaghbissi2132 3 місяці тому

      I also suffer from the same problem, have you reached a solution?

  • @traumenfliegen3796
    @traumenfliegen3796 10 місяців тому

    Hey Matt, great tutorial! Your introduction worked perfectly for me on Windows. Now, I'm trying to implement this Unity + OpenCV setup on an Android smartphone, but I'm having some issues. Do you have any experience with that and might have some tips? Thanks in advance and keep up the good work!

    • @MattBell
      @MattBell  10 місяців тому

      I am afraid I havent used the OpenCV library on Android.

  • @UsamaAbubakar-gs1nc
    @UsamaAbubakar-gs1nc Рік тому

    Great tutorial. Can you guide if we can detect user's facial expression using the front camera whether the person is angry, happy, surprised, etc?

  • @gamenotover999
    @gamenotover999 7 місяців тому +1

    I fixed the ToVector2 function so that you dont have to change the rotation, size and position of your collider to line it up, This way it also works with diferent resolutions of camera and screen.
    private Vector2[] toVector2(Point[] points, int width, int height)
    {
    float Mx = (float)Screen.width / (float)width;
    float My = (float)Screen.height / (float)height;
    int _x = 0;
    int _y = 0;
    vectorList = new Vector2[points.Length];
    for (int i = 0; i < points.Length; i++)
    {
    _x = Convert.ToInt32(points[i].X * Mx);
    _y = Convert.ToInt32((height - points[i].Y) * My);
    Vector3 p = new Vector3(_x, _y, 0);
    p = Camera.main.ScreenToWorldPoint(p);
    vectorList[i] = new Vector2(p.x, p.y);
    }
    return vectorList;
    }
    the wisth and height parameters are the width and height of the processimage.
    Width = processImage.Width;
    Height = processImage.Height;

  • @98Zai
    @98Zai 2 роки тому

    Very cool video!!
    I used the very first part of your code and the marker detection example in 'OpenCV plus unity'
    to make the marker tracking appear on the webcam feed! Thanks for the explanations!
    I have a problem though; it won't track my paper marker, but if I hold it up to the screen it will track the marker "double" that appears in the unity editor video feed.. I have no idea what I've done wrong!
    Ultimately I'm looking to turn my camera into a shoddy 6dof pointer, by anchoring the scene and a unity camera on the virtual marker and then using the webcam as an input device in my 3D scene.. do you think that's possible with these tools, or is it all just an illusion of 3D?

  • @bogdanshulman8081
    @bogdanshulman8081 Рік тому

    Loved it ! Thanks)

  • @ranliu6307
    @ranliu6307 Рік тому

    So cool! ​Why do you have a hover function? ​Is it an extension? It seems to hide so much coding.

  • @JQxiao-lz4hr
    @JQxiao-lz4hr 6 місяців тому

    我的RawImage的宽高是3860*2160的,太大了,怎么设置WebCamTexture的Input的视频流宽高呢?而且显示的画面是静态的

  • @bitshuffler
    @bitshuffler 2 роки тому

    super helpful, thanks!

  • @whitelee9630
    @whitelee9630 10 місяців тому

    i want to install in my phone, but the screen size turn wrong, and if i change size look like detect can't collider with the ball =口=

  • @jonathanh8251
    @jonathanh8251 10 місяців тому

    Great tutorial and fascinating project! I'm trying to use OpenCV to see if it's possible to "track" an object in a video (not the webcam) and finding this difficult to achieve. There is a demo scene that uses a TrackerScript which inherits from Webcam and it achieves this perfectly on a webcam view. I figured it would be straight-forward to do this on a video surface instead but man it's giving me trouble. Your tutorial doesn't cover this but it does give me a much better understanding of how to work with OpenCV. If you have any tips on achieving this effect I'd love your insight!

    • @amalbm630
      @amalbm630 7 місяців тому

      Any luck? I'm trying to find the same thing

  • @triptonine1
    @triptonine1 Рік тому

    tnx for the great tutorial! i have a question, how would it be possible to add the open cv asset to the assembly definition that my codes are part of? tnx!

  • @khohoang6273
    @khohoang6273 Рік тому

    I have trouble with this lib when build android : "DllNotFoundException: Unable to load DLL 'OpenCvSharpExtern'. Tried the load the following dynamic libraries: Unable to load dynamic library 'OpenCvSharpExtern' because of 'Failed to open the requested dynamic library (0x06000000) dlerror() = dlopen failed: library "OpenCvSharpExtern" not found ". Can you help me with this?

  • @coryjamescooper
    @coryjamescooper 2 роки тому

    This is so cool! gj!

  • @xlgabriel
    @xlgabriel 2 роки тому

    Hey, I need to use OpenCV for text recognition (kids will draw a letter in a Canvas), but I have NO idea how to do it and if there's a way of doing it like, for example, in this video with this webcam usage. Please, if you know something, I'll be happy to read it, it's for a project in my class.

  • @andrewknight3076
    @andrewknight3076 Рік тому

    any chance you could post the code as its a little unreadable at that resolution?

  • @thegrey448
    @thegrey448 Рік тому

    hi budd, thanks for made this tutorial. glad to see. i have orbbec camera could you make tutorial for vfx using orbbec or maybe any easy solution? thanks in advance

  • @aravindaloshans979
    @aravindaloshans979 Рік тому

    Assets\Scripts\ContourFinder.cs(24,44): error CS1503: Argument 2: cannot convert from 'object' to 'UnityEngine.Texture2D'
    How to solve this error?

  • @oxoxxoxo3259
    @oxoxxoxo3259 3 місяці тому

    how to change webcam?

  • @PlayU2U
    @PlayU2U 2 роки тому

    Good job! 👍

  • @MatheusWillian95
    @MatheusWillian95 7 місяців тому

    Amazing!

  • @juliangabrielalvarez7642
    @juliangabrielalvarez7642 2 роки тому

    Awesome tutorial! Does anybody know how to actually get the x and y coordinates of the contours? I need them to move an object

  • @sutrapixel
    @sutrapixel Рік тому

    thanks man

  • @milliwaysgames
    @milliwaysgames Рік тому

    Hey Matt, can you help me with my project? i have a track where car is moving, now after seeing your video i got to know how to create colliders around the shapes but how do i suppose to separate them means if you need to collide two shapes from webcam and turn light a bulb in unity how you gonna do that? i want this for my car if car collides with sides of the track , negative marking for the player.

    • @MattBell
      @MattBell  Рік тому

      There are other forms of segmenting them available in openCV. If your cars are distinct colors you might be able to track the color. Background subtraction might help. You might also be able to use the match template function

    • @milliwaysgames
      @milliwaysgames Рік тому

      @@MattBell thanks for your valuable reply. Also what happen if there is a shadow of an object? will there be a collision with shadow too? if so. is there a way to avoid it

    • @MattBell
      @MattBell  Рік тому

      @@milliwaysgames with this technique you might, the shadow might trigger a collision unless you can control the lighting well enough that you can control it with the threshold value. The other segmentation techniques I mentioned might give you better fidelity.

  • @user-bc1tm9mf7w
    @user-bc1tm9mf7w Рік тому

    How can you use a mobile camera as alive feed back in this case.

    • @MattBell
      @MattBell  Рік тому

      I'm not sure I quite understand your question, but I believe this technique should run on Android directly.

  • @adamtemple9417
    @adamtemple9417 Рік тому

    would you know how to do person pose estimation with this, or point me in the direction?

    • @MattBell
      @MattBell  Рік тому

      OpenCV tends to be a little lower level than that, but check out MediaPipes

    • @adamtemple9417
      @adamtemple9417 Рік тому

      @@MattBell I wound up buy the 100 dollar version. Now I'm combining what you did with what they did. You're tutorial is extremely helpful. Thank you

  • @aldifahluzi6998
    @aldifahluzi6998 2 роки тому

    can it be built into an android or desktop application?
    I've tried using OpenCvSharp but when it was built into an android application the results were different from the editor
    sorry if my english is weird, i use google translate

  • @sebastianhagen2500
    @sebastianhagen2500 2 роки тому

    What Unity Extension for VSCode do you use?

    • @MattBell
      @MattBell  2 роки тому

      Usually whatever the most recent one is

    • @sebastianhagen2500
      @sebastianhagen2500 2 роки тому

      @@MattBell Ah thx, I just read the instructions of Intellisense for VSCode. I didn't open VS on the root of the project. Now it works.

    • @thegrey448
      @thegrey448 Рік тому

      @@MattBell hi matt, how if we use our body as an object? could you give some explanation? thanks in advance

    • @MattBell
      @MattBell  Рік тому +1

      @@thegrey448 You can use body with this technique so long as you are videoing them against a plain background.

    • @thegrey448
      @thegrey448 Рік тому

      @@MattBell got it. many thanks 😇 buddy.

  • @MrTaffy90
    @MrTaffy90 Рік тому

    Bro can I get some help please

  • @afrakes4510
    @afrakes4510 Рік тому

    #pro

  • @sahilshaikh1722
    @sahilshaikh1722 Рік тому

    It will work in Android ?

    • @MattBell
      @MattBell  Рік тому

      I am not sure, but I suspect so

  • @alejandro76980
    @alejandro76980 2 роки тому

    Bro What about the colors of the Spheres???? heheh please

    • @Dan-Levi
      @Dan-Levi 2 роки тому +1

      particle.GetComponent().material.color = new Color(Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f));

  • @MrTaffy90
    @MrTaffy90 Рік тому

    bro array out of index don't work

    • @MattBell
      @MattBell  Рік тому

      For sure, bro. Gotta keep those indices in bounds

    • @MrTaffy90
      @MrTaffy90 Рік тому

      @@MattBell bro if give min are 5000 is slows down. and array out of index. if I give 10000 it shows videos but don't find any contour.

    • @MrTaffy90
      @MrTaffy90 Рік тому

      @@MattBell bro can I get some help

    • @ihateuraja5696
      @ihateuraja5696 Рік тому

      @@MrTaffy90 hey in drawcontour method u might used int i =0, try this for (int i = 1; i < Points.Length; i++) int i =1 not 0(zero)