From d7e3f882feb9307c22b0cd2698e45d24804b6572 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 20 七月 2022 18:37:45 +0800
Subject: [PATCH] '完善'

---
 ConsoleApplication/kernel.cl |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/ConsoleApplication/kernel.cl b/ConsoleApplication/kernel.cl
index 8b47866..872df6a 100644
--- a/ConsoleApplication/kernel.cl
+++ b/ConsoleApplication/kernel.cl
@@ -1290,6 +1290,21 @@
 	}
 }
 
+__kernel void rgb2GrayImgInvert(__global unsigned char* imgs, int width,
+	__global unsigned char* result) {
+
+	int rowIndex = get_global_id(0);
+
+	for (int c = 0;c < width;c++) {
+		int index = rowIndex * width + c;
+		int start = index * 3;
+		unsigned char R = imgs[start];
+		unsigned char G = imgs[start + 1];
+		unsigned char B = imgs[start + 2];
+		result[index] = 255 - (76 * R + 150 * G + 30 * B) >> 8;
+	}
+}
+
 __kernel void rgba2GrayImg(__global unsigned char* imgs, int width,
 	__global unsigned char* result) {
 
@@ -1306,6 +1321,22 @@
 }
 
 
+__kernel void rgba2GrayImgInvert(__global unsigned char* imgs, int width,
+	__global unsigned char* result) {
+
+	int rowIndex = get_global_id(0);
+
+	for (int c = 0;c < width;c++) {
+		int index = rowIndex * width + c;
+		int start = index * 4;
+		unsigned char R = imgs[start];
+		unsigned char G = imgs[start + 1];
+		unsigned char B = imgs[start + 2];
+		result[index] =255 - (76 * R + 150 * G + 30 * B) >> 8;
+	}
+}
+
+
 //L2非数字识别
 __kernel void recognition_not_num(__global unsigned char* imgs, __global int* rowIndexs, int width,
 	__global int* result) {

--
Gitblit v1.8.0