-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
double frame read #134
Comments
function
def speed_get_contours(image, grayimage1):
Does the contour processing. It receives the current frame image and
converts it to grayscale and compares it to previous grayscale array to
calculate contours.
When finished the previous grayscale array is updated to the most recent
grayscale line 1218, that is returned by the function ready for the next
loop.
This is done to reduce processing and is by design.
Anyone can send changes via github push for review if they have an improved
method.
Claude
…On Tue, Aug 1, 2023 at 3:28 PM Bill Carter ***@***.***> wrote:
It looks like two image frames are being acquired for every cycle through
the scanning loop and the first one is not used.
On line 1326 there is the scanning loop;
while still_scanning: # process camera thread images and calculate speed
Then there's a frame read;
image2 = vs.read() # Read image data from video steam thread instance
And then speed_get_contours() is called, passing in the frame that was
read;
grayimage1, contours = speed_get_contours(image2, grayimage1)
But then speed_get_contours() ignores the frame that was passed in and
does another read in the while not image_ok: loop.
Was this intentional? It seems like that second frame read could be
eliminated.
—
Reply to this email directly, view it on GitHub
<#134>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABNPKZEUF4XSCYECYDROSNLXTFKHDANCNFSM6AAAAAA3AHGUJY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
YouTube Channel at https://www.youtube.com/user/pageaucp
<http://www.youtube.com/user/pageaucp>
GitHub Repository at https://github.com/pageauc
|
Yes I understand what the method does. I was pointing out that speed_get_contours() ignores the incoming frame and performs a second frame read in a loop before a crop is attempted. Maybe the vs.read() could be moved to the bottom of that loop? But if you are happy with it as-is that's fine with me. |
Thanks for your correct explanation. |
Thanks for the helpful fix! |
Note 12.02 replaces np.std with np.median for calculating ave speed. Speed camera is written as an object tracker. I will look at adding an option to use vehicle recognition (opencv haarcascade) that can improve speed calculation. Claude. |
It looks like two image frames are being acquired for every cycle through the scanning loop and the first one is not used.
On line 1326 there is the scanning loop;
while still_scanning: # process camera thread images and calculate speed
Then there's a frame read;
image2 = vs.read() # Read image data from video steam thread instance
And then speed_get_contours() is called, passing in the frame that was read;
grayimage1, contours = speed_get_contours(image2, grayimage1)
But then speed_get_contours() ignores the frame that was passed in and does another read in the
while not image_ok:
loop.Was this intentional? It seems like that second frame read could be eliminated.
The text was updated successfully, but these errors were encountered: