Ask Your Question

Revision history [back]

tensorflow with opencv webcam hangs

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?

click to hide/show revision 2
retagged

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

berak gravatar image

tensorflow with opencv webcam hangs

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?