Browse Source

更新 'utils.cpp'

孙武 2 days ago
parent
commit
5005355e88
1 changed files with 23 additions and 0 deletions
  1. 23 0
      utils.cpp

+ 23 - 0
utils.cpp

@@ -72,3 +72,26 @@ int cropImg(unsigned short *input, unsigned short *output, int Width, int Height
     return 1;
 }
 
+int applyInvertMask(unsigned short* input, unsigned char* pmask, int Width, int Height, unsigned short* output,int fillvalue = 4095)
+{
+	if (input == nullptr)
+	{
+		return 0;
+	}
+	if (pmask == nullptr)
+	{
+		return 0;
+	}
+
+#pragma omp parallel for
+	for (int i = 0; i < Width * Height; i++)
+	{
+		if (!pmask[i])
+		{
+			output[i] += fillvalue;
+		}	
+	}
+
+	return 1;
+}
+