First, let's temporarily load the v4l2 driver for the Raspberry Pi Cam to make sure our camera is plugged in correctly:
sudo modprobe bcm2835-v4l2
If the command failed (if it printed an error message to the console, it froze, or the command returned a number besides 0), then perhaps your camera is not plugged in correctly. Shut down and then unplug power from your Raspberry Pi and try attaching the flat white cable again, looking at photos on the web to make sure it's plugged in the correct way around. If it is the correct way around, it's possible the cable wasn't fully inserted before you closed the locking tab on the Raspberry Pi. Also, check whether you forgot to click Enable Camera when configuring your Raspberry Pi earlier, using the sudoraspi-config command.
If the command worked (if the command returned 0 and no error was printed to the console), then we can make sure the v4l2 driver for the Raspberry Pi Cam is always loaded on bootup by adding it to the bottom of the /etc/modules file:
sudo nano /etc/modules
# Load the Raspberry Pi Camera Module v4l2 driver on bootup:
bcm2835-v4l2
After you save the file and reboot your Raspberry Pi, you should be able to run ls /dev/video* to see a list of cameras available on your Raspberry Pi. If the Raspberry Pi Cam is the only camera plugged into your board, you should see it as the default camera (/dev/video0), or if you also have a USB webcam plugged in, then it will be either /dev/video0 or /dev/video1.
Let's test the Raspberry Pi Cam using the starter_video sample program we compiled earlier:
cd ~/opencv-4.*/samples/cpp
DISPLAY=:0 ./starter_video 0
If it's showing the wrong camera, try DISPLAY=:0 ./starter_video 1.
Now that we know the Raspberry Pi Cam is working in OpenCV, let's try Cartoonifier:
cd ~/Cartoonifier
DISPLAY=:0 ./Cartoonifier 0
Or, use DISPLAY=:0 ./Cartoonifier 1 for the other camera.