Ask Your Question

Revision history [back]

OpenCV using Python to Detect any Object

First timer here! :)

So ill keep it short. The objective is to detect any object placed on a black belt (can be grocery items, toys, pencils, well anything in the super store) while the belt will also be moving the objects with the camera placed on top at a 45 degree angle at the start of the belt. That's it, detect any object if it is on the belt.

All ideas are welcome and ill probably being doing this on a Raspberry Pi.

OpenCV using Python to Detect any Object

First timer here! :)

So ill keep it short. The objective is to detect any object placed on a black belt (can be grocery items, toys, pencils, well anything in the super store) while the belt will also be moving the objects with the camera placed on top at a 45 degree angle at the start of the belt. That's it, detect any object if it is on the belt.

All ideas Edit Major Addition: Here is something to go on, I took an image when the belt was empty and now ill just compare the image of the empty belt with the current image of the belt. What can i do to compare the images. I have used sobel filter followed by matchtemplate function but that isnt giving me very reliable belts as i have to keep the threshold very tight which will cause it to be a bit unreliable incase of slight variation.

res = cv2.matchTemplate(img_w,Template_Final,method) #match template function

min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res) #minimum and max values

I am check the max_val and setting a threshold to see if the image has changed.

This is one method but I believe there are welcome and ill probably being doing better ones out there or somehow ways to tune this on a Raspberry Pi.method by changing the values.

OpenCV using Python to Detect any Object

First timer here! :)

So ill keep it short. The objective is to detect any object placed on a black belt (can be grocery items, toys, pencils, well anything in the super store) while the belt will also be moving the objects with the camera placed on top at a 45 degree angle at the start of the belt. That's it, detect any object if it is on the belt.

Edit Major Addition: Here is something to go on, I took an image when the belt was empty and now ill just compare the image of the empty belt with the current image of the belt. What can i do to compare the images. I have used sobel filter followed by matchtemplate function but that isnt giving me very reliable belts as i have to keep the threshold very tight which will cause it to be a bit unreliable incase of slight variation.

res = cv2.matchTemplate(img_w,Template_Final,method) #match template function

min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res) #minimum and max values

I am check checking the max_val and setting a threshold to see if the image has changed.changed. (max_val values are like 3.5+e7)

This is one method but I believe there are better ones out there or somehow ways to tune this method by changing the values.

OpenCV using Python to Detect any Object

First timer here! :)

So ill keep it short. The objective is to detect any object placed on a black belt (can be grocery items, toys, pencils, well anything in the super store) while the belt will also be moving the objects with the camera placed on top at a 45 degree angle at the start of the belt. That's it, detect any object if it is on the belt.

Edit Major Addition: Here is something to go on, I took an image when the belt was empty and now ill just compare the image of the empty belt with the current image of the belt. What can i do to compare the images. I have used sobel filter followed by matchtemplate function but that isnt giving me very reliable belts as i have to keep the threshold very tight which will cause it to be a bit unreliable incase of slight variation.

res = cv2.matchTemplate(img_w,Template_Final,method) #match template function

min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res) #minimum and max values

(img_w the current image of the belt and Template_Final is picture of empty belt and method i am using is cv2.TM_CCOEFF)

I am checking the max_val and setting a threshold to see if the image has changed. (max_val values are like 3.5+e7)

This is one method but I believe there are better ones out there or somehow ways to tune this method by changing the values.

OpenCV using Python to Detect any Object

First timer here! :)

So ill keep it short. The objective is to detect any object placed on a black belt (can be grocery items, toys, pencils, well anything in the super store) while the belt will also be moving the objects with the camera placed on top at a 45 degree angle at the start of the belt. That's it, detect any object if it is on the belt.

Edit Major Addition: Here is something to go on, I took an image when the belt was empty and now ill just compare the image of the empty belt with the current image of the belt. What can i do to compare the images. I have used sobel filter followed by matchtemplate function but that isnt giving me very reliable belts as i have to keep the threshold very tight which will cause it to be a bit unreliable incase of slight variation.

res = cv2.matchTemplate(img_w,Template_Final,method) #match template function

min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res) #minimum and max values

(img_w the current image of the belt and Template_Final is picture of empty belt and method i am using is cv2.TM_CCOEFF)

I am checking the max_val and setting a threshold to see if the image has changed. (max_val values are like 3.5+e7)

This is one method but I believe there are better ones out there or somehow ways to tune this method by changing the values.