Auto-Measuring with OpenCV + Python - Try It Yourself

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 พ.ย. 2020
  • UPDATE: I added defaults and a config file where you can save your settings. See lines 19 and 40 in the new code.
    Fooling around with OpenCV and Python to measure stuff with a single camera. Automatic for the people. Try it out: gitlab.com/duder1966/youtube-...
    Camera: • New Camera Module - Un...
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @chrisdowdle1
    @chrisdowdle1 3 ปีที่แล้ว +4

    Clayton. This is just fantastic. Thank you so much for putting this stuff up for all to learn from. Cheers from a 'Land Downunder'. If I could give a million thumbs up I would.

  • @richardwoodza
    @richardwoodza 2 ปีที่แล้ว +4

    This is awesome, I appreciate your work and thank you for sharing this with us. Love the way it runs, so smoothly :). Again, thank you a lot for sharing, this help me a lot to keep learning.

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

    Hi Clayton, I would like to install your project on an ESP32 cam. My question is it possible?

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

      There isn't a simple solution for something like that. You would need something similar to the OpenCV library to do the object detection and image manipulation, but a very reduced and streamlined version to run on the ESP32. I haven't seen anything like that. Memory is going to be a problem. Most image libraries want to hold a full image in memory in order to work on it.

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

      Thank you for the quick reply. Then I will try it with the PI 4. Maybe you can make a video how to install everything exactly in what order. Please continue to do so that helps many users who are not so fit with the software

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

      I've never tried it, but I think a Pi4 should work, although you might not get as high of a frame rate as you could on a larger machine.

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

    Thank you Clayton! Especially for sharing the code. and how to find the object`s center point and the farthest distance from the center point

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

    That was really helpful, thank you so much, keep up the great work.

  • @DaveWheeler
    @DaveWheeler 3 ปีที่แล้ว +4

    Thank you Clayton! Especially for sharing the code. For anyone who wants to write the lengths file, the variables are ylen, xlen at #503-508ish in camruler.py. If it outputs too much data maybe adjust line 360 'time.sleep(0.1)' to something bigger? Another cheers from Down under.

  • @lehnertak
    @lehnertak 3 ปีที่แล้ว +2

    Nice Project! Thanks for making this available for those of us learning. I hope to use this to measure the size of peony flowers this summer for my girlfriend's small flower farm. She will think I am a genius!!

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

      Nice! Hey, are those your CNC tools in your videos? Do you have a CNC shop?

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

      @@ClaytonDarwin I set up a high end MakerSpace for a school in Shanghai the last five years. Couldn't get back because of Covid--so now I only have my own 3D printer, cricut cutter and Maslow CNC router to play with. Need to find another school to set up here in the States.

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

      Very cool. Did you see my recent SCARA plotter ( th-cam.com/video/djyMaqPY0tQ/w-d-xo.html ). I was trying to come up with something that anybody could build (i.e. teenagers). I would like to develop that more and do some other education-oriented projects at some point. Working on an ESP32 funboard at the moment (in my spare time).

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

      @@ClaytonDarwin Your plotter is nice.
      I had just started working with the Chinese Homework Machine and was going to have kids try and make one of them. www.scmp.com/yp/discover/entertainment/tech-gaming/article/3060907/chinese-schoolgirl-caught-using-robot-write
      It is another simple plotter that costs about $100 over there. A clever mechanism for x-y motion.

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

      I've seen those. Haven't had time to make one.

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

    This is awesome. Thank you so much for this. Could you please make a video about the how you plan the architecture for a project like this?

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

      Thanks. Glad you like it. I'm not sure about an architecture video. I'm self-taught for the most part, so I don't have much theory. I just work in parts, getting each function to work correctly, and then try to combine them into a logical, orderly, and efficient whole. I re-write many times, and I often write my own wrappers and libraries if the ones available don't do what I want. Lots of trial and error. Lots of failures. Lots of reading. Lots of Google queries.

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

    Well done Clyton. Good job and thanks

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

    Beautifully explained !!

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

    Nice work Clayton!!! I was wondering how can you implement real time angle meauserement in this project ??

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

      You would have to identify 3 points and then do a little trigonometry. OpenCV has quite a few options for things like that.

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

    This is awesome. if you have more time it will be very good if you make series tutorial of camera measurement of any object, for example key measurement as the object to measure the length and the height of each part of the key like the notches depth, the ridges height, the shoulder distance etc. Thank you very much.

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

      Good idea. I haven't had time lately to return to this project. But this can certainly be a template for a more complex project like what you are describing.

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

    Hello clayton
    Nice video, Can you Tel what camera and Lense you Are using for This project?
    Also what version of openmv Are you using?

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

      I have a USB3 camera somebody sent to me. I think it's 1080p, up to 60fps. There is a video about it. I pit an adjustable lens on it, and it was probably set at about 22-25mm. But pretty much anything will work.

  • @kevinlcarlson
    @kevinlcarlson 3 ปีที่แล้ว +2

    I just bought a webcam with a built-in ring light, to help prevent shadow issues. Also, am experimenting with round stickers at each corner of the white background sheet. Since these have a fixed diameter, circular object diameter can be measured as a percentage of the diameter of the round stickers, then actual size and position can be calculated even when the camera is moved, by constantly recalculating positions and sizes in a live video stream. Have you tried anything like this?

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

      Two good ideas. 👍 The lens distortion is fixed, so once you have it calibrated, you should be able to adjust based on the stickers. I think.

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

    Hi Clayton, very interesting project, would you please elaborate on the logic on how the menu system works. Your code is very neat and tidy, superb!

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

      I'll have to go and look at it. Can't remember off hand.

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

      All events are handled by either the key_event() or mouse_event() functions. The mouse event function must be registered as a callback, while the key event function can be called at the bottom of the main loop. The event functions basically read event data a set global variables. The main loop, then uses the variables to decide what action to perform (and also what values the use).

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

    Hey Clayton - Amazing work!! Do you know the equivalent command for windows to check on the camera ID piece by chance?

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

      Sorry. Haven't messed with windows for a while. Isn't there a devices list?

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

    I don't know what was going through the minds of the people who rated this video with a thumbs down, but I, like a host of others, appreciate your making these videos.

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

    Too much satisfactory to watch this

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

    Dearest Clayton Darwin ;
    could I use this code for my purpose of measuring objects?. Is it working in windows? thanks in advance

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

      Excellent. Yes. Use it however you like.

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

      @@ClaytonDarwin thanks with full respect dear

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

    Hello Clayton, ive a question and may you would like to answer, if i use 2 cameras which one for detect and measure reference object and other one for detect and measure another object that i wanna know that dimensions, could it be working on? I wanna make the camera which detect object measure can be adjustable

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

      I think you can combine the ideas in this video with the ideas in my triangulation video and do what you are describing. I haven't done it, but I have thought about it.

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

      @@ClaytonDarwin i wanna make it for my final project in school, thanks for your info. But now I'm stuck on how to use a USB camera when I've done put it in port USB, because when I tried your code I can't change the camera set, please let me know which code that I have to change for setting the camera to camera USB, not camera laptop webcam?

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

      You have to edit the code and set the camera number according to your setup. This is an OpenCV setting.

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

    Could this be used for measuring people's arms length, leg lenghts, etc in real time or from an image?

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

      This uses geometry/trigonometry to calculate distances based on a known distance (the distance from camera to table). You can use a similar algorithm to do the measurements you describe as long as you have a known distance to target measurement.

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

    Cool, I'm glad i get to watch this!. is it possible to rewrite or just add the code and measure the circumference of the circle?

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

      Yes. Any distance could be treated like a diameter and multiplied by pi.

  • @MiguelRodriguez-wn8mc
    @MiguelRodriguez-wn8mc ปีที่แล้ว +1

    Hello, it's very nice. Your development seems to work very well with square and rectangular objects. Now, what happens if the object doesn't have that shape? For example, a wood shaving, a small piece of paper cut by hand, some shapeless pieces of plastic.

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

      Like the title says, "try it yourself" and then you will know what it can do. Then you can take the code and improve it.

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

    Dear Clayton, this is an amazing video! I would like to use a camera to detect twp things: a fiber tip and the edge side of a metal plate. Could you give me a tip how to make the image recognition best?

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

      Sorry for the late reply. You could definitely add edge detection or image recognition to this using opencv. The best results will be had by closely controlling the environment and lighting to get a clear image.

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

    Thank you for your helpful lesson!
    Could you please recommend which camera is better to use for this task and generaly for computer vision? Thank you in advance.

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

      Any USB camera will work. Higher resolution allows more accuracy. Also, I like CS-mount cameras because they give you a lot of high-quality lens choices.

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

      @@ClaytonDarwin How do you zoom in the image in your video? Is it optical zoom or just digital one?

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

      In the video I use digital zoom. It's a feature of an OpenCV window. Will zoom to the sub-pixel level. If you change your zoom manually, you will have to re-calibrate your camera.

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

    Please Help Me Sir!
    I just want ask, if I have several object with different size & weight. can I convert the size of bounding box to weight? for example : 12.4 Cm x 5.9 Cm = 1KG. or something like this. " if width 12cm to 13cm and height 5cm to 6cm, print (1KG).. Thanks.

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

      If a 2D area has a direct relationship to weight for the specific objects that you are measuring, then yes. However, this is not the case for random objects.

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

    Great video! You currently rely on a known distance between the camera and the object to identify the dimensions of the object. Would it be feasible to modify the program to infer a distance between the camera and the object if the dimensions of the object are known?

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

      Sure. Same math, just using different variables.

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

    I LOVED THE TUTORIAL. However what units are objects measured in?

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

      Whatever you use during the calibration, that's what it is.

  • @suwei-fx6ib
    @suwei-fx6ib ปีที่แล้ว

    大叔这么厉害 这视频真的是太棒了

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

    Clayton when will you make the real-time object measurement video I am stuck that how to measure the distance from camera using opncv and pytorch?

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

      Distance from camera generally requires 2 cameras unless the target object is of a know size. Like my triangulation video. Also, this script is real time. You can make it an iterator and yield the data rather than plot it if you need to.

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

    Thank you Clayton! I'm just wondering what is the precision of measurement? Is it more than ± 0,1 mm?

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

      Accuracy depends on the camera pixel count, the lens, and how well you calibrate.

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

    Awesome project.

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

    Excellent video sir.
    Iam trying with a PTZ camera (analog). Which line in the program will call camera function? By default whether the program takes Laptop camera (inbuilt)? Thanks many

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

      The camera is defined in OpenCV by a number. You can change that near the top of the script. It is marked with a comment.

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

    Due to the nature of video analysis, measurements often change slightly. Is there any way to correct this part?

    • @ClaytonDarwin
      @ClaytonDarwin  3 ปีที่แล้ว +2

      Higher resolution cameras, better camera calibration, better lighting (and contrast adjustments). Those are main factors that affect measurement.

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

      @@ClaytonDarwin I've seen some document cameras on Amazon that apparently compensate for the distortion issue. These have much higher resolution than most web cams and can focus very closely. On the down side, the depth of field is not great, i.e. these are mostly suited for relatively flat objects such as books or other documents.

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

      Interesting. Might work in this situation.

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

    good video, I appreciate your work. I've a question please, how can I reduce the size of the window which displays the camera's view, because it appears only a part of the writing of modes and configurations... please respond as soon as possible.

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

      You can change it with an OpenCV parameter, or by changing the camera resolution. Or by dragging the frame corner with your mouse.

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

      @@ClaytonDarwin which parameter of OpenCV

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

      Try googling "OpenCV python change window size".

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

    Hi Clayton, This is very piratical and informative, can you point toward references on the topic? BTW, I like these technical topics but I miss the interesting gizmos you build... Cheers, Mitch

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

      Hi Mitch. I don't really have any specific references other than the OpenCV docs. I do lots of googling and reading, and then go back to the docs.

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

      Yeah. You're right. I need to get back to making stuff. I've just been really busy with work the last couple of years and not able to spend as much time in the shop. But making goofy robots is what I like to do. Thanks for reminding me.

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

    Hallo clayton i have a question, from this video why you don't use reference object?

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

      A small reference object assumes that the frame has already been normalised, which is what we are doing with the measurements. Once the frame is normalised, you could use a reference object. Alternatively, you could use a full-frame reference object to normalize the frame. I don't like the one in OpenCV, and I didn't have time to write one myself the day I made this video. This code is just an example, not a product.

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

    Hello, I would like to measure some cylindrical rock samples, in order to know which is the shortest side of the cylinder if the sample is broken and the broken face is diagonal. It would be a kind of irregular polygon where one side would be smaller. How do I make the code create an outline and identify the shortest side, putting the measurement in centimeters?

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

      Probably you could use opencv to detect edges/lines, or possibly a closed polygonal shape, and then build your dimensions from that. That's the way I would start tackling the problem.

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

    Hey Clayton thank you for you file How i can add the capture mode with photos had included detail of x,y axis and width,length of object and then save into our drive?

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

      Do you know how to program? You would have to change the code.

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

    Good job. I want to change your code to make an alarm system.
    for example, if the size is smaller or bigger of x start alarm. could you please let me know how should I do it?
    Thank you so much.

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

      You will have to add object recognition to prevent false alarms, and then insert the alarm routine after the measurement is calculated.

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

    I'd like to do something like this from a distance but get the GPS location of the pixels instead of their size. Do you think it can be done?

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

      I think so. With a single camera you will need a fixed reference point some exact distance from the camera, and then I think you can work out the distances as done in this video using some trig/geometry. You could then convert it to GPS coordinates from a known point.

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

    Hii, great video, Is this code works on windows, vscode ?

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

      I do not know. I only work on Linux.

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

    would using a single camera like this and something to measure the distance such as a IR distance sensor be able to calulate 3d dimentions of an object such as a mail parcel? My plan is at a larger scale, having the camera approx 1m away from the base. I am unsure if the maths will still work when the distance from camera changes by large amounts.

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

      Yeah, for 3D you will want 2 cameras, and some type of object recognition. You could use two of this setup, or or one of something like the triangulation video. From either, you can get the dimensions you need.

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

      @@ClaytonDarwin so knowing the distance from the camera will still not provide an accurate measurement? i will need 2 cameras to achieve this?

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

      If you know the distance to the table and the distance to the top of the package, then you have the height. If you compensate the 2D area to be accurate at the top of the package, then you have area. Area times height is volume for regular shapes. It would take some adjustments to be able to get the top area for different heights. So, I guess you could do it with one camera and a range finder, but it may be easier with 2 cameras.

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

    hey, I'm struggling to import frame capture and draw, how do I install these libraries?

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

      Did you install opencv for python?

  • @MatheusSilva-qm3ph
    @MatheusSilva-qm3ph 2 ปีที่แล้ว +1

    Very good video congratulations. A question, I have a .png image and I would like to find a frame that has it and see how far from the edge of the image is to the edge of the square. Can you make a video helping me? Thanks

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

      Unfortunately, I don't have the time to investigate this at the moment.

    • @MatheusSilva-qm3ph
      @MatheusSilva-qm3ph 2 ปีที่แล้ว

      @@ClaytonDarwin ok, thanks.

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

    Awesome video.. Would like to know how I could use two cameras to get real time three dimensions of an object using opencv

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

      👍 OpenCV has a distance mapping method included.

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

    Great job, I immediately subscribed, one question, how could i automate measurement and save it in a excel file to do computations consequently?! Thank you sir

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

      In the main loop, about the same place where it writes the values to the frame, you could also write the values into a database or append to CSV file (imports into excel). There are other options, and you may also want to have something you click, otherwise you will have all the stray measurements going into your data.
      This was really just a template that you could use to make another application. If you want to automate, you will have to do a lot of filtering to get just the data you want.

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

      @@ClaytonDarwin Thank you so much for the reply, I'll be trying to measure inhibition of bacteria in a culture medium representing a no growth halo, kudos to you, so this video and your project helps me a lot, I can't thank you enough sir, God bless you, peace and love from Iran

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

      One very nice thing about OpenCV is that it has a relatively easy way to train for object recognition. So, you always have the option of adding image recognition into the application. Or maybe more simply shape recognition. This might help you pick your targets automatically. It may be more programming that you are able to do if you are a microbiologist, but if you are in a university or research environment, there is probably a programmer that could help you.

    • @DrMoeVEVO
      @DrMoeVEVO 3 ปีที่แล้ว +2

      @@ClaytonDarwin indeed sir I am grateful for your advice, I am new to the AI field and I appreciate your work and you sharing your knowledge, God bless you and your family🙏

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

      @Lonesome Herd how did your writing to CSV go, can you share? Thanks

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

    Hello sir, do you also put a list of components that you use in this project into the zip file?

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

      USB camera, desktop PC, ruler.

  • @abomination.3005
    @abomination.3005 2 ปีที่แล้ว

    Hello sir, I want to measure the dimensions of a multi-sized object in one with the measurement frame still in which line do I need to edit?

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

      This is just a demo script. You will need to write your own to adapt to a specific task.

  • @muhammadrezap3222
    @muhammadrezap3222 4 หลายเดือนก่อน +1

    Hello sir, I'm a beginner in software programming and I'm interested in the measurement program you created. I've also accessed the program file through Git Hub. but in the program, I'm confused about how the steps are taken to get the actual unit of measure. can you explain it to me?

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

      The unit of measure depends on what measure you use during calibration. In the example I used mm.

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

    Thanks sir, thats great 👍

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

    when I measure the camera out of focus, how do I make the camera focus?
    I use a camera with a resolution of 720p

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

      I can't answer that. The software is not making the camera out of focus.

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

    hey clayton, i have a question, can it detect local image instead of real time? if so, how?
    thanks in advance

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

      Sure. You can modify the script to not loop, but instead modify one frame and stop. Just use the OpenCV-Python function to open a file instead of starting the camera. But you will have to go through the same calibration process for the camera you use. Everything depends on the camera setup and calibration.

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

      @@ClaytonDarwin cool, thanks, oh also can it somehow output the detected width and height to terminal?

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

      Yes, just the same as I print other values.

  • @anonimov9107
    @anonimov9107 11 หลายเดือนก่อน +1

    That should be interface for engraving fiber laser program.. Would be awesome

  • @user-nf8le2lv7r
    @user-nf8le2lv7r 3 หลายเดือนก่อน

    hello sir, I apologize in advance if my English pronunciation is lacking. I would like to ask about the automatic measurement program. especially in the camruler_cal.csv file. I understand that the conversion process is carried out for every 10 pixels based on pixel_base = 10. but I am confused, where are the pixel and scale values in the .csv file obtained from?

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

      When you do the calibration the file is created.

    • @user-nf8le2lv7r
      @user-nf8le2lv7r 3 หลายเดือนก่อน

      @@ClaytonDarwin However, if I use your program on Git Hub, the .cv file already exists. This means that if I rewrite all your programs, so that mean a new .csv file will be created containing pixel and scale data for calibration?

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

      Whenever you do the calibration a new calibration file is created.

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

      The other csv file is the setup variables.

    • @user-nf8le2lv7r
      @user-nf8le2lv7r 3 หลายเดือนก่อน

      The calibration do you mean is a measurement to get the cal_range value in config mode?

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

    I have made a setup using a raspberry pi 3b+ and using your code. my issue is the camera quality while running your code is too low for anything to be measured. when turning on the camera by itself the quality is fine. is this due to the processing speed of the pi? and how do i fix it?

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

      I am also getting this error, im not very adept in python so was wondering if you knew what it was or how to fix it?
      CAMERA: [0, 1280, 1024, 1310720, 30]
      key: [97, 'a']
      Traceback (most recent call last):
      File "camruler.py", line 504, in
      x1c,y1c = conv(x1-(cx),y1-(cy))
      File "camruler.py", line 135, in conv
      scale = cal[baseround(d,pixel_base)]
      KeyError: 820

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

      I think a raspberry pi will have a hard time with the real time frame rate along with the image manipulation required for measuring and display. However, I haven't tried it on a pi, so I'm not really sure.

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

      I'll have a look at the code in the morning. But basically the dictionary doesn't have the item being indexed.

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

    this is just fantastic, just wanted to know how can i use this on two cameras simultaneously

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

      You should be able to run 2 instances. You'll have to explicitly identify the cameras.

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

    sir can we try this projects using our phone cameras instead of webcam because I am finding difficult to afford the webcam

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

      I have never used a phone camera as a webcam, but one of my subscribers said it was possible.

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

    Hello sir, How to measure stuffs with YOLO or SSD object detection algorithms?

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

      OpenCV has several object detection methods you could add into the mail loop.

  • @patis.IA-AI
    @patis.IA-AI ปีที่แล้ว

    Hello Dear , thanks for the video. Little problem when I hit the A key my scrren frezes up ! Anny idea please ?

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

      No idea. I was using it the other day and it worked fine on my setup. Might be that you have a different key binding for A .

  • @Krishna-NV
    @Krishna-NV ปีที่แล้ว

    what should i do to store the dimensions obtained in auto mode into an excel sheet?

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

      The easiest thing would be to write data to a .csv file. Comma separated values can be read by any spreadsheet software.

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

    What version/ distro of Linux Are you using?

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

      Latest version of Lubuntu, but any Debian derivative works. I'm using the default Ubuntu install of OpenCV from the time the vid was made.

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

    Hi Clayton. I wrote a script for a non-contact animal measurement. Is it possible your program is fitted for Animal recognition and measurement thereafter write measurement to a csv file? I'm know yolov3 does recognition but I'm not sure of measurement. Kindly respond. Thank you. N.B my device is built on raspberrypi 4 with python3.

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

      Hi Tumininu. You can definitely take my script and adapt it. OpenCV can easily handle movement detection and object recognition, and it is straightforward to write the data to a csv file with Python. However there may be some physical problems to overcome.
      The script I wrote uses a single camera, and this requires that you know the distance from the target to the camera in order to determine the measurement. If you don't know the distance to the target, you will have to have a second camera and use triangulation (like my other video) to get the distance. You can then estimate size.
      Another problem (maybe) will be the raspi 4. It may not be able to process images fast enough to give you the frame rate you desire. The older raspis were very slow, but I haven't tried it with a new raspi 4. Maybe they are fast enough now.

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

      Thank you Clayton. I installed the OpenCv on my Raaspberry pi 4. It seems its to workon sbb_cv virtual memory. I copied your script from your site into my /home/pi/youtube-projects/OpenCV/camruler folder. i tried running 'python3 camruler.py 0'. it gave error on Line 12 in : No module named 'cv2'. kindly make suggestion.
      My setup uses 2 USB webcamera with known distance from the object (animal). I forgot to tell you I am a novice with programming. I just have a vision of this project and I am learning on the job.

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

      @@tumininuadebambo raspberrypi-guide.github.io/programming/install-opencv

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

      @@ClaytonDarwin Thanks i ll go through this.

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

      Hi Clayton. Thank for your usual asistance. I got it working. The frame is so large. How can i minimise it. The video seems i am only working at a corner of my whole view. I have tried changing several figures: width, height.... on the camruler.py. Kindly help again. ps dont get tired. cheers
      Can you also help withh the line to extract the measurement to a CSV file. Thanks

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

    Love your work just one question how do I make the code run on a video that I choose ?

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

      You have to change the code. Instead of opening a camera you open a file.

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

      @@ClaytonDarwin

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

      @@ClaytonDarwin yeah could you help me with that I'm sort of new to opencv again thanks :D

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

      Most OpenCV Python tutorials start with reading a video file. I'm not sure I'll have time to look at this anytime soon.

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

      @@ClaytonDarwin yeah I figured as well thanks though

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

    hi, I need help to store the area of the objects captured what changes should I do in the code anyone please help??

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

      Just write the value to file somewhere in the display loop.

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

    is it possible to use this as a calibration method for checking the mm of a certain object?

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

      Sure. If this is set up correctly and calibrated. The environment and lighting would have to be very controlled.

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

      @@ClaytonDarwin this will be possible if I use it on Paddy rice? I would like to use this to get their length and width.

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

      You could use a similar idea, but not this exact program. You can only estimate size if you have at least one known distance. In thes program i use the distance between the camera and the target (it is fixed) . You would have to add a way to determine a distance. See my video on triangulation. You would need to combine these two methods.

  • @channel-gc8vz
    @channel-gc8vz 3 ปีที่แล้ว

    Can you to measurement color and detector. Function have caribration color. Can you help me?

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

      OpenCV has built-in functions for color detection. There are many online tutorials for this.

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

    Sir are you directly connecting camera to usb, or using any boards in btw? Thank you in advance...

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

      Direct connect.

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

      @@ClaytonDarwin sir I am new to this, @6:15 and @6:40, which software prompt is that?

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

      Linux command line or python are the two options.

  • @tahafarshbaf
    @tahafarshbaf 3 วันที่ผ่านมา

    thanks for sharing

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

    hello Sir, i want to know what methods do you use in the measurement process?

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

    Have you tried changing the orientation of an object to get the actual length. Like in case of diode.

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

      Not really. I did this video because so many people were asking about measuring after watching some of my other videos. I haven't done anything with it since. There are many unexplored options.

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

      @@ClaytonDarwin Thank you for your reply. I will try it myself and if successful, would share the results with you. :)

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

      👍

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

    Hello, please I want to fix the configurations that we set every time we execute the code. ( I mean the measures of each part of "cal_rang" ) could you help me.

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

      When you do the configuration the first time, the program should create a configuration file. This is loaded on start, so you should not need to reconfigure unless the camera setup changes.

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

      @@ClaytonDarwin could you explain more please? what is the type of this file (filename.what?)

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

      @@ClaytonDarwin when I did the configuration, only one excel file that was created, is this what you mean?

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

      Please read the file: gitlab.com/duder1966/youtube-projects/-/blob/master/OpenCV/camruler/camruler.py#L118

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

      @@ClaytonDarwin I found the file, thanks.

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

    Great vedio, how I could measure the surface of the 3D features

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

      Because you don't know the distance to the target, 3D measurements typically requires 2 cameras and triangulation.

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

    Hi! What camera module you used for that?

    • @ClaytonDarwin
      @ClaytonDarwin  3 หลายเดือนก่อน +1

      Any that will work on your system. I've used several.

  • @Adii..740
    @Adii..740 2 ปีที่แล้ว

    Hey now what should I do when I Have to save the data in memory

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

    In this there is a buffer method, I can't understand it its part in the code. Can you help me please !

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

      The script frame_capture.py is a general module that I use for many different application. It works in a separate thread and captures camera frames as they happen. The frames are put into a buffer (holding area) and stored until the main loop can use them. The modules allows the camera to be managed outside the main loop, and prevent frames that are generated by the camera while the main loop is working from being overwritten/lost. In most cases, cameras only have a one-frame buffer. They read a frame and replace the one in the internal buffer, so it you don't read it in time, you lose it.

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

      @@ClaytonDarwin thank you

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

    Hi Can you make a video on all the methods used for measurement of items using open cv?

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

    hi i follow your videos and it work perfectly but i have question

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

    Nice video, i'm a beginner on python, and i have a project that is pretty similar, but my camera doesnt connect, so i'm trying to use my phone trough a Ip webcam, is it possible to apply the same functions ?
    Keep the good job, waiting for an answer ✌

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

      I don't know the answer. I've never used a phone as a webcam. It will have to be installed in a way that OpenCV can access it as a camera.

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

      @@ClaytonDarwin yeah, i understood due to the way how the code gets the image, i already have something working but not at 100% i would need some extra help on that

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

      Okay. Good that you have it partially working. I'm not able to investigate it at the moment.

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

      @@ClaytonDarwin do you think with would be reliable to aply this kind of system to a company ? Controlling measurements with it

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

      Reliability is based on calibration and testing. Lots of testing. But I would certainly have no issues with using this setup as a base for an industrial application.

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

    how to calibrate the distortions? it looks your camera have a minimum distortions

    • @ClaytonDarwin
      @ClaytonDarwin  6 หลายเดือนก่อน +1

      The calibration procedure shown remove the distortion.

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

      Ah thank you! 😂 i not aware

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

      @@ClaytonDarwin did you use a telecentric lens for this project?

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

      @@haikalhakim I don't think so.

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

    We can make lengths and widths. So how can we make weights (kilograms)?

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

      With a scale? Unless you know some way to estimate weight from 2D measurements.

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

      @@ClaytonDarwin Let's say we know the weights of some objects. How do we write it into the program? Do you know what the code is?

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

      Add a look-up table in the same place the area is calculated and added to the frame.

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

      @@ClaytonDarwin Thanks. Could you please write the code?

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

      I generally don't do other people's work without competition.

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

    Can we make it work for multi camera input.

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

      I think so, but I don't have time for it right now. Combine the triangulation video with this one.

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

      I am working on it currently. Do you have a solution already?

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

    is it possible to deplly on web server ?

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

      Sure, but I'm not sure how you would handle calibration and video.

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

    Sir which camera you are using here?

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

      Any USB camera should work.

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

      @@ClaytonDarwin i liked this pixel quality. That's why iam asking sir.

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

      I'll check and see what it was.

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

      This one: th-cam.com/video/qf-PKqFhwMg/w-d-xo.html

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

    سلام استاد
    لطفا درمورد مختصات وعملیات در روی حرکت اشیا که دریک ریل نواری که دوربین فرم به فرم را ثبت میکند را اموزش دهید لطفا

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

      I haven't been able to get your message translated yet.

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

    Why don’t you use an edge detector? That is how you detected edges. It’s really simple.

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

      Please share your code with us.

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

    Can we calculate volume of object?

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

      With this setup you only have two dimensions, so area only.

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

      @@ClaytonDarwin Thanks for your reply. Does using a stereo camera help calculating volume?

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

      Yes.

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

      @@ClaytonDarwin Any suggestions which one works the best, in case you ever tried it.

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

      I have a video where I do some work with two cameras and triangulation to determine distance. However, I haven't tried any off-the-shelf 3D software or cameras.

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

    Do you have C++ code too?

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

      Nope. But it should translate easily.

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

    BTW i dog those coins, cool collection👌🏻

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

    Wowwwwwwwwwww

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

    Hi, I am currently doing this kind of project, but I really don't know how can I start my codes in Python. I already saw your codes but I can't cope up since I'm not familiar with this yet. Can you help me with this, Sir?

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

      And what kind of microcontroller did you used? Thank you, Sir, in advanced.

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

      This video does not use a microcontroller.

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

      To run this code you will have to install Python and Python-OpenCV. Then it should run using a standard web camera over USB.

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

      @@ClaytonDarwin I already have it, Sir.
      Sir, can you explain your codes that you used in this video for the beginner like me? I mean, do you have tutorials video on how you write those codes?

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

      @@ClaytonDarwin If I will make a prototype on auto-measuring, what microcontroller you can suggest?