# Camera output

Example showcases DepthAIv3's functionality to request an output stream directly from the
[Camera](https://docs.luxonis.com/software-v3/depthai/depthai-components/nodes/camera.md) node, instead of having to create and
configure an [ImageManip](https://docs.luxonis.com/software-v3/depthai/depthai-components/nodes/image_manip.md) node.

```python
output = camera_node.requestOutput(
    size=(640, 480),
    type=dai.ImgFrame.Type.BGR888p,
    resize_mode=dai.ImgResizeMode.CROP,
    fps=15
)
```

Resize mode can be either `CROP`, `STRETCH`, or `LETTERBOX`, which come into play if there's a missmatch between sensor aspect
ratio (AR) and requested aspect ratio. For more information (pros/cons of each) check [Input frame AR
missmatch](https://docs.luxonis.com/software-v3/depthai/tutorials/resolution-techniques.md) documentation.

[Camera Multiple Outputs](https://docs.luxonis.com/software-v3/depthai/examples/camera/camera_multiple_outputs.md) example
showcases how to request multiple outputs from the Camera node.

This example requires the DepthAI v3 API, see [installation instructions](https://docs.luxonis.com/software-v3/depthai.md).

## Pipeline

## Source code

#### Python

```python
#!/usr/bin/env python3

import cv2
import depthai as dai

# Create pipeline
with dai.Pipeline() as pipeline:
    # Define source and output
    cam = pipeline.create(dai.node.Camera).build()
    videoQueue = cam.requestOutput((640,400)).createOutputQueue()

    # Connect to device and start pipeline
    pipeline.start()
    while pipeline.isRunning():
        videoIn = videoQueue.get()
        assert isinstance(videoIn, dai.ImgFrame)
        cv2.imshow("video", videoIn.getCvFrame())

        if cv2.waitKey(1) == ord("q"):
            break
```

#### C++

```cpp
#include <atomic>
#include <csignal>
#include <iostream>
#include <memory>
#include <opencv2/opencv.hpp>

#include "depthai/depthai.hpp"

std::atomic<bool> quitEvent(false);

void signalHandler(int) {
    quitEvent = true;
}

int main() {
    signal(SIGTERM, signalHandler);
    signal(SIGINT, signalHandler);

    // Create device
    std::shared_ptr<dai::Device> device = std::make_shared<dai::Device>();

    // Create pipeline
    dai::Pipeline pipeline(device);

    // Create nodes
    auto cam = pipeline.create<dai::node::Camera>()->build();
    auto videoQueue = cam->requestOutput(std::make_pair(640, 400))->createOutputQueue();

    // Start pipeline
    pipeline.start();

    while(pipeline.isRunning() && !quitEvent) {
        auto videoIn = videoQueue->get<dai::ImgFrame>();
        if(videoIn == nullptr) continue;

        cv::imshow("video", videoIn->getCvFrame());

        if(cv::waitKey(1) == 'q') {
            break;
        }
    }

    pipeline.stop();
    pipeline.wait();

    return 0;
}
```

### Need assistance?

Head over to [Discussion Forum](https://discuss.luxonis.com/) for technical support or any other questions you might have.
