Skip to content
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

read camera without delay causes Could not scale frame on MacOS #343

Open
Sixzero opened this issue Dec 3, 2021 · 4 comments
Open

read camera without delay causes Could not scale frame on MacOS #343

Sixzero opened this issue Dec 3, 2021 · 4 comments
Labels

Comments

@Sixzero
Copy link

Sixzero commented Dec 3, 2021

The code:

import VideoIO

cam = VideoIO.opencamera()
while true
    img = read(cam)
end

Throws the error:

ERROR: LoadError: Could not scale frame
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] exec!(s::VideoIO.SwsTransform)
   @ VideoIO ~/.julia/packages/VideoIO/EsW3Z/src/frame_graph.jl:115
 [3] execute_graph!
   @ ~/.julia/packages/VideoIO/EsW3Z/src/avio.jl:456 [inlined]
 [4] _retrieve!(r::VideoIO.VideoReader{true, VideoIO.SwsTransform, String}, buf::PermutedDimsArray{ColorTypes.RGB{FixedPointNumbers.N0f8}, 2, (2, 1), (2, 1), Matrix{ColorTypes.RGB{FixedPointNumbers.N0f8}}})
   @ VideoIO ~/.julia/packages/VideoIO/EsW3Z/src/avio.jl:467
 [5] retrieve(r::VideoIO.VideoReader{true, VideoIO.SwsTransform, String})
   @ VideoIO ~/.julia/packages/VideoIO/EsW3Z/src/avio.jl:506
 [6] read(::VideoIO.VideoReader{true, VideoIO.SwsTransform, String})
   @ VideoIO ~/.julia/packages/VideoIO/EsW3Z/src/avio.jl:610
 [7] top-level scope
   @ ~/repo/julia-awesomeness/camera.test.jl:84
in expression starting at /Users/macpro/repo/julia-awesomeness/Boilerplate.jl/rtsp.test.jl:83

The issue is interesting in that sense read does run 10-20 times before in always just returns this error.

I tried to dig into the issue, but I didn't really know how I could debug the sws_scale function. Thank you in advance.

@Sixzero
Copy link
Author

Sixzero commented Dec 3, 2021

As for now, I guess the issue was because I used read too often. Probably its limited by the camera FPS?

We could get what causes the limit, and maybe state it in the error code.

@Sixzero
Copy link
Author

Sixzero commented Dec 4, 2021

If its not worth the pain, then I am closing the issue. :)

@IanButterworth
Copy link
Member

I can reproduce this.

It does seem like a bug. IMO reading in a loop like this is a reasonable thing to do

@IanButterworth IanButterworth changed the title openCamera read issue. Tested on Mac read camera without delay causes Could not scale frame on MacOS Mar 9, 2022
@ashwanirathee
Copy link
Contributor

Any ideas on what might be causing this, and is this platform specific(is it a issue on linux too or not)? I face it on windows despite sleep times of 2 sec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants