. NET + OpenCV & Python + OpenCV configuration

Source: Internet
Author: User

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 
    1. 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 
  1. Import Cv2
  2. Import NumPy as NP
  3. #import PDB
  4. #pdb. Set_trace () #turn on the PDB prompt
  5. #test Cv2 and NumPy package
  6. Print cv2.__version__
  7. A = Np.arange (ten)
  8. Print (a)
  9. #read image
  10. img = cv2.imread (' D:\privacy\picture\little girl.jpg ', Cv2. Imread_color)
  11. Gray = Cv2.cvtcolor (img,cv2. Color_bgr2gray)
  12. Cv2.imshow (' TT ', IMG);
  13. #basic accessing
  14. B,g,r = img[0,0]; #blue, green,red
  15. Print B,g,r
  16. Rows,columns,channels = Img.shape
  17. Print Rows,columns,channels
  18. Print Img.size
  19. #channels Split and merge
  20. B,g,r = Cv2.split (IMG)
  21. img = Cv2.merge ([b,g,r])
  22. #SIFT
  23. detector = Cv2. SIFT ()
  24. Keypoints = Detector.detect (Gray,None)
  25. img = cv2.drawkeypoints (gray,keypoints)
  26. #img = cv2.drawkeypoints (gray,keypoints,flags = Cv2. draw_matches_flags_draw_rich_keypoints)
  27. Cv2.imshow (' Test ', IMG);
  28. Cv2.waitkey (0)
  29. Cv2.destroyallwindows ()



Results:

from:http://blog.csdn.net/abcjennifer/article/details/17580311

. NET + OpenCV & Python + OpenCV configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.