> For the complete documentation index, see [llms.txt](https://coronadoenrique.gitbook.io/nep+/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://coronadoenrique.gitbook.io/nep+/code-examples/sending-images-from-python-and-opencv.md).

# Sending images from Python and Opencv

```python
import cv2
import numpy as np
import sys
import nep
import time

id_ = 0
x_resolution = 640
y_resolution = 480

node = nep.node('camera_python')
conf = node.direct("192.168.1.10", "8585", "one2many")
pub_image= node.new_pub("testImage", "image", conf)

video = cv2.VideoCapture(id_)

video.set(cv2.CAP_PROP_FRAME_WIDTH, x_resolution)
video.set(cv2.CAP_PROP_FRAME_HEIGHT, y_resolution)

print("camera service started")

while True:

    try:
        success, frame = video.read()
        if success:
            pub_image.publish(frame)

            cv2.imshow("python", frame)
            key = cv2.waitKey(1) & 0xFF
            if key == ord('q') or key == ord('Q') or key == 0x1b:
                break
        else:
            time.sleep(.001)

    except:
        
        video.release()
        cv2.destroyAllWindows()
      
        time.sleep(1)
        pass
```
