bw4sz / OpenCV_HummingbirdsMotion

Motion Detection using OpenCV and python
http://benweinstein.weebly.com/motionmeerkat.html
GNU General Public License v3.0
13 stars 5 forks source link

Cropping results in error #40

Closed dorian321373 closed 7 years ago

dorian321373 commented 7 years ago

Traceback (most recent call last): File "", line 131, in worker File "MotionMeerkat\motionClass.py", line 835, in wrap File "MotionMeerkat\motionClass.py", line 310, in run File "MotionMeerkat\BackgroundSubtractor.py", line 36, in BackGroundSub error: C:\opencv\source\opencv\modules\imgproc\src\accum.cpp:1201: error: (-215) _src.sameSize(_dst) && dcn == scn in function accumulateWeighted

Whenever I attempt to use the crop option

bw4sz commented 7 years ago

Can you give me the parameters log? Run the same commands, but without the crop and I can see the result of the parameters on a completed run. When was this downloaded, cloned? Is this pictures? Why use accumulated averaging, have you tried the MOG detector, its usually better. Give me more detail on your aims and we can figure this out. Thanks for the bug report.

dorian321373 commented 7 years ago

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: True Frame Rate: 1 Accumulated Averaging: 0.3 Threshold: 35 Expected hitrate: 0.1 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.1 percent of frame Output type: frames

Processing Total run time (min): 0.45 Average frames per second: 0.04

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: True Frame Rate: 1 Accumulated Averaging: 0.3 Threshold: 35 Expected hitrate: 0.1 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.1 percent of frame Output type: frames

Processing Total run time (min): 0.09 Average frames per second: 0.20

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: False Frame Rate: 1 Accumulated Averaging: 0.2 Threshold: 25 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.06 percent of frame Output type: frames

Processing Total run time (min): 0.13 Average frames per second: 0.13

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: False Frame Rate: 1 Accumulated Averaging: 0.2 Threshold: 25 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.06 percent of frame Output type: frames

Processing Total run time (min): 0.15 Average frames per second: 0.11

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: True Frame Rate: 1 Accumulated Averaging: 0.35 Threshold: 30 Expected hitrate: 0.1 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.07 percent of frame Output type: frames

Processing Total run time (min): 0.11 Average frames per second: 0.15

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Above is the parameter log for the unsuccessful run. I downloaded the newest version a few days back. I'm looking through 15 second interval time lapse photos taken in under road culverts designed with amphibians and reptiles in mind. I've looked through all the photos manually, picking out the frames of interest and now am trying to apply this program to it so that monitoring the culverts in future years can be less time intensive. I used the ACC just because I was fiddling around with settings after I got that cropping error. Running the program for my photos without cropping is promising but I just wanted to crop out the text lines on the top and bottom to eliminate the possibility of picking up movement in the changes of date, time, etc., especially since the target species are quite small and are sometimes quite far in the distance.

Below is the parameter log for a successful run of the same dataset (same settings other than no cropping):

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: True Frame Rate: 1 Accumulated Averaging: 0.3 Threshold: 35 Expected hitrate: 0.1 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.1 percent of frame Output type: frames

Processing Total run time (min): 0.45 Average frames per second: 0.04

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: True Frame Rate: 1 Accumulated Averaging: 0.3 Threshold: 35 Expected hitrate: 0.1 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.1 percent of frame Output type: frames

Processing Total run time (min): 0.09 Average frames per second: 0.20

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: False Frame Rate: 1 Accumulated Averaging: 0.2 Threshold: 25 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.06 percent of frame Output type: frames

Processing Total run time (min): 0.13 Average frames per second: 0.13

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: False Frame Rate: 1 Accumulated Averaging: 0.2 Threshold: 25 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.06 percent of frame Output type: frames

Processing Total run time (min): 0.15 Average frames per second: 0.11

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: True Frame Rate: 1 Accumulated Averaging: 0.35 Threshold: 30 Expected hitrate: 0.1 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.07 percent of frame Output type: frames

Processing Total run time (min): 0.11 Average frames per second: 0.15

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: True Frame Rate: 1 Accumulated Averaging: 0.2 Threshold: 25 Expected hitrate: 0.1 Frame crop: False Minimum size was drawn or entered?: enter Minimum area: 0.07 percent of frame Output type: frames

Processing Total run time (min): 14.57 Average frames per second: 6.16

Results Candidate motion events: 139 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 5250 Total frames in files: 5389 Hitrate: 2.58 %

Thanks for any and all help!

bw4sz commented 7 years ago

Please confirm problem version/when you downloaded, and if the problem exists when you use the MOG detector under advanced settings. This is a error of the frame size, i think. Not a MotionMeerkat error, but particular to your hardware, let's check.

