Camera demo for Linux platform

Hi,

I tried the camera example on mac and saw that same is not available on Linux. Is there some JUCE camera example to get started. I am developing an application on Linux with the use of camera and juce seems to be a good framework to use.

Cheers
Suvir

At the moment JUCE doesn’t support webcams on Linux… although it could via Video4Linux.

I think a basic Linux camera support using Juce could be useful for doing experiments on camera overlay and juce audio and dsp features in places like industrial and automotive applications. Would be nice to add that request in upcoming releases.

Video4Linux is not so complicated. When comes to industrial applications on embedded platforms: there are implementation differences for different platforms so practically every platform requires slightly different approach (way of accessing buffer, image formats etc.) so some general approach would require changes anyway - that’s my experience.

Hi. I would second this request. : )
For context: I’ve developed a few plug-ins which accept spherical microphone array input and also video from a webcam (e.g., in this case, a 360 degree Ricoh Theta), and then overlaying the sound-field energy over the respective video in real-time:

However, while possible for Windows and MacOS, Linux has not yet received Web-Cam support.

Actually, might ask here, whether it is possible to at least have some “dummy” camera device class for Linux? (A place-holder for any potential future implementation). I only ask, as currently I would need to maintain 2x .jucer files and 2x PluginEditors, if I wanted to have just the sound-field visualisation part for Linux (JUCE_ENABLE_WEBCAM=0), and both the sound-field visualisation overlay and web-cam support for Mac+Windows (JUCE_ENABLE_WEBCAM=1). Just having CameraDevice_Linux defined, but returning 0 camera device labels would make it possible to have just the one jucer file.

2 Likes

Couldn’t you use #ifdefs rather than implementing 2 plugin editors?

Unfortunately, if PluginEditor is a GUI component then there is no way to encapsulate CameraDevice with #ifdef’s since Projucer will always overwrite this upon re-saving. Therefore, I believe that having two .jucer files, (one with the camera device enabled, the other disabled), which refer to their own PluginEditor copies (one that inherits cameraDevice, and one that does not), is the only solution at the moment.

//==============================================================================
/**
                                                                    //[Comments]
    An auto-generated component, created by the Introjucer.

    Describe your class and how it works here!
                                                                    //[/Comments]
*/
class PluginEditor  : public AudioProcessorEditor,
                      public MultiTimer,
                      public AsyncUpdater,
                      private CameraDevice::Listener,
                      public juce::ComboBox::Listener,
                      public juce::Slider::Listener,
                      public juce::Button::Listener
{
public:
    //==============================================================================
    PluginEditor (PluginProcessor* ownerFilter);
    ~PluginEditor() override;

    //==============================================================================
    //[UserMethods]     -- You can add your own custom methods in this section.

    //[/UserMethods]

But it is what it is… WebCam support is not (and probably shouldn’t be) a top priority for an audio focused framework, and I’m happy to patiently wait until it is eventually added (I waited 2 years for the MacOS webcam support to be fixed after-all ;).
I just wanted to pitch in and demonstrate a legitimate (although perhaps rather niche) use for the webcam in the context of audio, and also make it known that one more guy would like to see this brought to Linux when at all possible :slight_smile:

Wow, nice. Interestingly enough, I am working on something similar, putting sound image on top of camera view.