书单推荐:成为Java顶级程序员架构师 ,这20来本(高薪)必看点击获取
×î½üÑо¿OpenCVÏëÓÃjava½øÐпª·¢£¬Òò´ËÑо¿ÁËÒ»ÏÂÔõôÔÚEclipseÖÐÅäÖûùÓÚjavaµÄOpencv.
µÚÒ»²½£ºÏȵ½OpenCV¹ÙÍøÏÂÔØÄãÏëÒªµÄ°æ±¾£¬¼ÙÉèʹÓõÄÊÇ2.4.6°æ±¾¡£ÔÚ¹ÙÍøÏÂÔØÄãÏëÒªµÄ°æ±¾£¬½âѹµ½±¾µØµÄij¸öĿ¼¡£±ÈÈç D:/OpenCV/¡£
µÚ¶þ²½£¬´ò¿ªEclipse£¬²¢ÕÒµ½Window ¨C> Preferences.
µÚÈý²½£º½øÈëPreferences²Ëµ¥ºó£¬ÕÒµ½Java ¨C> Build Path ¨C> User Libraries £¬È»ºóµã»÷New
µÚËIJ½£ºµã»÷ÉÏÃæ¶Ô»°¿òµÄNewÖ®ºó£¬»áµ¯³öÒ»¸ö¶Ô»°¿ò£¬ÈçÏÂͼËùʾ£¬ÔÚÀïÃæÌîÈëÒ»¸öÃû×Ö£¬ÈçOpenCV-2.4.6
µÚÎå²½£ºµã»÷ÓÒ²àµÄAdd External JARs
µÚÁù²½£ºµã»÷ºó£¬ä¯ÀÀÎļþ¼ÐÕÒµ½Ç°Ãæ½âѹµÄÎļþ¼Ð£¬D:\OpenCV\build\java\£¬Ñ¡ÔñÀïÃæµÄopencv-246.jar£¬Ìí¼ÓÍêjar°üºó£¬Õ¹¿ª¸Õ²ÅÌí¼ÓµÄjar°ü£¬Ñ¡ÔñNative library location£¬µã»÷ÓÒ²àµÄEdit°´Å¥£¬¶ÔÆä½øÐбà¼
µÚÆß²½£ºµã»÷ External Folder...Ñ¡ÔñĿ¼µ½£ºD:\OpenCV\build\java\x64\£¬È»ºóµã»÷ok £¬Èç¹ûÄãʹÓõÄ32λϵͳÔòÑ¡Ôñx86Îļþ¼Ð
µÚ°Ë²½£ºÅäÖÃÍê³ÉºóµÄ½á¹ûÓ¦¸ÃÊÇÕâÑùµÄ¡£
ÕâÑù¾ÍÅäÖÃÍê³ÉÁË¡£ÏÂÃæ½øÐÐÒ»¸ö¼òµ¥µÄ²âÊÔ¡£´´½¨Ò»¸öJava Project£¬È»ºóÔÚÏîÄ¿ÉÏÓÒ¼ü£¬Build Path ---->Configure Build Path £¬µã»÷LibrariesÑ¡Ï£¬µã»÷ÏÂÃæµÄAdd Library,µ¯³öÀ´µÄ¶Ô»°¿òÖÐÑ¡Ôñ¡°User Library¡±¡£
È»ºó¹´Ñ¡OpenCV-2.4.6,ÕâÑù¾ÍÌí¼ÓÍê³ÉÁË¡£
Ìí¼ÓÍê³ÉºóµÄЧ¹ûÈçÏ£º
ÏÂÃæ¾Í¿ÉÒÔ½øÐвâÊÔÁË£¬¿ÉÒÔʹÓÃÈçϵĴúÂë½øÐвâÊÔ¡£
import org.opencv.core.Core; import org.opencv.core.CvType; import org.opencv.core.Mat; public class Hello { public static void main( String[] args ) { System.loadLibrary( Core.NATIVE_LIBRARY_NAME ); Mat mat = Mat.eye( 3, 3, CvType.CV_8UC1 ); System.out.println( "mat = " + mat.dump() ); } }
ÒÔÉϾÍÊDZ¾ÎĵÄÈ«²¿ÄÚÈÝ£¬Ï£Íû¶Ô´ó¼ÒµÄѧϰÓÐËù°ïÖú£¬Ò²Ï£Íû´ó¼Ò¶à¶àÖ§³Ö½Å±¾Ö®¼Ò¡£
转载请注明:谷谷点程序 » Eclipse下基于Java的OpenCV开发环境配置教程