0

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?

Community
  • 1
  • 1
Milind Deore
  • 2,887
  • 5
  • 25
  • 40
  • I could able to get tensorflow and OpenCV working on MacOS by changing appropriate dynamic libraries for MAC (*.dylib) inside opencv.BUILD file. – Milind Deore Jan 28 '17 at 10:54

1 Answers1

0

The OpenCV Bazel build configuration you linked above appears to just glob all the .so files that CMake built. Maybe you need to pass the -DWITH_FFMPEG=OFF cflag to CMake? If you pass it to Bazel as you did above, it's only going to apply to the compilation of main.cc.

Justine Tunney
  • 532
  • 3
  • 10
  • Thanks for the input, but this didn't help me resolve my original problem of camera hanging. – Milind Deore Dec 24 '16 at 02:41
  • Hanging problems are hard to diagnose. It also seems orthogonal to the information you provided. I did the best I could with the information provided. – Justine Tunney Dec 27 '16 at 17:05