You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
C
44 lines
1.1 KiB
C
![]()
3 years ago
|
//
|
||
|
// Created by UnknownObject on 2022/9/21.
|
||
|
// Copyright (c) 2022 UnknownNetworkService. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#ifndef MAINCAR_TRAFFIC_LIGHT_H
|
||
|
#define MAINCAR_TRAFFIC_LIGHT_H
|
||
|
|
||
|
#include <jni.h>
|
||
|
#include <cmath>
|
||
|
#include <string>
|
||
|
#include <iostream>
|
||
|
#include "public_types.h"
|
||
|
#include "opencv_support.h"
|
||
|
#include <opencv2/highgui.hpp>
|
||
|
|
||
|
#define TRAFFIC_LIGHT_RECO_VERSION "1.0.0"
|
||
|
|
||
|
namespace uns
|
||
|
{
|
||
|
class TrafficLight
|
||
|
{
|
||
|
private:
|
||
|
int GetCircle(cv::Mat& img);
|
||
|
bool CheckRGB(cv::Vec3b point);
|
||
|
int tri_max(int a, int b, int c);
|
||
|
void ImageProcess(cv::Mat& image);
|
||
|
bool ApproximatelyEqual(int a, int b, int offset);
|
||
|
void CutImage(cv::Mat& image,int radius,cv::Point center);
|
||
|
void CountMax(cv::Vec3b data, int& rmax, int& gmax, int& bmax);
|
||
|
private:
|
||
|
bool MuchLarger(int a, int b, double rate);
|
||
|
void CountColor(const cv::Mat& img, double rate, int& r_cnt, int& g_cnt, int& y_cnt);
|
||
|
cv::Mat SplitImage(const cv::Mat& img);
|
||
|
Light::TL_COLOR GetImageColor(const cv::Mat& img, double rate);
|
||
|
public:
|
||
|
Light::TL_COLOR GetColor(cv::Mat &image, int offset);
|
||
|
public:
|
||
|
Light::TL_COLOR Reco(cv::Mat &img);
|
||
|
};
|
||
|
};
|
||
|
|
||
|
#endif //MAINCAR_TRAFFIC_LIGHT_H
|