I've recently created a build of OpenCV with Julia bindings. It's probably because I'm new to Julia, but it's been challenging getting the appropriate argument typing for the opencv function calls. Anyway, I managed to get the code below executing properly so that it renders a half-scale version of the images captured from a web cam with just a little latency and at 15 fps, but when I re-run it with a change to scale the image down to one-fourth of the size, it core dumps.
So this works:
print("Initializing OpenCV...")
using Printf
using OpenCV
cv = OpenCV
cap = cv.VideoCapture("/dev/video0")
global count = 0
print("Ready\n ",count)
scaleDown = 2
while (cv.isOpened(cap))
global count
ret,img = cv.read(cap)
c,w,h=size(img)
@printf("%d %d %d\n",c,w,h)
sz = cv.Size(Int32(w÷scaleDown),Int32(h÷scaleDown))
img2 = cv.pyrDown(img,dstsize=sz)
count = count + 1
cv.imshow("Down",img2)
if cv.waitKey(Int32(1)) & 0xFF == Int('q')
break
end
end
cv.release(cap)
cv.destroyAllWindows()
print(count)
However, if scaleDown is set to 4, this results:
signal (6): Aborted
in expression starting at /home/kevin/Projects3/video-test.jl:15
gsignal at /usr/bin/../lib/x86_64-linux-gnu/libc.so.6 (unknown line)
abort at /usr/bin/../lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x7f27ba2e3675)
_ZN2cv5errorEiRKNSt7__ ... _wrapEUlS2_S2_S5_S6_E387_E9_M_invokeERKSt9_Any_dataS2_S2_S5_S6_ at /home/kevin/Projects2/build/OpenCV/src/lib/libopencv_julia (unknown line)
_ZN5jlcxx6detail11CallFunctorIN2cv3MatEJRS3_S4_RNS2_5Size_IiEERiEE5applyEPKvNS_13WrappedCppPtrESC_SC_SC_ at /home/kevin/Projects2/build/OpenCV/src/lib/libopencv_julia (unknown line)
jlopencv_cv_cv_pyrDown at /home/kevin/.julia/packages/CxxWrap/ZOkSN/src/CxxWrap.jl:590
pyrDown at /home/kevin/Projects2/build/OpenCV/src/cv_cxx_wrap.jl:1162 [inlined]
#pyrDown#57 at /home/kevin/Projects2/build/OpenCV/src/cv_cxx_wrap.jl:1164 [inlined]
pyrDown##kw at /home/kevin/Projects2/build/OpenCV/src/cv_cxx_wrap.jl:1164
unknown function (ip: 0x7f279e09f055)
top-level scope at /home/kevin/Projects3/video-test.jl:21
unknown function (ip: 0x7f27be5ec030)
unknown function (ip: 0x7f27be5c7105)
jl_load at /usr/bin/../lib/x86_64-linux-gnu/libjulia.so.1 (unknown line)
include at ./Base.jl:377
exec_options at ./client.jl:288
_start at ./client.jl:484
jfptr__start_2075.clone_1 at /usr/lib/x86_64-linux-gnu/julia/sys.so (unknown line)
unknown function (ip: 0x55ece9ac99d9)
unknown function (ip: 0x55ece9ac95a6)
__libc_start_main at /usr/bin/../lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x55ece9ac964d)
Allocations: 10815726 (Pool: 10814596; Big: 1130); GC: 3
Aborted (core dumped)
Why?