Herramientas de usuario

Herramientas del sitio


wiki2:opencv

¡Esta es una revisión vieja del documento!


OpenCV

Install & use

Install

sudo apt-get install libopencv-dev python-opencv

Use in Python

import cv2
import numpy as np
from matplotlib import pyplot as plt
 
cap = cv2.VideoCapture(0)
while True:
	ret, img = cap.read()
	color = ('b','g','r')
	for i,col in enumerate(color):
	    histr = cv2.calcHist([img],[i],None,[256],[0,256])
	    plt.plot(histr,color = col)
	    plt.xlim([0,256])
	plt.show()
cap.release()

Use in C++

g++ -ggdb `pkg-config --cflags opencv` -o `basename opencvtest.cpp .cpp` opencvtest.cpp `pkg-config --libs opencv`
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
 
int main()
{
    Mat img = imread("/home/alfred/Desktop/screen.jpg",CV_LOAD_IMAGE_COLOR);
    imshow("opencvtest",img);
    waitKey(0);
    return 0;
 }
wiki2/opencv.1445079165.txt.gz · Última modificación: 2020/05/09 09:24 (editor externo)