On Sun, Dec 25, 2016 at 5:29 PM, dorian321373 notifications@github.com wrote:

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: True Frame Rate: 1 Accumulated Averaging: 0.3 Threshold: 35 Expected hitrate: 0.1 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.1 percent of frame Output type: frames

Processing Total run time (min): 0.45 Average frames per second: 0.04

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: True Frame Rate: 1 Accumulated Averaging: 0.3 Threshold: 35 Expected hitrate: 0.1 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.1 percent of frame Output type: frames

Processing Total run time (min): 0.09 Average frames per second: 0.20

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: False Frame Rate: 1 Accumulated Averaging: 0.2 Threshold: 25 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.06 percent of frame Output type: frames

Processing Total run time (min): 0.13 Average frames per second: 0.13

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: False Frame Rate: 1 Accumulated Averaging: 0.2 Threshold: 25 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.06 percent of frame Output type: frames

Processing Total run time (min): 0.15 Average frames per second: 0.11

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: True Frame Rate: 1 Accumulated Averaging: 0.35 Threshold: 30 Expected hitrate: 0.1 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.07 percent of frame Output type: frames

Processing Total run time (min): 0.11 Average frames per second: 0.15

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Above is the parameter log for the unsuccessful run. I downloaded the newest version a few days back. I'm looking through 15 second interval time lapse photos taken in under road culverts designed with amphibians and reptiles in mind. I've looked through all the photos manually, picking out the frames of interest and now am trying to apply this program to it so that monitoring the culverts in future years can be less time intensive. I used the ACC just because I was fiddling around with settings after I got that cropping error. Running the program for my photos without cropping is promising but I just wanted to crop out the text lines on the top and bottom to eliminate the possibility of picking up movement in the changes of date, time, etc., especially since the target species are quite small and are sometimes quite far in the distance.

Below is the parameter log for a successful run of the same dataset (same settings other than no cropping):

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: True Frame Rate: 1 Accumulated Averaging: 0.3 Threshold: 35 Expected hitrate: 0.1 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.1 percent of frame Output type: frames

Processing Total run time (min): 0.45 Average frames per second: 0.04

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: True Frame Rate: 1 Accumulated Averaging: 0.3 Threshold: 35 Expected hitrate: 0.1 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.1 percent of frame Output type: frames

Processing Total run time (min): 0.09 Average frames per second: 0.20

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: False Frame Rate: 1 Accumulated Averaging: 0.2 Threshold: 25 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.06 percent of frame Output type: frames

Processing Total run time (min): 0.13 Average frames per second: 0.13

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: False Frame Rate: 1 Accumulated Averaging: 0.2 Threshold: 25 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.06 percent of frame Output type: frames

Processing Total run time (min): 0.15 Average frames per second: 0.11

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: True Frame Rate: 1 Accumulated Averaging: 0.35 Threshold: 30 Expected hitrate: 0.1 Frame crop: True Set ROI: include Minimum size was drawn or entered?: enter Minimum area: 0.07 percent of frame Output type: frames

Processing Total run time (min): 0.11 Average frames per second: 0.15

Results Candidate motion events: 0 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 0 Total frames in files: 1 Hitrate: 0.00 %

Input Parameters Run type: pictures Input file path: C:/Gravel_July_21_22 Output dir: C:/Results Background Subtraction Method?: Acc Adapt settings: True Frame Rate: 1 Accumulated Averaging: 0.2 Threshold: 25 Expected hitrate: 0.1 Frame crop: False Minimum size was drawn or entered?: enter Minimum area: 0.07 percent of frame Output type: frames

Processing Total run time (min): 14.57 Average frames per second: 6.16

Results Candidate motion events: 139 Frames skipped due to insufficient movement based on the threshold parameter: 0 Frames skipped due to minimum size of the contours: 5250 Total frames in files: 5389 Hitrate: 2.58 %

Thanks for any and all help!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bw4sz/OpenCV_HummingbirdsMotion/issues/40#issuecomment-269146141, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJwrDW0iCss-ZfgalyRRB8--mc95S-9ks5rLxh0gaJpZM4LVd-M .

-- Ben Weinstein, Ph.D. Postdoctoral Fellow Oregon State University http://benweinstein.weebly.com/

dorian321373 commented 7 years ago

Version 2.0.2 downloaded on the 23rd of December. I had MOG detector selected before I ran it might be changing to ACC after I hit RUN, possibly due to the large number of photos or frame size?

bw4sz commented 7 years ago

very odd. Let me look into that. Please download the very latest version so we are synced up.

