Coder Social home page Coder Social logo

trellixvulnteam / opencv_9sdu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from khang-9966/opencv

0.0 0.0 0.0 131.72 MB

This is the demo vision part of the project: Using the arm robot to harvest the vegetables at one smart farm in VietNam

Shell 0.01% JavaScript 19.99% C++ 1.51% Python 68.79% C 2.60% Fortran 0.02% R 0.01% PowerShell 0.01% CSS 0.01% Makefile 0.01% HTML 0.35% Smarty 0.08% Jupyter Notebook 6.48% Xonsh 0.01% Less 0.01% Cython 0.12%

opencv_9sdu's Introduction

Detecting the gabbages by using OpenCV

Overall

The smart farm is the hot topic in VietNam over recent year. In this project we try to use the computer vision and arm robot in order to harvest the vegetables at one smart farm. The project is deivided to part. One is CV and one is robot.


Figure 1. One Soilless Growing Farm in Viet Nam – All systems are controlled automationly

This demon will so you how to use the OpenCV to detect the center of the gabbages. Because the camera is set up look down and we want a fast implement, we won't use the deep learning in this task, use the traditional image processing algorithm for all.


Figure 2. The robot and camera system – This is the first design and


Figure 3. The result of all processing – We want to know where are the centers of tha gabbages.

Step by Step

Ok, let start. First, when looking down we have a image as below.


Figure 4. The raw image – The image we get it when looking down.

We can se the gabbages is green and it's the effect feature for dectecting. Furthermore, The white pipes is one additional feature. The first step is median filter, The median filter is the simple and basic method for removing noise.

medianBlur(img, imgMedian, 7);


Figure 5. The image after median filter processing

After filting, we convert image from RGB to HSV color space, use the mornal threshold in HSV to make one mask includes all green pixeles.
cvtColor(imgMedian, imgHSV, COLOR_BGR2HSV);
inRange(imgHSV, cv::Scalar(35, 60, 40, 0), cv::Scalar(80, 255, 255, 0), imgTh);
inRange(imgHSV, cv::Scalar(0, 0, 200, 0), cv::Scalar(180, 50, 255, 0), imgThW);	
erode(imgTh, imgTh, Mat(), Point(0, 0), 2, 1, 1);
imgAfMask = Mat::zeros(img.size(), CV_8UC3);
img.copyTo(imgAfMask, imgTh);


Figure 6. The mask after using threshold algrorithm

Because the gabbages touch eac other, It's make very difficult to perform segmantation by one threshold algorithm. So, we use the watershed algorithm. You can enter the links for more detailed tutorial :

https://docs.opencv.org/3.3.1/d3/db4/tutorial_py_watershed.html

https://docs.opencv.org/3.4/d2/dbd/tutorial_distance_transform.html

opencv_9sdu's People

Contributors

khang-9966 avatar patchtester avatar trellixvulnteam avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.