算法发现坏点在Javascript算法、坏点、发现、Javascript

2023-09-11 04:36:13 作者:他是老娘的

我想创建一种算法,检测和计数坏点从强度地图以.csv格式。我的当前方法是将我通过的像素的值立即向右测试像素的值(或者,如果在最右侧,所述一个向左)。如果红利小于一定的阈值(目前为0.9),那么我将其标记为一个坏点。

I am trying to create an algorithm that detects and counts dead pixels from an intensity map in .csv format. My current approach is to divide the value of the pixel I am testing by the value of the pixel immediately to the right (or, if on the far right side, the one to the left). If the dividend is less than some threshold (currently .9), then I mark it as a dead pixel.

我的问题是,是否有计算,如果一个像素是死了更好/更有效的方法?

My question is, is there a better/more efficient way to calculate if a pixel is dead?

CSV输出示例:

3183    3176    3207    3183    3212
3211    3197    3198    3183    3191
3193    3177    1135    3185    3176
3175    3184    3188    3179    3181
3181    3165    3184    3187    3183

在这个例子中,中间的像素将是一个死的像素。

In this example, the middle pixel would be a "dead" pixel.

推荐答案

您目前的做法不会帮助你,如果你有坏点的集群。它也可以misinter $ P $角卡住像素(像素以100%的强度),为有效像素及周边像素的缺陷,这取决于被用于测试屏幕上的图像上。

Your current approach won't help you if you have a cluster of dead pixels. It can also misinterpret a stuck pixel (pixel with 100% intensity) as valid pixel and the surrounding pixel as defect, depending on the image that was used to test the screen.

而不是计算总平均μ和方差σ 2 您的数据和跨preT的数据的正态分布。按照 68-95-99.7规则的95%的数据应该是在区间[μ-2σ,μ+2σ]

Instead calculate the overall average µ and variance σ2 of your data and interpret the data as normal distributed. According to the 68-95-99.7 rule 95% of all data should be in the interval [µ-2σ,µ+2σ].

让我们来看看你的样品,并确定这是否是真实的数据:

Lets have a look at your sample and determine whether this is true for your data:

var arr = "5000 3176 3207 3183 3212 3211 3197 3198 3183 3191 3193 3177 1135 3185 3176 3175 3184 3188 3179 3181 3181 3165 3184 3187 3183".split(" ");
var i = 0;
var avg = 0; // average/mean
var vri = 0; // variance
var sigma;   // sqrt(vri)

for(i = 0; i < arr.length; ++i){
    arr[i] = parseInt(arr[i]);
    avg += arr[i];
}
avg /= arr.length;

for(i = 0; i < arr.length; ++i){
    vri += (arr[i]-avg)*(arr[i]-avg);
}
vri /= (arr.length - 1);
sigma =  Math.sqrt(vri);

for(i = 0; i < arr.length; ++i){
    if(Math.abs(arr[i]-avg) > 2*sigma)
        console.log("entry "+i+" with value "+arr[i]+" probably dead");
}

这将导致死像素(总像素的8%)揭示。请注意,我还添加了一个像素具有极高的强度,这可能是卡:

This will result in the dead pixels (8% of total pixels) revealed. Note that I also added a pixel with a very high intensity, which is probably stuck:

entry 0 with value 5000 propably dead
entry 12 with value 1135 probably dead

然而,有一个主要的缺点,因为如果屏幕亮度相同此方法才有效。此外,如果你录制的强度图与纯白色的图像的像素被卡住无法检测。当然,如果你的数据是分散的,因为屏幕是完全坏了,这种方法不会帮助你。除此之外,它很容易实现。你也可以添加本地检查过滤误报。

However, there is one major drawback, as this approach will only work if the screen equally illuminated. Also stuck pixel cannot be detected if you recorded the intensity map with a plain white image. And, of course, if your data is scattered because the screen is completely broken, this approach won't help you. Other than that it's easy to implement. You could also add a local check to filter false-positives.

请注意,该算法具有的固定运行时间3 * N

(的图已经创建的 Mwtoews )