Recognition of a topology plot in a noise image

I have no particular problems with machine learning or image processing, so I hope someone can give some pointers to first thoughts on this issue:

Below is an example of a photograph of leaves of tomato leaves. We have thousands. We need to trace the veins and display the schedule. We already have undergraduates who trace veins manually for several hundred, so I believe this may be a training kit for the machine learning approach.

enter image description here

So my question is: what types of filters / classifiers immediately come to mind? Is there anything you recommend I read or watch?

, . , , , , , . , , , ...

!

+4
2

  • , / ( , , , ), , .

, , , , , .

, , - , . .

+2

opencv. . . , .

#include "stdafx.h"

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
using namespace cv;
using namespace std;

#define INPUT_FILE              "wMTjH3L.png"
#define OUTPUT_FOLDER_PATH      string("")
#define CONTOUR_AREA_THRESHOLD  30.0

int _tmain(int argc, _TCHAR* argv[])
{
    // read image as grayscale
    Mat im = imread(INPUT_FILE, CV_LOAD_IMAGE_GRAYSCALE);
    imwrite(OUTPUT_FOLDER_PATH + string("gray.jpg"), im);
    // smooth the image with a gaussian filter
    Mat blurred;
    GaussianBlur(im, blurred, Size(3, 3), 1.5);
    imwrite(OUTPUT_FOLDER_PATH + string("blurred.jpg"), blurred);
    // flatten lighter regions while retaining the darker vein regions using morphological opening
    Mat morph;
    Mat morphKernel = getStructuringElement(MORPH_ELLIPSE, Size(5, 5));
    morphologyEx(blurred, morph, MORPH_OPEN, morphKernel);
    imwrite(OUTPUT_FOLDER_PATH + string("morph.jpg"), morph);
    // apply adaptive thresholding
    Mat adaptTh;
    adaptiveThreshold(morph, adaptTh, 255.0, ADAPTIVE_THRESH_GAUSSIAN_C, CV_THRESH_BINARY_INV, 7, 2.0);
    imwrite(OUTPUT_FOLDER_PATH + string("adaptth.jpg"), adaptTh);
    // morphological closing to merge disjoint regions
    Mat morphBin;
    Mat morphKernelBin = getStructuringElement(MORPH_ELLIPSE, Size(3, 3));
    morphologyEx(adaptTh, morphBin, MORPH_CLOSE, morphKernelBin);
    imwrite(OUTPUT_FOLDER_PATH + string("adptmorph.jpg"), morphBin);
    // find contours
    vector<vector<Point>> contours;
    vector<Vec4i> hierarchy;
    findContours(morphBin, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, Point(0, 0));
    // filter contours by region areas and draw
    RNG rng(12345);
    Mat drawing = Mat::zeros(morphBin.size(), CV_8UC3);
    for(int idx = 0; idx >= 0; idx = hierarchy[idx][0])
    {
         if (contourArea(contours[idx]) > CONTOUR_AREA_THRESHOLD)
         {
             Scalar color( rand()&255, rand()&255, rand()&255 );
             drawContours( drawing, contours, idx, color, CV_FILLED, 8, hierarchy );
         }
    }
    imwrite(OUTPUT_FOLDER_PATH + string("cont.jpg"), drawing);
    return 0;
}

:

enter image description here

+2

Source: https://habr.com/ru/post/1536870/


All Articles