注意OpenCV讀取影像的影像格式是BGR而不是RGB,所以後續不管是要使用OpenCV提供的API轉換色彩空間或者自行取值運算都要特別注意。以下我們會提供RGB與YCrCb、HSV、HSL、CIE-Lab、XYZ等色彩轉換的公是與方法。
cv::Mat srcImg = cv::imread("lena.jpg", CV_LOAD_IMAGE_COLOR);
//BGR to Gray Color Space
cv::Mat bgr2grayImg;Install build dependencies:
sudo apt-get install gtk-doc-tools liborc-0.4-0 liborc-0.4-dev libvorbis-dev libcdparanoia-dev libcdparanoia0 cdparanoia libvisual-0.4-0 libvisual-0.4-dev libvisual-0.4-plugins libvisual-projectm vorbis-tools vorbisgain libopus-dev libopus-doc libopus0 libopusfile-dev libopusfile0 libtheora-bin libtheora-dev libtheora-doc libvpx-dev libvpx-doc libvpx3 libqt5gstreamer-1.0-0 libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libflac++-dev libavc1394-dev libraw1394-dev libraw1394-tools libraw1394-doc libraw1394-tools libtag1-dev libtagc0-dev libwavpack-dev wavpack
Extras:
Javascript is a programming language with a peculiar twist. Its event driven model means that nothing blocks and everything runs concurrently. This is not to be confused with the same type of concurrency as running in parallel on multiple cores. Javascript is single threaded so each program runs on a single core yet every line of code executes without waiting for anything to return. This sounds weird but it's true. If you want to have any type of sequential ordering you can use events, callbacks, or as of late promises.
| // might need to check | |
| // http://stackoverflow.com/questions/15033363/obtaining-weights-in-cvsvm-the-svm-implementation-of-opencv/15070681#15070681 | |
| // for more info on how to get the svm from the CvSVM object to pass to HOG | |
| #include <iostream> | |
| #include <fstream> | |
| #include <string> | |
| #include <sstream> | |
| #include <iomanip> | |
| #include <stdexcept> |
| #include <SDKDDKVer.h> | |
| #include <Windows.h> | |
| #pragma warning(disable:4819) | |
| #pragma warning(disable:4996) | |
| // for OpenCV2 | |
| #include "opencv2/imgproc/imgproc.hpp" | |
| #include "opencv2/objdetect/objdetect.hpp" | |
| #include "opencv2/gpu/gpu.hpp" |
| #include "FlyCapture2.h" | |
| #include <opencv2/core/core.hpp> | |
| #include <opencv2/highgui/highgui.hpp> | |
| #include <iostream> | |
| using namespace FlyCapture2; | |
| int main() |
| ---------------------------------------------------------------------- | |
| -- This script shows how to train different models on the MNIST | |
| -- dataset, using multiple optimization techniques (SGD, LBFGS) | |
| -- | |
| -- This script demonstrates a classical example of training | |
| -- well-known models (convnet, MLP, logistic regression) | |
| -- on a 10-class classification problem. | |
| -- | |
| -- It illustrates several points: | |
| -- 1/ description of the model |
| #!C:\Python27\python.exe | |
| import ctypes | |
| import ctypes.wintypes as wintypes | |
| from ctypes import windll | |
| LPDWORD = ctypes.POINTER(wintypes.DWORD) | |
| LPOVERLAPPED = wintypes.LPVOID | |
| LPSECURITY_ATTRIBUTES = wintypes.LPVOID |
| #include<stdio.h> | |
| #define MAXSIZE 20 | |
| volatile char counterarray[MAXSIZE] = {0}; | |
| #define MAXDEPTH 10 | |
| int depth=0; | |
| int olddepth=0; | |
| int searcher=0; | |
| int searchermax[MAXDEPTH]; |
| volatile char _A[19] = {0}; | |
| #define _Y 10 | |
| int _D=0,_O=0,_S=0,_M[_Y],_C[_Y],_L; | |
| #define _ _C[_D] | |
| #define times [_A]=1;_D++;_S=0;for(_S \ | |
| =-1;_A[_S]==0;++_S){ _M \ | |
| [_D]=_S+1;}_A[_S]=0;for \ | |
| (_C[_D]=0;_O=_D,(_L=!!( \ | |
| _C[_O]<_M[_O] )),_C[_O] \ | |
| ==_M[_O]?_D--: 1,_O=_D, \ |