SmartCrop: fix debug image not being outputed in all cases where it should
This commit is contained in:
		
							parent
							
								
									e083ce3da7
								
							
						
					
					
						commit
						2a6908c849
					
				
					 2 changed files with 11 additions and 15 deletions
				
			
		| 
						 | 
				
			
			@ -302,7 +302,7 @@ void pipeline(const std::filesystem::path& path, const Config& config, Yolo& yol
 | 
			
		|||
			{
 | 
			
		||||
				detection.priority += 10;
 | 
			
		||||
				hasmatch = true;
 | 
			
		||||
				detections.push_back({0, "Face", match.confidence, 20, {255, 0, 0}, match.rect});
 | 
			
		||||
				//detections.push_back({0, "Face", match.confidence, 20, {255, 0, 0}, match.rect});
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		Log(Log::DEBUG)<<detection.class_id<<": "<<detection.className<<" at "<<detection.box<<" with prio "<<detection.priority<<(hasmatch ? " has match" : "");
 | 
			
		||||
| 
						 | 
				
			
			@ -322,10 +322,14 @@ void pipeline(const std::filesystem::path& path, const Config& config, Yolo& yol
 | 
			
		|||
 | 
			
		||||
	cv::Mat croppedImage;
 | 
			
		||||
 | 
			
		||||
	if(image.size().aspectRatio() != config.targetSize.aspectRatio() && incompleate)
 | 
			
		||||
	if(image.size().aspectRatio() == config.targetSize.aspectRatio())
 | 
			
		||||
	{
 | 
			
		||||
		intRoi.getCropRectangle(crop, detections, image.size());
 | 
			
		||||
 | 
			
		||||
		croppedImage = image;
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		if(incompleate)
 | 
			
		||||
			intRoi.getCropRectangle(crop, detections, image.size());
 | 
			
		||||
		if(config.debug)
 | 
			
		||||
		{
 | 
			
		||||
			cv::Mat debugImage = image.clone();
 | 
			
		||||
| 
						 | 
				
			
			@ -337,14 +341,6 @@ void pipeline(const std::filesystem::path& path, const Config& config, Yolo& yol
 | 
			
		|||
 | 
			
		||||
		croppedImage = image(crop);
 | 
			
		||||
	}
 | 
			
		||||
	else if(!incompleate)
 | 
			
		||||
	{
 | 
			
		||||
		croppedImage = image(crop);
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		croppedImage = image;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	cv::Mat resizedImage;
 | 
			
		||||
	cv::resize(croppedImage, resizedImage, config.targetSize, 0, 0, cv::INTER_CUBIC);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -42,9 +42,9 @@ public:
 | 
			
		|||
	};
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	static constexpr float modelConfidenceThreshold = 0.25;
 | 
			
		||||
	static constexpr float modelScoreThreshold = 0.45;
 | 
			
		||||
	static constexpr float modelNMSThreshold = 0.50;
 | 
			
		||||
	static constexpr float modelConfidenceThreshold = 0.20;
 | 
			
		||||
	static constexpr float modelScoreThreshold = 0.40;
 | 
			
		||||
	static constexpr float modelNMSThreshold = 0.45;
 | 
			
		||||
 | 
			
		||||
	std::string modelPath;
 | 
			
		||||
	std::vector<std::pair<std::string, int>> classes;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue