Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Python and cv2
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="TamPepper" data-source="post: 1479319" data-attributes="member: 242542"><p>Unfortunately I am stuck again !!</p><p>Reading through the opencv2 reference manual I tried the following code but it still throws an error on line using namespace cv;</p><p>Can you advise ?</p><p></p><p>#!/usr/bin/python</p><p>#include "opencv2/core/core.hpp"</p><p>#include "cv.h"</p><p>#include "highgui.h"</p><p>using namespace cv;</p><p>int main(int, char**) {</p><p>VideoCapture cap(0); if(!cap.isOpened()) return -1;</p><p>Mat frame, edges; namedWindow("edges",1); for(;<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite2" alt=";)" title="Wink ;)" loading="lazy" data-shortname=";)" /></p><p>{</p><p>cap >> frame;</p><p>cvtColor(frame, edges, CV_BGR2GRAY); GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5); Canny(edges, edges, 0, 30, 3);</p><p>imshow("edges", edges);</p><p>if(waitKey(30) >= 0) break;</p><p>}</p><p>return 0; }</p></blockquote><p></p>
[QUOTE="TamPepper, post: 1479319, member: 242542"] Unfortunately I am stuck again !! Reading through the opencv2 reference manual I tried the following code but it still throws an error on line using namespace cv; Can you advise ? #!/usr/bin/python #include "opencv2/core/core.hpp" #include "cv.h" #include "highgui.h" using namespace cv; int main(int, char**) { VideoCapture cap(0); if(!cap.isOpened()) return -1; Mat frame, edges; namedWindow("edges",1); for(;;) { cap >> frame; cvtColor(frame, edges, CV_BGR2GRAY); GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5); Canny(edges, edges, 0, 30, 3); imshow("edges", edges); if(waitKey(30) >= 0) break; } return 0; } [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Python and cv2
Top