|
@@ -3,8 +3,8 @@
|
|
|
* @Version: 1.0
|
|
|
* @Autor: lishengyin
|
|
|
* @Date: 2022-03-22 14:00:46
|
|
|
- * @LastEditors: lishengyin
|
|
|
- * @LastEditTime: 2022-03-25 09:56:36
|
|
|
+ * @LastEditors: Your Name lishengyin@sz-sunwin.com
|
|
|
+ * @LastEditTime: 2022-05-15 22:07:45
|
|
|
*/
|
|
|
#include "InfineFilter.h"
|
|
|
|
|
@@ -86,6 +86,8 @@ namespace cnstream{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if(!getNight()) return 0;
|
|
|
+
|
|
|
// 过滤星星、月亮、飞机
|
|
|
for(auto iter = objs_holder->objs_.begin(); iter != objs_holder->objs_.end();){
|
|
|
std::shared_ptr<cnstream::CNInferObject> object = *iter;
|
|
@@ -105,8 +107,6 @@ namespace cnstream{
|
|
|
* @return {*}
|
|
|
*/
|
|
|
bool InfineFilter::filter(cv::Mat image, std::shared_ptr<cnstream::CNInferObject>& object){
|
|
|
- if(!getNight(image)) return true;
|
|
|
-
|
|
|
cv::Mat img = image.clone();
|
|
|
// 腐蚀
|
|
|
erode(img, img, cv::Mat());
|
|
@@ -161,10 +161,12 @@ namespace cnstream{
|
|
|
* @param {*}
|
|
|
* @return {*}
|
|
|
*/
|
|
|
- bool InfineFilter::getNight(cv::Mat image){
|
|
|
- time_t now = time(0);
|
|
|
- tm *gmtm = gmtime(&now);
|
|
|
- if(gmtm->tm_hour > this->start || gmtm->tm_hour < this->end){
|
|
|
+ bool InfineFilter::getNight(){
|
|
|
+ time_t rawtime;
|
|
|
+ struct tm *info;
|
|
|
+ time(&rawtime);
|
|
|
+ info = localtime(&rawtime);
|
|
|
+ if(info->tm_hour > this->start || info->tm_hour < this->end){
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|