Recently need to do a GUI application for image recognition, weighed opencv+ 1) qt,2) Python gui,3). NET is selected after the. Net ...
This paper gives the corresponding reference of C#+OPENCV and PYTHON+OPENCV, saving everyone time.
(a) c#.net + OPENCV
1) Download and install the EMGU library (for OpenCV in. NET env)
Download @ http://sourceforge.net/projects/emgucv/
2) How do I use the OpenCV on C #?
VS Configuration Emgu (library)
3) test on C#.net
(ii) Python + OPENCV
According to the instruction of the official website, you can compile from source itself, or you can use binary files directly.
Here's a note of a mistake I encountered, undefined cv2. SIFT ():
[Plain]View PlainCopy
- Attributeerror: ' Module ' object has no attribute ' SIFT '
Check the data some places interpreted as a high version of the SIFT as Non-free module need to compile only, specific reference this post.
But I did not solve the problem after the successful compilation ... So try to OpenCV 2.3.1 OpenCV 2.4.6.0, and then according to the official website of the instruction pre-compiled binary file method cv2.pyd copy to Python, success ....
PS: Like to toss on the Mac to see this post it ... Installing OpenCV 2.4.2 on Mac OSX Mountain Lion with Python support
Finally put a python+opencv+numpy test code:
[Python]View PlainCopy
- Import Cv2
- Import NumPy as NP
- #import PDB
- #pdb. Set_trace () #turn on the PDB prompt
- #test Cv2 and NumPy package
- Print cv2.__version__
- A = Np.arange (ten)
- Print (a)
- #read image
- img = cv2.imread (' D:\privacy\picture\little girl.jpg ', Cv2. Imread_color)
- Gray = Cv2.cvtcolor (img,cv2. Color_bgr2gray)
- Cv2.imshow (' TT ', IMG);
- #basic accessing
- B,g,r = img[0,0]; #blue, green,red
- Print B,g,r
- Rows,columns,channels = Img.shape
- Print Rows,columns,channels
- Print Img.size
- #channels Split and merge
- B,g,r = Cv2.split (IMG)
- img = Cv2.merge ([b,g,r])
- #SIFT
- detector = Cv2. SIFT ()
- Keypoints = Detector.detect (Gray,None)
- img = cv2.drawkeypoints (gray,keypoints)
- #img = cv2.drawkeypoints (gray,keypoints,flags = Cv2. draw_matches_flags_draw_rich_keypoints)
- Cv2.imshow (' Test ', IMG);
- Cv2.waitkey (0)
- Cv2.destroyallwindows ()
Results:
from:http://blog.csdn.net/abcjennifer/article/details/17580311
. NET + OpenCV & Python + OpenCV configuration