Spot the Differences with Python and OpenCV
HTML-код
- Опубликовано: 14 окт 2024
- #Python #Opencv #Contours
Spot the differences between two images using Python and OpenCV.
Music: www.bensound.com
Photos by Pexels (www.pexels.com/ ):
1. Travel Photography (www.pexels.com...)
2. Fede Roveda (www.pexels.com...)
3. Florencia Potter (www.pexels.com...)
Great video! Very helpful, thanks so much!
Hello!
Great video!
I have a project where i need to detect if some object are missing from a product we make before we assemble the unit.
Is it possible to have a master image (how the product look with all parts assembled) and then a camera filming every product at the end of the production line to make sure all parts are assempled and then give live feedback if there is any parts missing?😊
Hello,
I think for your project you may need to change the code so tha it can accept video feed instead of simple image. Also you may need to make an image capture inside the video feed for each product always with same dimensions.
This may need a lot of changes on the code and a fixed camera position with keyboard capture handling
Very nice, I followed the error message like this:if cv2.contowrArea(contours) >10:
------
AttributeError: module 'cv2' has no attribute 'contowrArea'
@@hiennguyenvan-z6r Hello, based on the error you have misspelled the cv2.contourArea. You have contowr instead of contour.
ok,thank you@@kostast
really nice turorial, Thank you
Thank you !
Sir you are a genius. However, this code is old. Does not work now
Thank you !
nice Video, one more thing : if i want to read if there's any text inside Red Boxes then how i can read it in Loop ?
Hello, you are reffering to Text Detection. I haven't work with this very much. You will probably need to use both OpenCV and OCR (Optical Character Recognition). I make a note to look at it in the near future and maybe make a video about it.
how to do this on a handing food items on hook in grocery shops
sorry to bother you. Why my picture window appear in the whole gray and keep runing. It can't show up correctly.
Hello kevin chen,
Use gray image only to find the diff and then use diff to find threshold on so on. Also use the correct image when displaying the result. Please provide more info if necessary.
nice tutorial sir, any idea how to compare if our second object has slight rotation/movement
Hello, I am going to check it out and return with a possible solution.
Can i do same thing with c#. can you help me out for the same
Sorry but I am not familiar with C#. I believe that you can find online similar code steps or you could compare Python and C# corresponding commands.
@@kostast thank you so much
How can we do with different picture sizes?
Hello S Cidem,
In this code the second image is duplicate of the first one (same dimensions) with some extra differences. If you try to resize the second image (even if it's duplicate) to different shape values (width, height) with some image editor the result will be the same because we are resizing both initial and duplicate images.
If we skip the resizing part we will get an error : "Sizes of input arguments do not match".
can you plzz provide link of code
Hello, the full code is inside the video showing step by step exactly what is doing each line of code. If you follow the steps and write a similar Python script you will understand the logic and have a fully functional code.
hello
what IDE is this
Hello, it's IDLE (docs.python.org/3.10/library/idle.html)
How to handle image with different resolutions
Hello Navaneetha Krishnan ,
Image resolution is about the detail on an image (pixel count). Usually DPI or PPI (pixel per inch) is used as measuring unit for image resolution. The bigger the ppi of an image the better it's quality.
In this video we are having two images of same dimensions 600x360 (in order to compare them). Taking the first image as default and create a copy of it with some editing in order to have differences. So after the copy the ppi will be the same (72 ppi in this example).
You can try to compare two images of different resolution and you'll see that their level of similarity is really low.
Check also that you may have to use structural_similarity from skimage.metrics instead of compare_ssim depending on scikit-image version.
Source code ?
Hello, the fully functional code is presented through the steps mentioned in the video.