Skip to Content
Hands-On Robotics Programming with C++
book

Hands-On Robotics Programming with C++

by Dinesh Tavasalkar
March 2019
Intermediate to advanced
312 pages
7h 37m
English
Packt Publishing
Content preview from Hands-On Robotics Programming with C++

The object detection program

The program for detecting the green ball is named ObjectDetection.cpp and I have saved it inside the OpenCV_codes folder. I have also copied the greenball.png image to this folder. You can download the ObjectDetection.cpp program from the Chapter07 folder of the GitHub repository. So, the program for detecting the green ball is as follows:

#include <iostream>#include<opencv2/opencv.hpp>#include<opencv2/core/core.hpp>#include<opencv2/highgui/highgui.hpp>#include<opencv2/imgproc/imgproc.hpp>using namespace cv;using namespace std;int main(){ Mat img, resizeimg,thresimage; img = imread("greenball.png"); imshow("Green Ball Image", img); waitKey(0);  resize(img, resizeimg, cvSize(640, 480)); imshow("Resized Image", ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learn Robotics Programming

Learn Robotics Programming

Danny Staple
C++ Reactive Programming

C++ Reactive Programming

Praseed Pai, Peter Abraham

Publisher Resources

ISBN: 9781789139006Supplemental Content