<commit_before>#include "NodeType.h"
#include "NodeFactory.h"

#include <opencv2/features2d/features2d.hpp>
using std::unique_ptr;

class BriskFeatureDetectorNodeType : public NodeType
{
public:
	BriskFeatureDetectorNodeType()
		: _thresh(30)
		, _nOctaves(3)
		, _patternScale(1.0f)
		, _brisk(new cv::BRISK())
	{
	}

	bool setProperty(PropertyID propId, const QVariant& newValue) override
	{
		if(propId > ID_PatternScale || propId < ID_Threshold)
			return false;

		switch(propId)
		{
		case ID_Threshold:
			_thresh = newValue.toInt();
		case ID_NumOctaves:
			_nOctaves = newValue.toInt();
		case ID_PatternScale:
			_patternScale  = newValue.toFloat();
		}

		// That's a bit cheating here - creating BRISK object takes time (approx. 200ms for PAL)
		// which if done per frame makes it slowish (more than SIFT actually)
		_brisk = unique_ptr<cv::BRISK>(new cv::BRISK(_thresh, _nOctaves, _patternScale));
		return true;
	}

	QVariant property(PropertyID propId) const override
	{
		switch(propId)
		{
		case ID_Threshold: return _thresh;
		case ID_NumOctaves: return _nOctaves;
		case ID_PatternScale: return _patternScale;
		}

		return QVariant();
	}

	ExecutionStatus execute(NodeSocketReader& reader, NodeSocketWriter& writer) override
	{
		const cv::Mat& src = reader.readSocket(0).getImage();<commit_msg>fixed brisk property setter<commit_after>#include "NodeType.h"
#include "NodeFactory.h"

#include <opencv2/features2d/features2d.hpp>
using std::unique_ptr;

class BriskFeatureDetectorNodeType : public NodeType
{
public:
	BriskFeatureDetectorNodeType()
		: _thresh(30)
		, _nOctaves(3)
		, _patternScale(1.0f)
		, _brisk(new cv::BRISK())
	{
	}

	bool setProperty(PropertyID propId, const QVariant& newValue) override
	{
		if(propId > ID_PatternScale || propId < ID_Threshold)
			return false;

		switch(propId)
		{
		case ID_Threshold:
			_thresh = newValue.toInt();
			break;
		case ID_NumOctaves:
			_nOctaves = newValue.toInt();
			break;
		case ID_PatternScale:
			_patternScale  = newValue.toFloat();
			break;
		}

		// That's a bit cheating here - creating BRISK object takes time (approx. 200ms for PAL)
		// which if done per frame makes it slowish (more than SIFT actually)
		_brisk = unique_ptr<cv::BRISK>(new cv::BRISK(_thresh, _nOctaves, _patternScale));
		return true;
	}

	QVariant property(PropertyID propId) const override
	{
		switch(propId)
		{
		case ID_Threshold: return _thresh;
		case ID_NumOctaves: return _nOctaves;
		case ID_PatternScale: return _patternScale;
		}

		return QVariant();
	}

	ExecutionStatus execute(NodeSocketReader& reader, NodeSocketWriter& writer) override
	{
		const cv::Mat& src = reader.readSocket(0).getImage();
{'fraction_non_alphanumeric': 0.10492905153099327, 'fraction_numerical': 0.008961911874533234, 'mean_word_length': 4.628151260504202, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7429556', 'n_tokens_mistral': 1032, 'n_tokens_neox': 936, 'n_words': 221}