tensorflow with opencv webcam hangs

asked 2018-08-24 00:22:26 -0600

updated 2018-08-24 00:24:34 -0600

berak gravatar image

Hello All,

Environment: MAC machine, running my code inside virtual machine with guest OS: Ubuntu 14.4 LTS.

I am compiling openCV within tensorflow workspace under examples. My WORKSPACE and opencv.BUILD file look similar to the one mentioned here

My BUILD file for the opencv + tensorflow project looks like following:

package(default_visibility = ["//tensorflow:internal"])

licenses(["notice"]) # Apache 2.0

exports_files(["LICENSE"])

cc_binary( name = "label_image", srcs = [ "main.cc", ], linkopts = ["-lm"], copts = ["-DWITH_FFMPEG=OFF"], deps = [ "//tensorflow/cc:cc_ops", "//tensorflow/core:framework_internal", "//tensorflow/core:tensorflow", "@opencv//:opencv" ], )

filegroup( name = "all_files", srcs = glob( ["/"], exclude = [ "/METADATA", "/OWNERS", "bin/", "gen/*", ], ), visibility = ["//tensorflow:__subpackages__"], ) If i disable tensorflow dependences (and also comment the tensorflow related code). I can see that the webcam is captures properly. like this:

deps = [ #"//tensorflow/cc:cc_ops", #"//tensorflow/core:framework_internal", #"//tensorflow/core:tensorflow", "@opencv//:opencv" ], But if i still keep the code commented/uncommented and also keep the tensorflow dependences my webcam hangs at VideoCapture::read()

By default, opencv use FFMPEG codec and i tried enabling and disabling FFMPEG. Can someone please help me why when tensorflow library is compiled in the project makes my openCV read() hangs?

edit retag flag offensive close merge delete

Comments

ffmpeg is used to read video files (or ipcam-url's). libv4l is used for webcams

berak gravatar imageberak ( 2018-08-24 07:54:03 -0600 )edit

also please understand, that building tensorflow is way beyond the scope of this site.

berak gravatar imageberak ( 2018-08-24 07:55:49 -0600 )edit