On Sun, Dec 25, 2016 at 6:01 PM, dorian321373 notifications@github.com wrote:

Version 2.0.2 downloaded on the 23rd of December. I had MOG detector selected before I ran it might be changing to ACC after I hit RUN, possibly due to the large number of photos or frame size?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bw4sz/OpenCV_HummingbirdsMotion/issues/40#issuecomment-269148122, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJwrNZn1kqdXOnG1uuYs-MdisXvhf6iks5rLx_8gaJpZM4LVd-M .

-- Ben Weinstein, Ph.D. Postdoctoral Fellow Oregon State University http://benweinstein.weebly.com/

dorian321373 commented 7 years ago

Did so, I believe it's a combination of this problem: https://github.com/bw4sz/OpenCV_HummingbirdsMotion/issues/27

and:

https://github.com/bw4sz/OpenCV_HummingbirdsMotion/issues/33

bw4sz commented 7 years ago

interesting. #27 is beyond my program, it relates to the source libraries. Can you send or post two sample pictures. I will build a resizer into the next version (easy to do).

On Sun, Dec 25, 2016 at 7:28 PM, dorian321373 notifications@github.com wrote:

Did so, I believe it's a combination of this problem:

27 https://github.com/bw4sz/OpenCV_HummingbirdsMotion/issues/27

and:

33 https://github.com/bw4sz/OpenCV_HummingbirdsMotion/issues/33

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bw4sz/OpenCV_HummingbirdsMotion/issues/40#issuecomment-269154671, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJwrPc3pUgzoWVGliXKB24O7DMdeKvyks5rLzRagaJpZM4LVd-M .

-- Ben Weinstein, Ph.D. Postdoctoral Fellow Oregon State University http://benweinstein.weebly.com/

dorian321373 commented 7 years ago

img_3785 img_1860

Here's a couple

bw4sz commented 7 years ago

Can confirm this is previous memory issue. Using just 2 of dorian's frames it runs clean:

Processing file C:/Users/Ben/Desktop/MeerkatTest/dorian
Output path will be C:/MotionMeerkat\dorian
2 pictures found
Processing...
50 % completed: 0 candidate motion frames
100 % completed: 1 candidate motion frames

Thank you for using MotionMeerkat! 

Total run time (min): 0.03 

Average frames processed per second: 1.29 

Candidate motion events: 2 

Frames skipped due to insufficient movement based on the threshold parameter: 0 

Frames skipped due to minimum size of the contours: 0 

Total frames in files: 2 

Hitrate: 100.00 % 
bw4sz commented 7 years ago

Will build a size frame reduction to test memory allocation as the frames pile up.

bw4sz commented 7 years ago

MOG works on rebuild. #27 needs to be closed.

['C:/Users/Ben/Documents/OpenCV_HummingbirdsMotion/MotionMeerkat/main.py', '--i', 'C:/Users/Ben/Desktop/MeerkatTest/torfinn', '--runtype', 'pictures']
Entering Command Line

Welcome to MotionMeerkat!

Background MOG sensitivity set to 0.09
MOG Variance tolerance set to 25
Processing file C:/Users/Ben/Desktop/MeerkatTest/torfinn
Output path will be C:/MotionMeerkat\torfinn
300 pictures found
Processing...
10 % completed: 3 candidate motion frames
20 % completed: 15 candidate motion frames
30 % completed: 22 candidate motion frames
40 % completed: 33 candidate motion frames
50 % completed: 43 candidate motion frames
60 % completed: 50 candidate motion frames
70 % completed: 56 candidate motion frames
80 % completed: 73 candidate motion frames
90 % completed: 82 candidate motion frames
100 % completed: 93 candidate motion frames

Thank you for using MotionMeerkat! 

Total run time (min): 4.68 

Average frames processed per second: 1.07 

Candidate motion events: 94 

Frames skipped due to insufficient movement based on the threshold parameter: 32 

Frames skipped due to minimum size of the contours: 174 

Total frames in files: 300 

Hitrate: 31.33 % 
bw4sz commented 7 years ago

Closed, V2.0.3 solves issues, please redownload and confirm.

dorian321373 commented 7 years ago

Confirmed, works like a charm, thanks!

bw4sz commented 7 years ago

Let me know how the performance is, we don't have many people using the pictures setting I'd like to hear about your experience On Mon, Dec 26, 2016 at 8:15 AM dorian321373 notifications@github.com wrote:

Confirmed, works like a charm, thanks!

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/bw4sz/OpenCV_HummingbirdsMotion/issues/40#issuecomment-269223756, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJwrEqAKsgQvUh3eJwdZMAz36Wr48HLks5rL-gUgaJpZM4LVd-M .