nhantd95
Posts: 2
Joined: Tue Jul 17, 2018 6:46 am

PiCam detection

Tue Jul 17, 2018 6:59 am

Hello guys,

I have a project using PiCam to observe the conveyor in our plant because sometime it was stucked.Is it possible to use PiCam to detect when the conveyor is stucked and stop ? I researched many projects on google but there are only Picam motion detect security system.How about detect "motion stop" ? Thanks guys ! :D

KnarfB
Posts: 194
Joined: Wed Dec 14, 2016 10:47 am
Location: Germany

Re: PiCam detection

Thu Jul 19, 2018 1:39 pm

Hi nhantd95,

I would use the OpenCV library and a little C++ programming for that (Python works too). Capture two picturea A and B and compute the sum of pixelwise absolute differences ( norm(A-B) ). If the resulting value is small (in plain theory: 0) the pictures are identical -> no motion. If the difference is larger than some threshold, the pictures differ --> motion.

Finding the thresholds needs some experimentation. You may restrict the area where you are looking for motion by masking the pictures. Varying lighting conditions will it make more difficult to find good thresholds. If you can put marks on the moving parts, this may help.

hth

KnarfB

nospam
Posts: 45
Joined: Sun Jun 14, 2015 10:38 pm

Re: PiCam detection

Sun Jul 22, 2018 1:04 pm

It's doable but you would be far better off (ie. cheaper and more robust solution) getting a dedicated industrial belt motion sensor and tie that into your PLC controlling the belt drive.

nhantd95
Posts: 2
Joined: Tue Jul 17, 2018 6:46 am

Re: PiCam detection

Mon Jul 30, 2018 8:27 am

Hi knarfB,
I don't understand your ideas.We have to capture 2 pics in the same motion or different motion ? And I always have to cap 2 pics to compare them to identify which one is motion and no motion ?

KnarfB
Posts: 194
Joined: Wed Dec 14, 2016 10:47 am
Location: Germany

Re: PiCam detection

Wed Aug 15, 2018 8:04 am

Hi nhantd95,

sorry for the delayed answer, I was on vacation. You capture a picture A and shortly afterwards another picture B. If A and B are identical --> no motion. If A and B differ --> motion (because something has changed/moved in the scene).

In practice you have to make decisions about the time difference between capturing A and B.
It should be small (to avoid global changes in the scene like sunlight,...) but not too small (depending on the speed of motion).

You have also to decide how to interpret "identical" because A and B will not be exactly the same (because of noise...)

A quick approach is to calculate the norm norm(B-A) and call A and B identical if the norm is below a threshold.
There are also more sophisticated approaches. Search for "motion detection opencv" to get an idea.

hth

KnarfB

PiGraham
Posts: 3401
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: PiCam detection

Wed Aug 15, 2018 8:15 am

nospam wrote:
Sun Jul 22, 2018 1:04 pm
It's doable but you would be far better off (ie. cheaper and more robust solution) getting a dedicated industrial belt motion sensor and tie that into your PLC controlling the belt drive.
I agree, this is a much better solution. Any industrial sensor that is triggered by motion of the belt can be used to confirm that the belt is moving.

PiGraham
Posts: 3401
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: PiCam detection

Wed Aug 15, 2018 8:22 am

nhantd95 wrote:
Tue Jul 17, 2018 6:59 am
Hello guys,

I have a project using PiCam to observe the conveyor in our plant because sometime it was stucked.Is it possible to use PiCam to detect when the conveyor is stucked and stop ? I researched many projects on google but there are only Picam motion detect security system.How about detect "motion stop" ? Thanks guys ! :D
If you want to detect no motion just keep looking for motion and if you don't find any for some time period signal a no motion alarm.
Bear in mind that an empty section of conveyor that is moving might not be detected as motion because it looks much the same . Also, there may still be motion detected when the conveyor is stopped due to changing lighting, or other changes in the scene e.g. people or machinery moving near the conveyor, flickering screens, blinking lights etc.


I don't think a camera is a good choice for this. Use a more direct and rugged sensor.

User avatar
RaTTuS
Posts: 10086
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: PiCam detection

Wed Aug 15, 2018 8:30 am

possibly you need to look at moition vectors
https://www.raspberrypi.org/blog/vector ... stimation/
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

Return to “Camera board”

Who is online

Users browsing this forum: Baidu [Spider] and 10 guests