¡Esta es una revisión vieja del documento!
sudo apt-get install libopencv-dev python-opencv
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()
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; }