# Camera isp output

This example shows how to use the `isp` output from the Camera node. Image Signal Processor (ISP) is a key camera component that
helps achieve the desired output quality in imaging systems. It is the ISP that converts raw images delivered by an image sensor
into a usable form, which can then be used by the embedded vision system for various tasks.

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

## Pipeline

## Source code

#### Python

```python
import cv2
import depthai as dai

# Create pipeline
with dai.Pipeline() as pipeline:
    # Define source and output
    cam = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_B)
    videoQueue = cam.requestOutput((800,400), fps=30).createOutputQueue()
    videoIsp = cam.requestIspOutput(fps=2).createOutputQueue()
    # Connect to device and start pipeline
    pipeline.start()
    videoIn = videoQueue.get()
    videoInIsp = videoIsp.get()
    print(
        "Standard output resolution = "
        f"{ videoIn.getCvFrame().shape[1]} x { videoIn.getCvFrame().shape[0]}"
    )
    print(
        f"Isp output resolution = "
        f"{ videoInIsp.getCvFrame().shape[1]} x { videoInIsp.getCvFrame().shape[0]}"
    )
    while pipeline.isRunning():
        videoIn = videoQueue.tryGet()
        videoInIsp = videoIsp.tryGet() # Returns 640x400
        if videoIn:
            cv2.imshow("video", videoIn.getCvFrame())
        if videoInIsp:
            cv2.imshow("videoIsp", videoInIsp.getCvFrame())

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

#### C++

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

#include "depthai/depthai.hpp"

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

void signalHandler(int) {
    quitEvent = true;
}

int main() {
    using namespace dai;
    using namespace std;

    signal(SIGTERM, signalHandler);
    signal(SIGINT, signalHandler);

    dai::Pipeline pipeline;

    auto cam = pipeline.create<dai::node::Camera>()->build(dai::CameraBoardSocket::CAM_B);

    // Request outputs
    auto videoOut = cam->requestOutput(std::make_pair(800, 400), std::nullopt, ImgResizeMode::CROP, 30.0f, std::nullopt);
    auto ispOut = cam->requestIspOutput(2.0f);

    // Create output queues
    auto videoQueue = videoOut->createOutputQueue();
    auto ispQueue = ispOut->createOutputQueue();

    pipeline.start();

    // Get first frames and print resolutions
    auto videoIn = videoQueue->get<dai::ImgFrame>();
    auto videoInIsp = ispQueue->get<dai::ImgFrame>();

    cout << "Standard output resolution = " << videoIn->getCvFrame().cols << " x " << videoIn->getCvFrame().rows << endl;

    cout << "Isp output resolution = " << videoInIsp->getCvFrame().cols << " x " << videoInIsp->getCvFrame().rows << endl;

    // Main loop
    while(pipeline.isRunning() && !quitEvent) {
        auto videoIn = videoQueue->tryGet<dai::ImgFrame>();
        auto videoInIsp = ispQueue->tryGet<dai::ImgFrame>();

        if(videoIn) {
            cv::imshow("video", videoIn->getCvFrame());
        }
        if(videoInIsp) {
            cv::imshow("videoIsp", videoInIsp->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.
